Loading examples/qrt/mixed_language.cpp 0 → 100644 +34 −0 Original line number Diff line number Diff line #include <qalloc> // Define a multi-register kernel __qpu__ void bell_multi(qreg q, qreg r) { using qcor::xasm; H(q[0]); CX(q[0], q[1]); using qcor::openqasm; h r[0]; cx r[0], r[1]; using qcor::xasm; for (int i = 0; i < q.size(); i++) { Measure(q[i]); Measure(r[i]); } } int main() { // Create two qubit registers, each size 2 auto q = qalloc(2); auto r = qalloc(2); // Run the quantum kernel bell_multi(q, r); // dump the results q.print(); r.print(); } No newline at end of file handlers/qcor_syntax_handler.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -77,8 +77,7 @@ public: bufferNames.push_back(ident->getName().str()); function_prototype += "qreg " + ident->getName().str() + ", "; } else { function_prototype += type + " " + ident->getName().str() + ", "; function_prototype += type + " " + ident->getName().str() + ", "; } } } Loading @@ -92,7 +91,8 @@ public: if (qrt) { qcor::run_token_collector_llvm_rt(PP, Toks, function_prototype, bufferNames, kernel_name, OS, qpu_name); bufferNames, kernel_name, OS, qpu_name, shots); } else { auto kernel_src_and_compiler = Loading runtime/qrt/qrt.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ void initialize(const std::string qpu_name, const std::string kernel_name) { program = provider->createComposite(kernel_name); } void set_shots(int shots) {} void set_shots(int shots) { xacc::internal_compiler::get_qpu()->updateConfiguration( {std::make_pair("shots", shots)}); } void one_qubit_inst(const std::string &name, const qubit &qidx, std::vector<double> parameters) { Loading Loading
examples/qrt/mixed_language.cpp 0 → 100644 +34 −0 Original line number Diff line number Diff line #include <qalloc> // Define a multi-register kernel __qpu__ void bell_multi(qreg q, qreg r) { using qcor::xasm; H(q[0]); CX(q[0], q[1]); using qcor::openqasm; h r[0]; cx r[0], r[1]; using qcor::xasm; for (int i = 0; i < q.size(); i++) { Measure(q[i]); Measure(r[i]); } } int main() { // Create two qubit registers, each size 2 auto q = qalloc(2); auto r = qalloc(2); // Run the quantum kernel bell_multi(q, r); // dump the results q.print(); r.print(); } No newline at end of file
handlers/qcor_syntax_handler.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -77,8 +77,7 @@ public: bufferNames.push_back(ident->getName().str()); function_prototype += "qreg " + ident->getName().str() + ", "; } else { function_prototype += type + " " + ident->getName().str() + ", "; function_prototype += type + " " + ident->getName().str() + ", "; } } } Loading @@ -92,7 +91,8 @@ public: if (qrt) { qcor::run_token_collector_llvm_rt(PP, Toks, function_prototype, bufferNames, kernel_name, OS, qpu_name); bufferNames, kernel_name, OS, qpu_name, shots); } else { auto kernel_src_and_compiler = Loading
runtime/qrt/qrt.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ void initialize(const std::string qpu_name, const std::string kernel_name) { program = provider->createComposite(kernel_name); } void set_shots(int shots) {} void set_shots(int shots) { xacc::internal_compiler::get_qpu()->updateConfiguration( {std::make_pair("shots", shots)}); } void one_qubit_inst(const std::string &name, const qubit &qidx, std::vector<double> parameters) { Loading