Loading CMakeLists.txt +3 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ option(QCOR_BUILD_TESTS "Build qcor tests" OFF) find_package(Clang 10.0.0 REQUIRED) find_package(XACC REQUIRED) # Store the location of the clang executable set (CLANG_EXECUTABLE "${LLVM_INSTALL_PREFIX}/bin/clang++") configure_file(${CMAKE_SOURCE_DIR}/scripts/qcor.in ${CMAKE_BINARY_DIR}/qcor) Loading README.md +2 −2 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ the following file ```cpp #include "qcor.hpp" [[clang::syntax(xasm)]] void ansatz(qreg q, double t) { __qpu__ void ansatz(qreg q, double t) { X(q[0]); Ry(q[1], t); CX(q[1], q[0]); Loading Loading @@ -93,7 +93,7 @@ int main(int argc, char **argv) { To compile this with QCOR targeting a Rigetti QCS QPU, run the following ```bash $ qcor -o deuteron -a qcs:Aspen-4-4Q-A deuteron.cpp $ qcor -o deuteron -qpu qcs:Aspen-4-4Q-A deuteron.cpp ``` This will create the ```deuteron``` quantum-classical binary executable. Now just run Loading handlers/CMakeLists.txt +30 −2 Original line number Diff line number Diff line add_subdirectory(xasm) add_subdirectory(staq) No newline at end of file add_subdirectory(token_collector) set(LIBRARY_NAME qcor-syntax-handler) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") add_library(${LIBRARY_NAME} SHARED qcor_syntax_handler.cpp) target_include_directories(${LIBRARY_NAME} PUBLIC . ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS}) target_link_libraries(${LIBRARY_NAME} PRIVATE ${CLANG_LIBS} ${LLVM_LIBS} token_collector_util) if(APPLE) set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path/../lib") set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") else() set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib") set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-shared") endif() install(TARGETS ${LIBRARY_NAME} DESTINATION clang-plugins) handlers/staq/examples/add_3_5.cpp→handlers/examples/add_3_5.cpp +1 −1 Original line number Diff line number Diff line #include <qalloc> [[clang::syntax(staq)]] void add_3_5(qreg a, qreg b, qreg c) { __qpu__ void add_3_5(qreg a, qreg b, qreg c) { oracle adder a0,a1,a2,a3,b0,b1,b2,b3,c0,c1,c2,c3 { "add_3_5.v" } creg result[4]; Loading handlers/staq/examples/add_3_5.v→handlers/examples/add_3_5.v +0 −0 File moved. View file Loading
CMakeLists.txt +3 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ option(QCOR_BUILD_TESTS "Build qcor tests" OFF) find_package(Clang 10.0.0 REQUIRED) find_package(XACC REQUIRED) # Store the location of the clang executable set (CLANG_EXECUTABLE "${LLVM_INSTALL_PREFIX}/bin/clang++") configure_file(${CMAKE_SOURCE_DIR}/scripts/qcor.in ${CMAKE_BINARY_DIR}/qcor) Loading
README.md +2 −2 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ the following file ```cpp #include "qcor.hpp" [[clang::syntax(xasm)]] void ansatz(qreg q, double t) { __qpu__ void ansatz(qreg q, double t) { X(q[0]); Ry(q[1], t); CX(q[1], q[0]); Loading Loading @@ -93,7 +93,7 @@ int main(int argc, char **argv) { To compile this with QCOR targeting a Rigetti QCS QPU, run the following ```bash $ qcor -o deuteron -a qcs:Aspen-4-4Q-A deuteron.cpp $ qcor -o deuteron -qpu qcs:Aspen-4-4Q-A deuteron.cpp ``` This will create the ```deuteron``` quantum-classical binary executable. Now just run Loading
handlers/CMakeLists.txt +30 −2 Original line number Diff line number Diff line add_subdirectory(xasm) add_subdirectory(staq) No newline at end of file add_subdirectory(token_collector) set(LIBRARY_NAME qcor-syntax-handler) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") add_library(${LIBRARY_NAME} SHARED qcor_syntax_handler.cpp) target_include_directories(${LIBRARY_NAME} PUBLIC . ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS}) target_link_libraries(${LIBRARY_NAME} PRIVATE ${CLANG_LIBS} ${LLVM_LIBS} token_collector_util) if(APPLE) set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path/../lib") set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") else() set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib") set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-shared") endif() install(TARGETS ${LIBRARY_NAME} DESTINATION clang-plugins)
handlers/staq/examples/add_3_5.cpp→handlers/examples/add_3_5.cpp +1 −1 Original line number Diff line number Diff line #include <qalloc> [[clang::syntax(staq)]] void add_3_5(qreg a, qreg b, qreg c) { __qpu__ void add_3_5(qreg a, qreg b, qreg c) { oracle adder a0,a1,a2,a3,b0,b1,b2,b3,c0,c1,c2,c3 { "add_3_5.v" } creg result[4]; Loading