QCOR
qcor.hpp
1 #pragma once
2 
3 #include "qcor_lang_ext.hpp"
4 
5 namespace qcor {
6 
7 namespace __internal__ {
8 // This class gives us a way to
9 // run some startup routine before
10 // main(). Specifically we use it to ensure that
11 // the accelerator backend is set in the event no
12 // quantum kernels are found by the syntax handler.
14 public:
16 #ifdef __internal__qcor__compile__plugin__path
17  qcor::__internal__::append_plugin_path(__internal__qcor__compile__plugin__path);
18 #endif
19 // IMPORTANT: This needs to be set before quantum::initialize
20 #ifdef __internal__qcor__compile__qrt__mode
21  quantum::set_qrt(__internal__qcor__compile__qrt__mode);
22 #endif
23 #ifdef __internal__qcor__compile__backend
24  quantum::initialize(__internal__qcor__compile__backend, "empty");
25 #endif
26 #ifdef __internal__qcor__compile__shots
27  quantum::set_shots(std::stoi(__internal__qcor__compile__shots));
28 #endif
29 #ifdef __internal__qcor__compile__opt__level
30  xacc::internal_compiler::__opt_level =
31  __internal__qcor__compile__opt__level;
32 #endif
33 #ifdef __internal__qcor__compile__opt__print__stats
34  xacc::internal_compiler::__print_opt_stats = true;
35 #endif
36 #ifdef __internal__qcor__compile__opt__passes
37  xacc::internal_compiler::__user_opt_passes =
38  __internal__qcor__compile__opt__passes;
39 #endif
40 #ifdef __internal__qcor__compile__placement__name
41  xacc::internal_compiler::__placement_name =
42  __internal__qcor__compile__placement__name;
43 #endif
44 #ifdef __internal__qcor__compile__qubit__map
45  xacc::internal_compiler::__qubit_map =
46  xacc::internal_compiler::parse_qubit_map(
47  __internal__qcor__compile__qubit__map);
48 #endif
49 #ifdef __internal__qcor__compile__decorator__list
50  xacc::internal_compiler::apply_decorators(__internal__qcor__compile__decorator__list);
51 #endif
52 #ifdef __internal__qcor__print__final__submission
53  xacc::internal_compiler::__print_final_submission = true;
54 #endif
55  }
56 };
57 internal_startup startup;
58 
59 } // namespace __internal__
60 
61 } // namespace qcor
62 
63 #define qcor_include_qasm(NAME) extern "C" void NAME(qreg);
64 #define qcor_include_qsharp(NAME, RETURN_TYPE, ...) extern "C" RETURN_TYPE NAME(...);
qcor
Definition: qcor_syntax_handler.cpp:15
qcor::__internal__::internal_startup
Definition: qcor.hpp:13