Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
d3115a09
Commit
d3115a09
authored
Jul 24, 2017
by
Mccaskey, Alex
Browse files
Adding load/persist args to DWQMICompiler
parent
4d522e1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
impls/dwave/DWQMICompiler.cpp
View file @
d3115a09
...
...
@@ -115,16 +115,31 @@ std::shared_ptr<IR> DWQMICompiler::compile(const std::string& src,
}
}
Embedding
embedding
;
// Get an embedding algorithm to execute
if
(
!
runtimeOptions
->
exists
(
"dwave-embedding"
))
{
if
(
!
runtimeOptions
->
exists
(
"dwave-embedding"
)
&&
!
runtimeOptions
->
exists
(
"dwave-load-embedding"
))
{
// For now, this is an error
XACCError
(
"You must specify an embedding algorithm"
);
XACCError
(
"You must specify an embedding algorithm
or embedding file.
"
);
}
auto
algoStr
=
(
*
runtimeOptions
)[
"dwave-embedding"
];
auto
embeddingAlgorithm
=
EmbeddingAlgorithmRegistry
::
instance
()
->
create
(
algoStr
);
// Compute the minor graph embedding
auto
embedding
=
embeddingAlgorithm
->
embed
(
problemGraph
,
hardwareGraph
);
if
(
runtimeOptions
->
exists
(
"dwave-load-embedding"
))
{
std
::
ifstream
ifs
((
*
runtimeOptions
)[
"dwave-load-embedding"
]);
embedding
.
load
(
ifs
);
}
else
{
auto
algoStr
=
(
*
runtimeOptions
)[
"dwave-embedding"
];
auto
embeddingAlgorithm
=
EmbeddingAlgorithmRegistry
::
instance
()
->
create
(
algoStr
);
// Compute the minor graph embedding
embedding
=
embeddingAlgorithm
->
embed
(
problemGraph
,
hardwareGraph
);
if
(
runtimeOptions
->
exists
(
"dwave-persist-embedding"
))
{
auto
fileName
=
(
*
runtimeOptions
)[
"dwave-persist-embedding"
];
std
::
ofstream
ofs
(
fileName
);
embedding
.
persist
(
ofs
);
}
}
// Add the embedding to the AcceleratorBuffer
aqcBuffer
->
setEmbedding
(
embedding
);
...
...
impls/dwave/DWQMICompiler.hpp
View file @
d3115a09
...
...
@@ -99,7 +99,9 @@ public:
"Provide the name of the Embedding Algorithm to use during compilation."
)(
"dwave-parameter-setter"
,
value
<
std
::
string
>
(),
"Provide the name of the "
"ParameterSetter to map logical parameters to physical parameters."
);
"ParameterSetter to map logical parameters to physical parameters."
)
(
"dwave-load-embedding"
,
value
<
std
::
string
>
(),
"Use the embedding in the given file."
)
(
"dwave-persist-embedding"
,
value
<
std
::
string
>
(),
"Persist the computed embedding to the given file name."
);
return
desc
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment