Commit 1732d3c4 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

added accelerator:backend parsing to xacc::getAccelerator()


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 078aaa04
Pipeline #58974 passed with stages
in 10 minutes and 55 seconds
......@@ -191,7 +191,13 @@ std::shared_ptr<Accelerator> getAccelerator(const std::string &name, std::shared
error("XACC not initialized before use. Please execute "
"xacc::Initialize() before using API.");
}
auto acc = xacc::getService<Accelerator>(name);
auto name_backend = split(name, ':');
auto acc = xacc::getService<Accelerator>(name_backend[0]);
if (name_backend.size() > 1) {
setOption(name_backend[0]+"-backend",name_backend[1]);
}
if (acc) {
auto remoteacc = std::dynamic_pointer_cast<RemoteAccelerator>(acc);
if (remoteacc) {
......@@ -210,7 +216,12 @@ std::shared_ptr<Accelerator> getAccelerator(const std::string &name) {
error("XACC not initialized before use. Please execute "
"xacc::Initialize() before using API.");
}
auto acc = xacc::getService<Accelerator>(name);
auto name_backend = split(name, ':');
auto acc = xacc::getService<Accelerator>(name_backend[0]);
if (name_backend.size() > 1) {
setOption(name_backend[0]+"-backend",name_backend[1]);
}
if (acc) {
acc->initialize();
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment