diff --git a/quantum/plugins/CMakeLists.txt b/quantum/plugins/CMakeLists.txt index 4756f3d89..70b5f5f76 100644 --- a/quantum/plugins/CMakeLists.txt +++ b/quantum/plugins/CMakeLists.txt @@ -18,7 +18,7 @@ add_subdirectory(staq) if(XACC_REMOTE_ACCELERATORS) add_subdirectory(ionq) - add_subdirectory(honeywell) + add_subdirectory(quantinuum) endif() if(NOT QIREE_MINIMAL_BUILD) diff --git a/quantum/plugins/honeywell/manifest.json b/quantum/plugins/honeywell/manifest.json deleted file mode 100644 index c0426d10d..000000000 --- a/quantum/plugins/honeywell/manifest.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "bundle.symbolic_name" : "xacc_honeywell", - "bundle.activator" : true, - "bundle.name" : "Honeywell ion trap accelerator", - "bundle.description" : "" -} diff --git a/quantum/plugins/honeywell/CMakeLists.txt b/quantum/plugins/quantinuum/CMakeLists.txt similarity index 96% rename from quantum/plugins/honeywell/CMakeLists.txt rename to quantum/plugins/quantinuum/CMakeLists.txt index d54eebaf8..ec4ebbc1f 100644 --- a/quantum/plugins/honeywell/CMakeLists.txt +++ b/quantum/plugins/quantinuum/CMakeLists.txt @@ -10,7 +10,7 @@ # Contributors: # Alexander J. McCaskey - initial API and implementation # *******************************************************************************/ -set(LIBRARY_NAME xacc-honeywell) +set(LIBRARY_NAME xacc-quantinuum) file(GLOB SRC *.cpp) @@ -23,7 +23,7 @@ target_include_directories(${LIBRARY_NAME} PUBLIC .) target_link_libraries(${LIBRARY_NAME} PUBLIC xacc cpr::cpr) -set(_bundle_name xacc_honeywell) +set(_bundle_name xacc_quantinuum) set_target_properties(${LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS US_BUNDLE_NAME=${_bundle_name} diff --git a/quantum/plugins/quantinuum/manifest.json b/quantum/plugins/quantinuum/manifest.json new file mode 100644 index 000000000..84ed27671 --- /dev/null +++ b/quantum/plugins/quantinuum/manifest.json @@ -0,0 +1,6 @@ +{ + "bundle.symbolic_name" : "xacc_quantinuum", + "bundle.activator" : true, + "bundle.name" : "Quantinuum ion trap accelerator", + "bundle.description" : "" +} diff --git a/quantum/plugins/honeywell/honeywell.cpp b/quantum/plugins/quantinuum/quantinuum.cpp similarity index 90% rename from quantum/plugins/honeywell/honeywell.cpp rename to quantum/plugins/quantinuum/quantinuum.cpp index 3be6cab5e..745323a2a 100644 --- a/quantum/plugins/honeywell/honeywell.cpp +++ b/quantum/plugins/quantinuum/quantinuum.cpp @@ -10,7 +10,7 @@ * Contributors: * Alexander J. McCaskey - initial API and implementation *******************************************************************************/ -#include "honeywell.hpp" +#include "quantinuum.hpp" #include #include @@ -78,7 +78,7 @@ std::pair need_refresh(std::vector old_key_time) { now2->tm_hour, now2->tm_min, now2->tm_sec)); } -void HoneywellAccelerator::refresh_tokens(bool force_refresh) { +void QuantinuumAccelerator::refresh_tokens(bool force_refresh) { if (!time_str.empty()) { std::vector old_time_key; auto time_split = xacc::split(time_str, '_'); @@ -96,7 +96,7 @@ void HoneywellAccelerator::refresh_tokens(bool force_refresh) { api_key = response_json["id-token"].get(); refresh_key = response_json["refresh-token"].get(); - std::ofstream out(std::string(getenv("HOME")) + "/.honeywell_config"); + std::ofstream out(std::string(getenv("HOME")) + "/.quantinuum_config"); out << "key:" << api_key << "\n"; out << "refresh:" << refresh_key << "\n"; out << "time:" << now << "\n"; @@ -106,7 +106,7 @@ void HoneywellAccelerator::refresh_tokens(bool force_refresh) { } } -void HoneywellAccelerator::initialize(const HeterogeneousMap ¶ms) { +void QuantinuumAccelerator::initialize(const HeterogeneousMap ¶ms) { if (!initialized) { searchAPIKey(api_key); @@ -144,7 +144,7 @@ void HoneywellAccelerator::initialize(const HeterogeneousMap ¶ms) { if (!xacc::container::contains(available_backends, backend)) { std::stringstream ss; ss << backend - << " is an invalid Honeywell backend or you do not have access to " + << " is an invalid Quantinuum backend or you do not have access to " "that backend.\nAvailable backends: \n"; for (const auto &name : available_backends) { ss << name << "\n"; @@ -167,19 +167,19 @@ void HoneywellAccelerator::initialize(const HeterogeneousMap ¶ms) { } } -void HoneywellAccelerator::execute( +void QuantinuumAccelerator::execute( std::shared_ptr buffer, const std::shared_ptr circuit) { if (backend.empty()) { xacc::error( - "Please specify a honeywell backend in your getAccelerator() call."); + "Please specify a quantinuum backend in your getAccelerator() call."); } auto qasm = getNativeCode(circuit); while (true) { auto backend_status = get(url, "machine/" + backend, generateRequestHeader()); auto status_J = nlohmann::json::parse(backend_status); - // xacc::info("\nHoneywell status:\n" + backend_status); + // xacc::info("\nQuantinuum status:\n" + backend_status); // If offline, terminate if (status_J["state"] == "offline") { xacc::error("Cannot run on " + backend + ", it is offline."); @@ -189,11 +189,11 @@ void HoneywellAccelerator::execute( break; } // If status = 'in maintenance', wait for a bit and try again - xacc::info("Honeywell is '" + std::string(status_J["state"]) + + xacc::info("Quantinuum is '" + std::string(status_J["state"]) + "', waiting for a bit..."); std::this_thread::sleep_for(std::chrono::seconds(60)); } - xacc::info("\nHoneywell sending qasm:\n" + qasm); + xacc::info("\nQuantinuum sending qasm:\n" + qasm); nlohmann::json j; @@ -244,7 +244,7 @@ void HoneywellAccelerator::execute( } auto job_id = response_json["job"].get(); - xacc::info("Honeywell job-id: " + job_id); + xacc::info("Quantinuum job-id: " + job_id); // Job has started, so watch for status == COMPLETED int dots = 1; @@ -260,7 +260,7 @@ void HoneywellAccelerator::execute( if (get_job_status_json["status"].get().find("failed") != std::string::npos) { - xacc::error("Honeywell job failed: " + get_job_status_json.dump(4)); + xacc::error("Quantinuum job failed: " + get_job_status_json.dump(4)); } if (get_job_status_json["status"].get() == "completed") { break; @@ -270,7 +270,7 @@ void HoneywellAccelerator::execute( dots = 1; std::stringstream ss; ss << "\033[0;32m" - << "Honeywell Job " + << "Quantinuum Job " << "\033[0;36m" << job_id << "\033[0;32m" << " Status: " << get_job_status_json["status"].get(); for (int i = 0; i < dots; i++) @@ -285,7 +285,7 @@ void HoneywellAccelerator::execute( std::cout << "\033[0m" << "\n"; - xacc::info("\nHoneywell job result json:\n" + get_job_status); + xacc::info("\nQuantinuum job result json:\n" + get_job_status); auto results = get_job_status_json["results"].begin()->get>(); for (auto &bitstring : results) { @@ -295,7 +295,7 @@ void HoneywellAccelerator::execute( return; } -void HoneywellAccelerator::execute( +void QuantinuumAccelerator::execute( std::shared_ptr buffer, const std::vector> compositeInstructions) { @@ -307,19 +307,19 @@ void HoneywellAccelerator::execute( } } -void HoneywellAccelerator::searchAPIKey(std::string &key) { +void QuantinuumAccelerator::searchAPIKey(std::string &key) { // // Search for the API Key in $HOME/.ibm_config, // // $HW_CONFIG, or in the command line argument --ibm-api-key - std::string hwConfig(std::string(getenv("HOME")) + "/.honeywell_config"); + std::string hwConfig(std::string(getenv("HOME")) + "/.quantinuum_config"); if (xacc::fileExists(hwConfig)) { findApiKeyInFile(key, hwConfig); } else { - xacc::error("Cannot find Honeywell Config file with credentials " - "(~/.honeywell_config)."); + xacc::error("Cannot find Quantinuum Config file with credentials " + "(~/.quantinuum_config)."); } } -void HoneywellAccelerator::findApiKeyInFile(std::string &apiKey, +void QuantinuumAccelerator::findApiKeyInFile(std::string &apiKey, const std::string &path) { std::ifstream stream(path); std::string contents((std::istreambuf_iterator(stream)), @@ -414,7 +414,7 @@ RestClient::get(const std::string &remoteUrl, const std::string &path, } std::string -HoneywellAccelerator::post(const std::string &_url, const std::string &path, +QuantinuumAccelerator::post(const std::string &_url, const std::string &path, const std::string &postStr, std::map headers) { std::string postResponse; @@ -452,7 +452,7 @@ HoneywellAccelerator::post(const std::string &_url, const std::string &path, } std::string -HoneywellAccelerator::get(const std::string &_url, const std::string &path, +QuantinuumAccelerator::get(const std::string &_url, const std::string &path, std::map headers, std::map extraParams) { std::string getResponse; @@ -494,7 +494,7 @@ HoneywellAccelerator::get(const std::string &_url, const std::string &path, } std::map -HoneywellAccelerator::generateRequestHeader() const { +QuantinuumAccelerator::generateRequestHeader() const { std::map headers{ {"Authorization", api_key}, {"Content-Type", "application/json"}, @@ -503,7 +503,7 @@ HoneywellAccelerator::generateRequestHeader() const { return headers; } -std::string HoneywellAccelerator::getNativeCode( +std::string QuantinuumAccelerator::getNativeCode( std::shared_ptr circuit, const HeterogeneousMap &config) { // Need to replace swaps with cnots @@ -547,14 +547,14 @@ namespace { /** */ -class US_ABI_LOCAL HoneywellActivator : public BundleActivator { +class US_ABI_LOCAL QuantinuumActivator : public BundleActivator { public: - HoneywellActivator() {} + QuantinuumActivator() {} /** */ void Start(BundleContext context) { - auto xt = std::make_shared(); + auto xt = std::make_shared(); context.RegisterService(xt); } @@ -565,4 +565,4 @@ class US_ABI_LOCAL HoneywellActivator : public BundleActivator { } // namespace -CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(HoneywellActivator) +CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(QuantinuumActivator) diff --git a/quantum/plugins/honeywell/honeywell.hpp b/quantum/plugins/quantinuum/quantinuum.hpp similarity index 93% rename from quantum/plugins/honeywell/honeywell.hpp rename to quantum/plugins/quantinuum/quantinuum.hpp index 2a13d7e6c..8a55a6ab3 100644 --- a/quantum/plugins/honeywell/honeywell.hpp +++ b/quantum/plugins/quantinuum/quantinuum.hpp @@ -10,8 +10,8 @@ * Contributors: * Alexander J. McCaskey - initial API and implementation *******************************************************************************/ -#ifndef XACC_HONEYWELL_ACCELERATOR_HPP_ -#define XACC_HONEYWELL_ACCELERATOR_HPP_ +#ifndef XACC_QUANTINUUM_ACCELERATOR_HPP_ +#define XACC_QUANTINUUM_ACCELERATOR_HPP_ #include "InstructionIterator.hpp" #include "Accelerator.hpp" @@ -56,7 +56,7 @@ std::string integral_to_binary_string(T byte, IS_INTEGRAL(T)) { std::string hex_string_to_binary_string(std::string hex); -class HoneywellAccelerator : public Accelerator { +class QuantinuumAccelerator : public Accelerator { public: void initialize(const HeterogeneousMap ¶ms = {}) override; void updateConfiguration(const HeterogeneousMap &config) override { @@ -76,10 +76,10 @@ class HoneywellAccelerator : public Accelerator { } const std::string getSignature() override { - return "honeywell"; + return "quantinuum"; } - const std::string name() const override { return "honeywell"; } + const std::string name() const override { return "quantinuum"; } const std::string description() const override { return ""; } @@ -94,10 +94,10 @@ class HoneywellAccelerator : public Accelerator { const HeterogeneousMap &config = {}) override; bool isRemote() override { return true; } - HoneywellAccelerator() + QuantinuumAccelerator() : Accelerator(), restClient(std::make_shared()) {} - virtual ~HoneywellAccelerator() {} + virtual ~QuantinuumAccelerator() {} private: void refresh_tokens(bool force = false); diff --git a/quantum/plugins/honeywell/tests/CMakeLists.txt b/quantum/plugins/quantinuum/tests/CMakeLists.txt similarity index 100% rename from quantum/plugins/honeywell/tests/CMakeLists.txt rename to quantum/plugins/quantinuum/tests/CMakeLists.txt diff --git a/quantum/plugins/honeywell/tests/HoneywellAcceleratorTester.cpp b/quantum/plugins/quantinuum/tests/QuantinuumAcceleratorTester.cpp similarity index 90% rename from quantum/plugins/honeywell/tests/HoneywellAcceleratorTester.cpp rename to quantum/plugins/quantinuum/tests/QuantinuumAcceleratorTester.cpp index 1c5456e86..049437680 100644 --- a/quantum/plugins/honeywell/tests/HoneywellAcceleratorTester.cpp +++ b/quantum/plugins/quantinuum/tests/QuantinuumAcceleratorTester.cpp @@ -13,9 +13,9 @@ #include "xacc.hpp" #include -TEST(HoneywellAcceleratorTester, checkSimple) { +TEST(QuantinuumAcceleratorTester, checkSimple) { xacc::set_verbose(true); - auto accelerator = xacc::getAccelerator("honeywell:H1-1SC"); + auto accelerator = xacc::getAccelerator("quantinuum:H1-1SC"); auto xasmCompiler = xacc::getCompiler("xasm"); auto ir = xasmCompiler->compile(R"(__qpu__ void bell(qbit q) { H(q[0]); @@ -33,9 +33,9 @@ TEST(HoneywellAcceleratorTester, checkSimple) { buffer->print(std::cout); } -TEST(HoneywellAcceleratorTester, checkConditionalTeleport) { +TEST(QuantinuumAcceleratorTester, checkConditionalTeleport) { xacc::set_verbose(true); - auto accelerator = xacc::getAccelerator("honeywell:H1-1SC"); + auto accelerator = xacc::getAccelerator("quantinuum:H1-1SC"); auto buffer = xacc::qalloc(3); auto xasmCompiler = xacc::getCompiler("xasm"); auto ir = xasmCompiler->compile(R"(__qpu__ void teleport(qbit q) { @@ -68,9 +68,9 @@ TEST(HoneywellAcceleratorTester, checkConditionalTeleport) { buffer->print(); } -TEST(HoneywellAcceleratorTester, checkConditionalIQPE) { +TEST(QuantinuumAcceleratorTester, checkConditionalIQPE) { xacc::set_verbose(true); - auto accelerator = xacc::getAccelerator("honeywell:H1-1SC"); + auto accelerator = xacc::getAccelerator("quantinuum:H1-1SC"); auto buffer = xacc::qalloc(3); auto xasmCompiler = xacc::getCompiler("xasm"); // Make sure we can validate it.