Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xacc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ORNL Quantum Computing Institute
xacc
Commits
ecc9ed0e
Commit
ecc9ed0e
authored
8 years ago
by
Mccaskey, Alex
Browse files
Options
Downloads
Patches
Plain Diff
continuing work with fire tensor accelerator
parent
9867d3be
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
quantum/gate/accelerators/FireTensorAccelerator.hpp
+42
-0
42 additions, 0 deletions
quantum/gate/accelerators/FireTensorAccelerator.hpp
xacc/compiler/GraphIR.hpp
+3
-0
3 additions, 0 deletions
xacc/compiler/GraphIR.hpp
with
45 additions
and
0 deletions
quantum/gate/accelerators/FireTensorAccelerator.hpp
+
42
−
0
View file @
ecc9ed0e
...
...
@@ -40,12 +40,23 @@
namespace
xacc
{
namespace
quantum
{
using
namespace
fire
;
double
sqrt2
=
std
::
sqrt
(
2.0
);
/**
*
*/
class
FireTensorAccelerator
:
public
Accelerator
{
public:
FireTensorAccelerator
()
{
Tensor
<
2
>
h
(
2
,
2
),
cnot
(
4
,
4
);
h
.
setValues
({{
1.0
/
sqrt2
,
1.0
/
sqrt2
},{
1.0
/
sqrt2
,
-
1.0
/
sqrt2
}});
cnot
.
setValues
({{
1
,
0
,
0
,
0
},{
0
,
1
,
0
,
0
},
{
0
,
0
,
0
,
1
},
{
0
,
0
,
1
,
0
}});
gates
.
emplace
(
"h"
,
h
);
gates
.
emplace
(
"cnot"
,
cnot
);
}
virtual
AcceleratorType
getType
()
{
return
AcceleratorType
::
qpu_gate
;
}
...
...
@@ -65,6 +76,36 @@ public:
QCIError
(
"Invalid IR - this Accelerator on accepts GraphIR<Graph<CircuitNode>>."
);
}
std
::
vector
<
CircuitNode
>
gateOperations
;
// Get the Graph
auto
graph
=
graphir
->
getGraph
();
int
nNodes
=
graph
.
order
(),
layer
=
1
;
int
finalLayer
=
graph
.
getVertexProperty
<
1
>
(
nNodes
-
1
);
for
(
int
i
=
0
;
i
<
nNodes
;
i
++
)
{
CircuitNode
n
;
n
.
properties
=
graph
.
getVertexProperties
(
i
);
gateOperations
.
emplace_back
(
n
);
}
while
(
layer
<
finalLayer
)
{
std
::
vector
<
CircuitNode
>
currentLayerGates
;
std
::
copy_if
(
gateOperations
.
begin
(),
gateOperations
.
end
(),
std
::
back_inserter
(
currentLayerGates
),
[
&
](
const
CircuitNode
&
c
)
{
return
std
::
get
<
1
>
(
c
.
properties
)
==
layer
;});
// Can parallize this...
for
(
auto
n
:
currentLayerGates
)
{
auto
gateName
=
std
::
get
<
0
>
(
n
.
properties
);
auto
actingQubits
=
std
::
get
<
3
>
(
n
.
properties
);
}
layer
++
;
}
}
virtual
~
FireTensorAccelerator
()
{
...
...
@@ -75,6 +116,7 @@ protected:
return
true
;
}
std
::
map
<
std
::
string
,
Tensor
<
2
>>
gates
;
};
}
}
...
...
This diff is collapsed.
Click to expand it.
xacc/compiler/GraphIR.hpp
+
3
−
0
View file @
ecc9ed0e
...
...
@@ -69,6 +69,9 @@ public:
}
DerivedGraph
&
getGraph
()
{
return
graph
;
}
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment