Commit 677195cd authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

updates to fix python api when qcor installed separate from xacc

parent 2a4ae844
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ if(APPLE)
                        PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
  set_target_properties(${LIBRARY_NAME}
                        PROPERTIES INSTALL_RPATH "$ORIGIN/../lib:${LLVM_INSTALL_PREFIX}/lib")
                        PROPERTIES INSTALL_RPATH "$ORIGIN/../lib:${XACC_ROOT}/lib:${LLVM_INSTALL_PREFIX}/lib")
  set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-shared")
endif()

+11 −1
Original line number Diff line number Diff line
@@ -7,6 +7,16 @@ if(APPLE)
   set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
endif(APPLE)
file(GLOB SRC *.cpp)

set(QCOR_APPEND_PLUGIN_PATH "")
if (NOT ${XACC_ROOT} MATCHES ${CMAKE_INSTALL_PREFIX}) 
  message(STATUS "WE ARE BUILDING WITH HOMEBREW")
  set (QCOR_APPEND_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/plugins")
endif()

configure_file(qcor.in.py
            ${CMAKE_BINARY_DIR}/qcor.py)

add_library(${LIBRARY_NAME} SHARED ${SRC})
target_include_directories(${LIBRARY_NAME} PUBLIC . ${CMAKE_SOURCE_DIR}/runtime/jit
                                          ${CMAKE_SOURCE_DIR}/lib/qsim
@@ -23,7 +33,7 @@ else()
   set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-shared")
endif()

install(FILES qcor.py DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${CMAKE_BINARY_DIR}/qcor.py DESTINATION ${CMAKE_INSTALL_PREFIX})
install(TARGETS _pyqcor DESTINATION ${CMAKE_INSTALL_PREFIX})

if (QCOR_BUILD_TESTS)
+5 −1
Original line number Diff line number Diff line
@@ -17,3 +17,7 @@ Employing the QCOR just-in-time (qjit) compilation features, we can wrap QCOR in
`vqe_qcor_spec.py` example of VQE using `taskInitiate` for asynchronous execution of quantum-classical hybrid computations. 

`pyscf_qubit_tapering.py` example of using the QCOR `OperatorTransform`, specifically running [Qubit Tapering](https://arxiv.org/abs/1701.08213) followed by VQE using the QSim library.

`bit_flip_code_ftqc.py` example using the QCOR ftqc runtime to support fault-tolerant, fast-feedback instruction execution. 

`vqe_ftqc.py` example demonstrating VQE algorithm using the ftqc runtime. 
 No newline at end of file
+6 −1
Original line number Diff line number Diff line
import sys

if '@QCOR_APPEND_PLUGIN_PATH@':
    sys.argv += ['__internal__add__plugin__path', '@QCOR_APPEND_PLUGIN_PATH@']

import xacc

from _pyqcor import *
import sys
import inspect
from typing import List
import typing
+2 −2
Original line number Diff line number Diff line
@@ -292,13 +292,13 @@ class LLVMJIT {
  Error addModule(std::unique_ptr<llvm::Module> M) {
    // FIXME hook up to cmake
    MainJD.addGenerator(cantFail(DynamicLibrarySearchGenerator::Load(
        "@CMAKE_INSTALL_PREFIX@/lib/libxacc.so", DL.getGlobalPrefix())));
        "@XACC_ROOT@/lib/libxacc.so", DL.getGlobalPrefix())));
    MainJD.addGenerator(cantFail(DynamicLibrarySearchGenerator::Load(
        "@CMAKE_INSTALL_PREFIX@/lib/libqrt.so", DL.getGlobalPrefix())));
    MainJD.addGenerator(cantFail(DynamicLibrarySearchGenerator::Load(
        "@CMAKE_INSTALL_PREFIX@/lib/libqcor.so", DL.getGlobalPrefix())));
    MainJD.addGenerator(cantFail(DynamicLibrarySearchGenerator::Load(
        "@CMAKE_INSTALL_PREFIX@/lib/libCppMicroServices.so",
        "@XACC_ROOT@/lib/libCppMicroServices.so",
        DL.getGlobalPrefix())));

    return CompileLayer.add(MainJD, ThreadSafeModule(std::move(M), Ctx));
Loading