Commit c7c0f278 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Fix bug where IBM remote simulators not added to available backends. Configure...


Fix bug where IBM remote simulators not added to available backends. Configure IonQ backend to retrieve backend connectivity
Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent ab5569e3
Pipeline #154480 passed with stage
in 22 minutes and 34 seconds
......@@ -247,12 +247,6 @@ void IBMAccelerator::selectBackend(std::vector<std::string>& all_available_backe
if (!b.count("backend_name")) {
continue;
}
if (b.count("simulator")) {
// We don't need simulators at all
if (b["simulator"].get<bool>()) {
continue;
}
}
// Simple case: select by backend_name
if (!lowest_queue_backend) {
if (b["backend_name"].get<std::string>() == backend) {
......
......@@ -14,6 +14,7 @@
#include <cctype>
#include <fstream>
#include "xacc.hpp"
#include "json.hpp"
#include "ionq_program.hpp"
#include "ionq_program_visitor.hpp"
......@@ -40,6 +41,10 @@ void IonQAccelerator::initialize(const HeterogeneousMap &params) {
headers.insert({"Authorization", "apiKey " + apiKey});
headers.insert({"Content-Type", "application/json"});
auto calibrations = restClient->get(url, "/calibrations", headers);
auto j = nlohmann::json::parse(calibrations);
m_connectivity = j["calibrations"][0]["connectivity"].get<std::vector<std::pair<int,int>>>();
remoteUrl = url;
postPath = "/jobs";
}
......@@ -146,18 +151,7 @@ void IonQAccelerator::processResponse(std::shared_ptr<AcceleratorBuffer> buffer,
void IonQAccelerator::cancel() {}
std::vector<std::pair<int, int>> IonQAccelerator::getConnectivity() {
std::vector<std::pair<int, int>> graph;
int nq = 5;
for (int i = 0; i < nq; i++) {
for (int j = 0; j < nq; j++) {
if (i < j) {
// graph->addEdge(i, j);
graph.push_back({i, j});
}
}
}
return graph;
return m_connectivity;
}
void IonQAccelerator::searchAPIKey(std::string &key, std::string &url) {
......
......@@ -72,6 +72,7 @@ private:
int shots = 1024;
std::string backend = "simulator";
std::vector<std::pair<int,int>> m_connectivity;
bool jobIsRunning = false;
std::string currentJobId = "";
......
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