Loading README.md +37 −0 Original line number Diff line number Diff line # QCOR QCOR is a C++ language extension and associated compiler implementation for variational quantum computation on near-term, noisy devices. ## Dependencies Compiler (C++11): GNU 5+, Clang 3+ CMake 3.9+ XACC: see https://xacc.readthedocs.io/en/latest/install.html#building-xacc ## Build instructions For CMake 3.9+, do not use the apt-get installer, instead use `pip`, and ensure that `/usr/local/bin` is in your PATH: ```bash $ python -m pip install --upgrade cmake $ export PATH=$PATH:/usr/local/bin ``` On Ubuntu 16+, install latest clang and llvm libraries and headers (you may need sudo) ```bash $ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - $ add-apt-repository "deb http://apt.llvm.org/jessie/ llvm-toolchain-jessie main" $ apt-get update $ apt-get install libclang-9-dev llvm-9-dev clang-9 $ ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-config ``` Note that, for now, developers must clone QCOR manually: ``` bash $ git clone https://code.ornl.gov/qci/qcor $ cd qcor $ mkdir build && cd build $ cmake .. -DXACC_DIR=~/.xacc (or wherever you installed XACC) $ make install ``` runtime/CMakeLists.txt +4 −8 Original line number Diff line number Diff line Loading @@ -4,14 +4,10 @@ file(GLOB SRC *.cpp) add_library(${LIBRARY_NAME} SHARED ${SRC}) target_include_directories(${LIBRARY_NAME} PUBLIC . ${XACC_INCLUDE_DIRS} ) target_include_directories(${LIBRARY_NAME} PUBLIC . ${XACC_INCLUDE_DIRS}) target_link_libraries(${LIBRARY_NAME} PUBLIC xacc) # qcor_enable_rpath(${LIBRARY_NAME}) if(QCOR_BUILD_TESTS) Loading runtime/qcor.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,13 @@ using namespace xacc; namespace qcor { void Initialize(int argc, char** argv) { xacc::Initialize(argc,argv); } void Initialize(std::vector<std::string> argv) { xacc::Initialize(argv); } const std::string persistCompiledCircuit(std::shared_ptr<Function> function) { std::function<char()> randChar = []() -> char { const char charset[] = "0123456789" Loading runtime/qcor.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ namespace qcor { class qpu_handler; using HandlerLambda = std::function<void(qpu_handler &)>; void Initialize(int argc, char** argv); void Initialize(std::vector<std::string> argv); // Persist the given function to file, return // the file name Loading @@ -26,6 +28,7 @@ const std::string persistCompiledCircuit(std::shared_ptr<Function> function); std::shared_ptr<Function> loadCompiledCircuit(const std::string &fileName); // Submit an asynchronous job to the QPU using HandlerLambda = std::function<void(qpu_handler &)>; std::future<std::shared_ptr<AcceleratorBuffer>> submit(HandlerLambda &&); } // namespace qcor Loading runtime/qpu_handler.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ public: template <typename QuantumKernel> void vqe(QuantumKernel &&kernel, double observable, double optimizer) { xacc::info("[qcor] Executing vqe! :)"); } template <typename QuantumKernel> void execute(QuantumKernel &&kernel) { Loading Loading
README.md +37 −0 Original line number Diff line number Diff line # QCOR QCOR is a C++ language extension and associated compiler implementation for variational quantum computation on near-term, noisy devices. ## Dependencies Compiler (C++11): GNU 5+, Clang 3+ CMake 3.9+ XACC: see https://xacc.readthedocs.io/en/latest/install.html#building-xacc ## Build instructions For CMake 3.9+, do not use the apt-get installer, instead use `pip`, and ensure that `/usr/local/bin` is in your PATH: ```bash $ python -m pip install --upgrade cmake $ export PATH=$PATH:/usr/local/bin ``` On Ubuntu 16+, install latest clang and llvm libraries and headers (you may need sudo) ```bash $ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - $ add-apt-repository "deb http://apt.llvm.org/jessie/ llvm-toolchain-jessie main" $ apt-get update $ apt-get install libclang-9-dev llvm-9-dev clang-9 $ ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-config ``` Note that, for now, developers must clone QCOR manually: ``` bash $ git clone https://code.ornl.gov/qci/qcor $ cd qcor $ mkdir build && cd build $ cmake .. -DXACC_DIR=~/.xacc (or wherever you installed XACC) $ make install ```
runtime/CMakeLists.txt +4 −8 Original line number Diff line number Diff line Loading @@ -4,14 +4,10 @@ file(GLOB SRC *.cpp) add_library(${LIBRARY_NAME} SHARED ${SRC}) target_include_directories(${LIBRARY_NAME} PUBLIC . ${XACC_INCLUDE_DIRS} ) target_include_directories(${LIBRARY_NAME} PUBLIC . ${XACC_INCLUDE_DIRS}) target_link_libraries(${LIBRARY_NAME} PUBLIC xacc) # qcor_enable_rpath(${LIBRARY_NAME}) if(QCOR_BUILD_TESTS) Loading
runtime/qcor.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,13 @@ using namespace xacc; namespace qcor { void Initialize(int argc, char** argv) { xacc::Initialize(argc,argv); } void Initialize(std::vector<std::string> argv) { xacc::Initialize(argv); } const std::string persistCompiledCircuit(std::shared_ptr<Function> function) { std::function<char()> randChar = []() -> char { const char charset[] = "0123456789" Loading
runtime/qcor.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ namespace qcor { class qpu_handler; using HandlerLambda = std::function<void(qpu_handler &)>; void Initialize(int argc, char** argv); void Initialize(std::vector<std::string> argv); // Persist the given function to file, return // the file name Loading @@ -26,6 +28,7 @@ const std::string persistCompiledCircuit(std::shared_ptr<Function> function); std::shared_ptr<Function> loadCompiledCircuit(const std::string &fileName); // Submit an asynchronous job to the QPU using HandlerLambda = std::function<void(qpu_handler &)>; std::future<std::shared_ptr<AcceleratorBuffer>> submit(HandlerLambda &&); } // namespace qcor Loading
runtime/qpu_handler.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ public: template <typename QuantumKernel> void vqe(QuantumKernel &&kernel, double observable, double optimizer) { xacc::info("[qcor] Executing vqe! :)"); } template <typename QuantumKernel> void execute(QuantumKernel &&kernel) { Loading