Loading runtime/qcor.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -37,14 +37,14 @@ double observe(std::shared_ptr<CompositeInstruction> program, } } // namespace __internal__ std::shared_ptr<xacc::Optimizer> createOptimizer(const char *type, std::shared_ptr<xacc::Optimizer> createOptimizer(const std::string &type, HeterogeneousMap &&options) { if (!xacc::isInitialized()) xacc::internal_compiler::compiler_InitializeXACC(); return xacc::getOptimizer(type, options); } std::shared_ptr<xacc::Observable> createObservable(const char *repr) { std::shared_ptr<xacc::Observable> createObservable(const std::string & repr) { if (!xacc::isInitialized()) xacc::internal_compiler::compiler_InitializeXACC(); return xacc::quantum::getObservable("pauli", std::string(repr)); Loading runtime/qcor.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -226,10 +226,10 @@ auto observe(QuantumKernel &kernel, std::shared_ptr<Observable> obs, // Create the desired Optimizer std::shared_ptr<xacc::Optimizer> createOptimizer(const char *type, HeterogeneousMap &&options = {}); createOptimizer(const std::string& type, HeterogeneousMap &&options = {}); // Create an observable from a string representation std::shared_ptr<Observable> createObservable(const char *repr); std::shared_ptr<Observable> createObservable(const std::string& repr); std::shared_ptr<ObjectiveFunction> createObjectiveFunction( const char *obj_name, std::shared_ptr<CompositeInstruction> kernel, Loading scripts/qcor.in +22 −8 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ def main(argv=None): parser.add_argument('-I',action='append',nargs=1, metavar=('header_file.hpp'),help='specify additional headers to add to the include search path.') parser.add_argument('-L',action='append',nargs=1,metavar=('/path/to/libs'),help='specifiy additional linker search paths.') parser.add_argument('-l',action='append',nargs=1,metavar=('lib_name'),help='specifiy additional libraries to link.') parser.add_argument('-print-qir', metavar='', help='dump the LLVM IR for quantum kernel expressions.') args = parser.parse_args(sys.argv) Loading Loading @@ -69,13 +68,6 @@ def main(argv=None): sys.argv.remove('-qrt') sHandlerArgs += ['-Xclang', '-plugin-arg-qcor-args', '-Xclang', '-qrt', '-DQCOR_USE_QRT'] if '-print-qir' in sys.argv[1:]: if not qrt: print('[qcor] Cannot request -print-qir with -qrt flag. Please also pass -qrt.') exit(1) sys.argv.remove('-print-qir') sHandlerArgs += ['-Xclang', '-load', '-Xclang', '@CMAKE_INSTALL_PREFIX@/lib/libprint_llvm_qir.so'] # Get the filename we are compiling or the object file filename = '' fileType = '' Loading Loading @@ -111,6 +103,28 @@ def main(argv=None): print(e.output) print(e.returncode) return e.returncode elif fileType == '' and filename == '': if '-x' in sys.argv[1:] and 'c++' in sys.argv[1:]: sys.argv[0] = compiler commands = [compiler] + defaultFlags + sHandlerArgs + baseIncludes if compileOnly: commands += sys.argv[1:] else: commands += baseLibs + sys.argv[1:] if verbose: print('[qcor-exec]: ', ' '.join([c for c in commands])) try: result = subprocess.run(commands, check=True) except subprocess.CalledProcessError as e: print(e.output) print(e.returncode) return e.returncode else: print('invalid command line arguments for qcor') exit(1) else: # This is a .o file, so execute the link phase commands = [compiler] + baseLibs + sys.argv[1:] Loading Loading
runtime/qcor.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -37,14 +37,14 @@ double observe(std::shared_ptr<CompositeInstruction> program, } } // namespace __internal__ std::shared_ptr<xacc::Optimizer> createOptimizer(const char *type, std::shared_ptr<xacc::Optimizer> createOptimizer(const std::string &type, HeterogeneousMap &&options) { if (!xacc::isInitialized()) xacc::internal_compiler::compiler_InitializeXACC(); return xacc::getOptimizer(type, options); } std::shared_ptr<xacc::Observable> createObservable(const char *repr) { std::shared_ptr<xacc::Observable> createObservable(const std::string & repr) { if (!xacc::isInitialized()) xacc::internal_compiler::compiler_InitializeXACC(); return xacc::quantum::getObservable("pauli", std::string(repr)); Loading
runtime/qcor.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -226,10 +226,10 @@ auto observe(QuantumKernel &kernel, std::shared_ptr<Observable> obs, // Create the desired Optimizer std::shared_ptr<xacc::Optimizer> createOptimizer(const char *type, HeterogeneousMap &&options = {}); createOptimizer(const std::string& type, HeterogeneousMap &&options = {}); // Create an observable from a string representation std::shared_ptr<Observable> createObservable(const char *repr); std::shared_ptr<Observable> createObservable(const std::string& repr); std::shared_ptr<ObjectiveFunction> createObjectiveFunction( const char *obj_name, std::shared_ptr<CompositeInstruction> kernel, Loading
scripts/qcor.in +22 −8 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ def main(argv=None): parser.add_argument('-I',action='append',nargs=1, metavar=('header_file.hpp'),help='specify additional headers to add to the include search path.') parser.add_argument('-L',action='append',nargs=1,metavar=('/path/to/libs'),help='specifiy additional linker search paths.') parser.add_argument('-l',action='append',nargs=1,metavar=('lib_name'),help='specifiy additional libraries to link.') parser.add_argument('-print-qir', metavar='', help='dump the LLVM IR for quantum kernel expressions.') args = parser.parse_args(sys.argv) Loading Loading @@ -69,13 +68,6 @@ def main(argv=None): sys.argv.remove('-qrt') sHandlerArgs += ['-Xclang', '-plugin-arg-qcor-args', '-Xclang', '-qrt', '-DQCOR_USE_QRT'] if '-print-qir' in sys.argv[1:]: if not qrt: print('[qcor] Cannot request -print-qir with -qrt flag. Please also pass -qrt.') exit(1) sys.argv.remove('-print-qir') sHandlerArgs += ['-Xclang', '-load', '-Xclang', '@CMAKE_INSTALL_PREFIX@/lib/libprint_llvm_qir.so'] # Get the filename we are compiling or the object file filename = '' fileType = '' Loading Loading @@ -111,6 +103,28 @@ def main(argv=None): print(e.output) print(e.returncode) return e.returncode elif fileType == '' and filename == '': if '-x' in sys.argv[1:] and 'c++' in sys.argv[1:]: sys.argv[0] = compiler commands = [compiler] + defaultFlags + sHandlerArgs + baseIncludes if compileOnly: commands += sys.argv[1:] else: commands += baseLibs + sys.argv[1:] if verbose: print('[qcor-exec]: ', ' '.join([c for c in commands])) try: result = subprocess.run(commands, check=True) except subprocess.CalledProcessError as e: print(e.output) print(e.returncode) return e.returncode else: print('invalid command line arguments for qcor') exit(1) else: # This is a .o file, so execute the link phase commands = [compiler] + baseLibs + sys.argv[1:] Loading