Commit bec44eba authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

decoupling service functions from xacc.hpp, added xacc_service header


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 872b8afc
Pipeline #45682 failed with stages
in 2 minutes and 30 seconds
......@@ -31,6 +31,7 @@
/.cproject
/.project
/.settings/
**/*.jar
**/.ptp*
/dist/
/*egg*/
......
......@@ -90,7 +90,7 @@ add_subdirectory(tpls)
add_subdirectory(xacc)
add_subdirectory(quantum)
if(PYTHON_INCLUDE_DIR)
add_subdirectory(python)
add_subdirectory(python)
endif()
......@@ -109,4 +109,3 @@ install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/exprtk" DESTINATION include )
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/eigen" DESTINATION include )
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/rapidjson" DESTINATION include )
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/pybind11" DESTINATION include )
install(PROGRAMS "${CMAKE_SOURCE_DIR}/tools/framework/xacc-framework" DESTINATION bin)
......@@ -24,7 +24,7 @@ link_directories("${XACC_ROOT}/lib")
set(XACC_INCLUDE_ROOT "${XACC_ROOT}/include")
set (XACC_INCLUDE_DIRS "${XACC_INCLUDE_ROOT}/antlr4-runtime;${XACC_INCLUDE_ROOT}/cppmicroservices4;${XACC_INCLUDE_ROOT}/xacc;${XACC_INCLUDE_ROOT}/quantum/gate;${XACC_INCLUDE_ROOT}/quantum/utils;${XACC_INCLUDE_ROOT}/quantum/aqc;${XACC_INCLUDE_ROOT}/spdlog;${XACC_INCLUDE_ROOT}/exprtk;${XACC_INCLUDE_ROOT}/eigen;${XACC_INCLUDE_ROOT}/rapidjson/include;${XACC_INCLUDE_ROOT};${XACC_INCLUDE_ROOT}/gtest")
set (XACC_LIBRARIES "xacc;xacc-quantum-gate;xacc-quantum-aqc;antlr4-runtime;CppMicroServices")
set (XACC_LIBRARIES "xacc;xacc-quantum-gate;xacc-quantum-aqc;xacc-pauli;antlr4-runtime;CppMicroServices")
set (XACC_TEST_LIBRARIES "${XACC_LIBRARIES};gtest;gtest_main")
......
......@@ -4,6 +4,7 @@ include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/xacc/ir)
include_directories(${CMAKE_SOURCE_DIR}/xacc/service)
include_directories(${CMAKE_SOURCE_DIR}/xacc/compiler)
include_directories(${CMAKE_SOURCE_DIR}/xacc/program)
include_directories(${CMAKE_SOURCE_DIR}/xacc/accelerator)
......@@ -21,6 +22,7 @@ include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc/compiler)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/ir)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/ir/instructions)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/utils)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/observable)
add_subdirectory(compiler)
......@@ -36,7 +38,7 @@ add_library(_pyxacc SHARED xacc-py.cpp)
set_target_properties(_pyxacc PROPERTIES PREFIX "")
target_link_libraries(_pyxacc PUBLIC CppMicroServices xacc xacc-quantum-gate Boost::graph)
target_link_libraries(_pyxacc PUBLIC CppMicroServices xacc Boost::graph xacc-pauli)
if(APPLE)
set_target_properties(_pyxacc PROPERTIES INSTALL_RPATH "@loader_path/lib")
......
......@@ -70,7 +70,6 @@ PyXACCCompiler::translate(const std::string &bufferVariable,
nextInst->accept(visitor);
}
}
return visitor->getPyXACCString();
}
} // namespace quantum
......
......@@ -19,7 +19,7 @@ xaccsrc
;
xacckernel
: 'def' kernelname=id '(' ( ','? param )* ')' ':' mainprog
: 'def' kernelname=id '(' ( ','? param )* ')' ':' mainprog
;
/***********************************************************************/
......@@ -42,13 +42,13 @@ line
/* A program statement */
statement
: uop
: uop
| 'return'
;
/* A program comment */
comment
: COMMENT
: COMMENT
;
/* A list of parameters */
......@@ -64,17 +64,17 @@ param
/* A unitary operation */
uop
: gatename=gate '(' ( explist ) ')'
: gatename=gate '(' ( explist )? ')'
| allbitsOp
;
allbitsOp
: gatename=gate '(' '...' ')'
| gatename=gate '(' INT ',...,' INT ')'
;
gate
gate
: id
;
......@@ -101,11 +101,11 @@ exp
| '\'[' ( ','? coupler )* ']\''
;
key
key
: id
;
coupler
coupler
: '[' INT ',' INT ']'
;
/* unary operations */
......@@ -141,7 +141,7 @@ COMMENT
;
/* id, ego, and super-ego */
ID
ID
: [a-z][A-Za-z0-9_]*
| [A-Z][A-Za-z0-9_]*
| [A-Z][A-Za-z]*
......@@ -154,7 +154,7 @@ REAL
/* Non-negative integers */
INT
: ('0'..'9')+
: ('0'..'9')+
;
/* Strings include numbers and slashes */
......
......@@ -16,6 +16,7 @@
#include "XACC.hpp"
#include "GateFunction.hpp"
#include "IRGenerator.hpp"
#include "xacc_service.hpp"
using namespace pyxacc;
......@@ -75,7 +76,7 @@ void PyXACCListener::enterUop(PyXACCIRParser::UopContext *ctx) {
// Note, if the user has specified something like
// H(...) or H(0...2), then we have a different handle
if (ctx->allbitsOp() != nullptr)
return;
return;
auto is_double = [](const std::string &s) -> bool {
try {
......@@ -199,30 +200,35 @@ void PyXACCListener::enterUop(PyXACCIRParser::UopContext *ctx) {
params.insert({"param_" + std::to_string(i), f->getParameter(i)});
}
auto generator = xacc::getService<xacc::IRGenerator>(generatorName);
auto genF = generator->generate(params);
// We may have a IRGenerator that produces d-wave functions,
// if so, we will not have set to correct provider
if (!std::dynamic_pointer_cast<GateFunction>(genF)) {
if (!xacc::hasCompiler("dwave-qmi")) {
xacc::error(
"Cannot run decorated code for d-wave without d-wave plugins.");
if (params.empty()) {
auto generator = xacc::getService<xacc::IRGenerator>(generatorName);
f->addInstruction(generator);
} else {
auto generator = xacc::getService<xacc::IRGenerator>(generatorName);
auto genF = generator->generate(params);
// We may have a IRGenerator that produces d-wave functions,
// if so, we will not have set to correct provider
if (!std::dynamic_pointer_cast<GateFunction>(genF)) {
if (!xacc::hasCompiler("dwave-qmi")) {
xacc::error(
"Cannot run decorated code for d-wave without d-wave plugins.");
}
f = xacc::getService<IRProvider>("dwave")->createFunction(
f->name(), {}, f->getParameters());
auto dwcompiler = xacc::getCompiler("dwave-qmi");
// auto acc = xacc::getAccelerator("dwave");
auto buff = accelerator->getBuffer(bufferName);
buff->addExtraInfo("ir-generator", ExtraInfo(generator->name()));
auto xaccKernelSrcStr = dwcompiler->translate("", genF);
auto embeddedCode = dwcompiler->compile(xaccKernelSrcStr, accelerator);
genF = embeddedCode->getKernels()[0];
}
f = xacc::getService<IRProvider>("dwave")->createFunction(
f->name(), {}, f->getParameters());
auto dwcompiler = xacc::getCompiler("dwave-qmi");
// auto acc = xacc::getAccelerator("dwave");
auto buff = accelerator->getBuffer(bufferName);
buff->addExtraInfo("ir-generator", ExtraInfo(generator->name()));
auto xaccKernelSrcStr = dwcompiler->translate("", genF);
auto embeddedCode = dwcompiler->compile(xaccKernelSrcStr, accelerator);
genF = embeddedCode->getKernels()[0];
}
for (auto i : genF->getInstructions()) {
f->addInstruction(i);
for (auto i : genF->getInstructions()) {
f->addInstruction(i);
}
}
} else if (gateName == "qmi") {
......@@ -286,7 +292,8 @@ void PyXACCListener::enterUop(PyXACCIRParser::UopContext *ctx) {
}
}*/
else {
xacc::error(gateName + " is an invalid instruction for the PyXACC IR compiler.");
xacc::error(gateName +
" is an invalid instruction for the PyXACC IR compiler.");
}
}
......
......@@ -3,13 +3,14 @@
#include <memory>
#include "AllGateVisitor.hpp"
#include "IRGenerator.hpp"
namespace xacc {
namespace quantum {
/**
*/
class PyXACCVisitor : public AllGateVisitor {
class PyXACCVisitor : public AllGateVisitor, public InstructionVisitor<IRGenerator> {
protected:
/**
*/
......@@ -17,14 +18,21 @@ protected:
public:
PyXACCVisitor(std::vector<InstructionParameter> functionParams) {
pyxaccStr += "@qpu()\ndef foo(" +functionParams[0].toString();
for (int i = 1; i < functionParams.size(); i++) {
pyxaccStr += "," + functionParams[i].toString();
if (!functionParams.empty()) {
pyxaccStr += "@qpu()\ndef foo(buffer," + functionParams[0].toString();
for (int i = 1; i < functionParams.size(); i++) {
pyxaccStr += "," + functionParams[i].toString();
}
pyxaccStr += "):\n";
} else {
pyxaccStr += "@qpu()\ndef foo(buffer):\n";
}
pyxaccStr += "):\n";
}
PyXACCVisitor() { pyxaccStr += "@qpu()\ndef foo():\n"; }
PyXACCVisitor() { pyxaccStr += "@qpu()\ndef foo(buffer):\n"; }
void visit(IRGenerator& irg) {
pyxaccStr += " " + irg.name() + "()\n";
}
/**
* Visit hadamard gates
*/
......@@ -114,12 +122,13 @@ public:
std::to_string(s.bits()[1]) + ")\n";
}
void visit(U& u) {
void visit(U &u) {
auto t = u.getParameter(0).toString();
auto p = u.getParameter(1).toString();
auto l = u.getParameter(2).toString();
// if (u.getParameter(0).which() != 3 && u.getParameter(1).which() != 3 && u.getParameter(2).which() != 3) {
// if (u.getParameter(0).which() != 3 && u.getParameter(1).which() != 3 &&
// u.getParameter(2).which() != 3) {
// // We have concrete values here
// auto td = boost::get<double>(u.getParameter(0));
// auto pd = boost::get<double>(u.getParameter(1));
......@@ -136,7 +145,7 @@ public:
pyxaccStr += s.str();
}
void visit(GateFunction &f) { return; }
/**
* Return the quil string
......
......@@ -92,4 +92,4 @@ string
atn:
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 34, 197, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 3, 2, 7, 2, 44, 10, 2, 12, 2, 14, 2, 47, 11, 2, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 53, 10, 3, 3, 3, 7, 3, 56, 10, 3, 12, 3, 14, 3, 59, 11, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 6, 5, 68, 10, 5, 13, 5, 14, 5, 69, 3, 6, 6, 6, 73, 10, 6, 13, 6, 14, 6, 74, 3, 6, 5, 6, 78, 10, 6, 3, 7, 3, 7, 5, 7, 82, 10, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 5, 9, 89, 10, 9, 3, 10, 3, 10, 3, 10, 5, 10, 94, 10, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 102, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 116, 10, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 7, 14, 123, 10, 14, 12, 14, 14, 14, 126, 11, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 150, 10, 15, 3, 15, 7, 15, 153, 10, 15, 12, 15, 14, 15, 156, 11, 15, 3, 15, 5, 15, 159, 10, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 176, 10, 15, 12, 15, 14, 15, 179, 11, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 2, 3, 28, 22, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 2, 3, 3, 2, 22, 27, 2, 203, 2, 45, 3, 2, 2, 2, 4, 48, 3, 2, 2, 2, 6, 64, 3, 2, 2, 2, 8, 67, 3, 2, 2, 2, 10, 77, 3, 2, 2, 2, 12, 81, 3, 2, 2, 2, 14, 83, 3, 2, 2, 2, 16, 85, 3, 2, 2, 2, 18, 93, 3, 2, 2, 2, 20, 101, 3, 2, 2, 2, 22, 115, 3, 2, 2, 2, 24, 117, 3, 2, 2, 2, 26, 119, 3, 2, 2, 2, 28, 158, 3, 2, 2, 2, 30, 180, 3, 2, 2, 2, 32, 182, 3, 2, 2, 2, 34, 188, 3, 2, 2, 2, 36, 190, 3, 2, 2, 2, 38, 192, 3, 2, 2, 2, 40, 194, 3, 2, 2, 2, 42, 44, 5, 4, 3, 2, 43, 42, 3, 2, 2, 2, 44, 47, 3, 2, 2, 2, 45, 43, 3, 2, 2, 2, 45, 46, 3, 2, 2, 2, 46, 3, 3, 2, 2, 2, 47, 45, 3, 2, 2, 2, 48, 49, 7, 3, 2, 2, 49, 50, 5, 36, 19, 2, 50, 57, 7, 4, 2, 2, 51, 53, 7, 5, 2, 2, 52, 51, 3, 2, 2, 2, 52, 53, 3, 2, 2, 2, 53, 54, 3, 2, 2, 2, 54, 56, 5, 18, 10, 2, 55, 52, 3, 2, 2, 2, 56, 59, 3, 2, 2, 2, 57, 55, 3, 2, 2, 2, 57, 58, 3, 2, 2, 2, 58, 60, 3, 2, 2, 2, 59, 57, 3, 2, 2, 2, 60, 61, 7, 6, 2, 2, 61, 62, 7, 7, 2, 2, 62, 63, 5, 6, 4, 2, 63, 5, 3, 2, 2, 2, 64, 65, 5, 8, 5, 2, 65, 7, 3, 2, 2, 2, 66, 68, 5, 10, 6, 2, 67, 66, 3, 2, 2, 2, 68, 69, 3, 2, 2, 2, 69, 67, 3, 2, 2, 2, 69, 70, 3, 2, 2, 2, 70, 9, 3, 2, 2, 2, 71, 73, 5, 12, 7, 2, 72, 71, 3, 2, 2, 2, 73, 74, 3, 2, 2, 2, 74, 72, 3, 2, 2, 2, 74, 75, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 78, 5, 14, 8, 2, 77, 72, 3, 2, 2, 2, 77, 76, 3, 2, 2, 2, 78, 11, 3, 2, 2, 2, 79, 82, 5, 20, 11, 2, 80, 82, 7, 8, 2, 2, 81, 79, 3, 2, 2, 2, 81, 80, 3, 2, 2, 2, 82, 13, 3, 2, 2, 2, 83, 84, 7, 28, 2, 2, 84, 15, 3, 2, 2, 2, 85, 88, 5, 18, 10, 2, 86, 87, 7, 5, 2, 2, 87, 89, 5, 16, 9, 2, 88, 86, 3, 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 17, 3, 2, 2, 2, 90, 94, 5, 36, 19, 2, 91, 92, 7, 9, 2, 2, 92, 94, 5, 36, 19, 2, 93, 90, 3, 2, 2, 2, 93, 91, 3, 2, 2, 2, 94, 19, 3, 2, 2, 2, 95, 96, 5, 24, 13, 2, 96, 97, 7, 4, 2, 2, 97, 98, 5, 26, 14, 2, 98, 99, 7, 6, 2, 2, 99, 102, 3, 2, 2, 2, 100, 102, 5, 22, 12, 2, 101, 95, 3, 2, 2, 2, 101, 100, 3, 2, 2, 2, 102, 21, 3, 2, 2, 2, 103, 104, 5, 24, 13, 2, 104, 105, 7, 4, 2, 2, 105, 106, 7, 10, 2, 2, 106, 107, 7, 6, 2, 2, 107, 116, 3, 2, 2, 2, 108, 109, 5, 24, 13, 2, 109, 110, 7, 4, 2, 2, 110, 111, 7, 31, 2, 2, 111, 112, 7, 11, 2, 2, 112, 113, 7, 31, 2, 2, 113, 114, 7, 6, 2, 2, 114, 116, 3, 2, 2, 2, 115, 103, 3, 2, 2, 2, 115, 108, 3, 2, 2, 2, 116, 23, 3, 2, 2, 2, 117, 118, 5, 36, 19, 2, 118, 25, 3, 2, 2, 2, 119, 124, 5, 28, 15, 2, 120, 121, 7, 5, 2, 2, 121, 123, 5, 28, 15, 2, 122, 120, 3, 2, 2, 2, 123, 126, 3, 2, 2, 2, 124, 122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 27, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 127, 128, 8, 15, 1, 2, 128, 159, 5, 38, 20, 2, 129, 159, 7, 31, 2, 2, 130, 159, 7, 12, 2, 2, 131, 159, 5, 36, 19, 2, 132, 133, 7, 14, 2, 2, 133, 159, 5, 28, 15, 8, 134, 135, 7, 4, 2, 2, 135, 136, 5, 28, 15, 2, 136, 137, 7, 6, 2, 2, 137, 159, 3, 2, 2, 2, 138, 139, 5, 34, 18, 2, 139, 140, 7, 4, 2, 2, 140, 141, 5, 28, 15, 2, 141, 142, 7, 6, 2, 2, 142, 159, 3, 2, 2, 2, 143, 144, 5, 30, 16, 2, 144, 145, 7, 17, 2, 2, 145, 146, 5, 28, 15, 4, 146, 159, 3, 2, 2, 2, 147, 154, 7, 18, 2, 2, 148, 150, 7, 5, 2, 2, 149, 148, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 153, 5, 32, 17, 2, 152, 149, 3, 2, 2, 2, 153, 156, 3, 2, 2, 2, 154, 152, 3, 2, 2, 2, 154, 155, 3, 2, 2, 2, 155, 157, 3, 2, 2, 2, 156, 154, 3, 2, 2, 2, 157, 159, 7, 19, 2, 2, 158, 127, 3, 2, 2, 2, 158, 129, 3, 2, 2, 2, 158, 130, 3, 2, 2, 2, 158, 131, 3, 2, 2, 2, 158, 132, 3, 2, 2, 2, 158, 134, 3, 2, 2, 2, 158, 138, 3, 2, 2, 2, 158, 143, 3, 2, 2, 2, 158, 147, 3, 2, 2, 2, 159, 177, 3, 2, 2, 2, 160, 161, 12, 12, 2, 2, 161, 162, 7, 13, 2, 2, 162, 176, 5, 28, 15, 13, 163, 164, 12, 11, 2, 2, 164, 165, 7, 14, 2, 2, 165, 176, 5, 28, 15, 12, 166, 167, 12, 10, 2, 2, 167, 168, 7, 9, 2, 2, 168, 176, 5, 28, 15, 11, 169, 170, 12, 9, 2, 2, 170, 171, 7, 15, 2, 2, 171, 176, 5, 28, 15, 10, 172, 173, 12, 7, 2, 2, 173, 174, 7, 16, 2, 2, 174, 176, 5, 28, 15, 8, 175, 160, 3, 2, 2, 2, 175, 163, 3, 2, 2, 2, 175, 166, 3, 2, 2, 2, 175, 169, 3, 2, 2, 2, 175, 172, 3, 2, 2, 2, 176, 179, 3, 2, 2, 2, 177, 175, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2, 178, 29, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 180, 181, 5, 36, 19, 2, 181, 31, 3, 2, 2, 2, 182, 183, 7, 20, 2, 2, 183, 184, 7, 31, 2, 2, 184, 185, 7, 5, 2, 2, 185, 186, 7, 31, 2, 2, 186, 187, 7, 21, 2, 2, 187, 33, 3, 2, 2, 2, 188, 189, 9, 2, 2, 2, 189, 35, 3, 2, 2, 2, 190, 191, 7, 29, 2, 2, 191, 37, 3, 2, 2, 2, 192, 193, 7, 30, 2, 2, 193, 39, 3, 2, 2, 2, 194, 195, 7, 32, 2, 2, 195, 41, 3, 2, 2, 2, 19, 45, 52, 57, 69, 74, 77, 81, 88, 93, 101, 115, 124, 149, 154, 158, 175, 177]
\ No newline at end of file
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 34, 199, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 3, 2, 7, 2, 44, 10, 2, 12, 2, 14, 2, 47, 11, 2, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 53, 10, 3, 3, 3, 7, 3, 56, 10, 3, 12, 3, 14, 3, 59, 11, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 6, 5, 68, 10, 5, 13, 5, 14, 5, 69, 3, 6, 6, 6, 73, 10, 6, 13, 6, 14, 6, 74, 3, 6, 5, 6, 78, 10, 6, 3, 7, 3, 7, 5, 7, 82, 10, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 5, 9, 89, 10, 9, 3, 10, 3, 10, 3, 10, 5, 10, 94, 10, 10, 3, 11, 3, 11, 3, 11, 5, 11, 99, 10, 11, 3, 11, 3, 11, 3, 11, 5, 11, 104, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 118, 10, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 7, 14, 125, 10, 14, 12, 14, 14, 14, 128, 11, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 152, 10, 15, 3, 15, 7, 15, 155, 10, 15, 12, 15, 14, 15, 158, 11, 15, 3, 15, 5, 15, 161, 10, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 178, 10, 15, 12, 15, 14, 15, 181, 11, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 2, 3, 28, 22, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 2, 3, 3, 2, 22, 27, 2, 206, 2, 45, 3, 2, 2, 2, 4, 48, 3, 2, 2, 2, 6, 64, 3, 2, 2, 2, 8, 67, 3, 2, 2, 2, 10, 77, 3, 2, 2, 2, 12, 81, 3, 2, 2, 2, 14, 83, 3, 2, 2, 2, 16, 85, 3, 2, 2, 2, 18, 93, 3, 2, 2, 2, 20, 103, 3, 2, 2, 2, 22, 117, 3, 2, 2, 2, 24, 119, 3, 2, 2, 2, 26, 121, 3, 2, 2, 2, 28, 160, 3, 2, 2, 2, 30, 182, 3, 2, 2, 2, 32, 184, 3, 2, 2, 2, 34, 190, 3, 2, 2, 2, 36, 192, 3, 2, 2, 2, 38, 194, 3, 2, 2, 2, 40, 196, 3, 2, 2, 2, 42, 44, 5, 4, 3, 2, 43, 42, 3, 2, 2, 2, 44, 47, 3, 2, 2, 2, 45, 43, 3, 2, 2, 2, 45, 46, 3, 2, 2, 2, 46, 3, 3, 2, 2, 2, 47, 45, 3, 2, 2, 2, 48, 49, 7, 3, 2, 2, 49, 50, 5, 36, 19, 2, 50, 57, 7, 4, 2, 2, 51, 53, 7, 5, 2, 2, 52, 51, 3, 2, 2, 2, 52, 53, 3, 2, 2, 2, 53, 54, 3, 2, 2, 2, 54, 56, 5, 18, 10, 2, 55, 52, 3, 2, 2, 2, 56, 59, 3, 2, 2, 2, 57, 55, 3, 2, 2, 2, 57, 58, 3, 2, 2, 2, 58, 60, 3, 2, 2, 2, 59, 57, 3, 2, 2, 2, 60, 61, 7, 6, 2, 2, 61, 62, 7, 7, 2, 2, 62, 63, 5, 6, 4, 2, 63, 5, 3, 2, 2, 2, 64, 65, 5, 8, 5, 2, 65, 7, 3, 2, 2, 2, 66, 68, 5, 10, 6, 2, 67, 66, 3, 2, 2, 2, 68, 69, 3, 2, 2, 2, 69, 67, 3, 2, 2, 2, 69, 70, 3, 2, 2, 2, 70, 9, 3, 2, 2, 2, 71, 73, 5, 12, 7, 2, 72, 71, 3, 2, 2, 2, 73, 74, 3, 2, 2, 2, 74, 72, 3, 2, 2, 2, 74, 75, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 78, 5, 14, 8, 2, 77, 72, 3, 2, 2, 2, 77, 76, 3, 2, 2, 2, 78, 11, 3, 2, 2, 2, 79, 82, 5, 20, 11, 2, 80, 82, 7, 8, 2, 2, 81, 79, 3, 2, 2, 2, 81, 80, 3, 2, 2, 2, 82, 13, 3, 2, 2, 2, 83, 84, 7, 28, 2, 2, 84, 15, 3, 2, 2, 2, 85, 88, 5, 18, 10, 2, 86, 87, 7, 5, 2, 2, 87, 89, 5, 16, 9, 2, 88, 86, 3, 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 17, 3, 2, 2, 2, 90, 94, 5, 36, 19, 2, 91, 92, 7, 9, 2, 2, 92, 94, 5, 36, 19, 2, 93, 90, 3, 2, 2, 2, 93, 91, 3, 2, 2, 2, 94, 19, 3, 2, 2, 2, 95, 96, 5, 24, 13, 2, 96, 98, 7, 4, 2, 2, 97, 99, 5, 26, 14, 2, 98, 97, 3, 2, 2, 2, 98, 99, 3, 2, 2, 2, 99, 100, 3, 2, 2, 2, 100, 101, 7, 6, 2, 2, 101, 104, 3, 2, 2, 2, 102, 104, 5, 22, 12, 2, 103, 95, 3, 2, 2, 2, 103, 102, 3, 2, 2, 2, 104, 21, 3, 2, 2, 2, 105, 106, 5, 24, 13, 2, 106, 107, 7, 4, 2, 2, 107, 108, 7, 10, 2, 2, 108, 109, 7, 6, 2, 2, 109, 118, 3, 2, 2, 2, 110, 111, 5, 24, 13, 2, 111, 112, 7, 4, 2, 2, 112, 113, 7, 31, 2, 2, 113, 114, 7, 11, 2, 2, 114, 115, 7, 31, 2, 2, 115, 116, 7, 6, 2, 2, 116, 118, 3, 2, 2, 2, 117, 105, 3, 2, 2, 2, 117, 110, 3, 2, 2, 2, 118, 23, 3, 2, 2, 2, 119, 120, 5, 36, 19, 2, 120, 25, 3, 2, 2, 2, 121, 126, 5, 28, 15, 2, 122, 123, 7, 5, 2, 2, 123, 125, 5, 28, 15, 2, 124, 122, 3, 2, 2, 2, 125, 128, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 27, 3, 2, 2, 2, 128, 126, 3, 2, 2, 2, 129, 130, 8, 15, 1, 2, 130, 161, 5, 38, 20, 2, 131, 161, 7, 31, 2, 2, 132, 161, 7, 12, 2, 2, 133, 161, 5, 36, 19, 2, 134, 135, 7, 14, 2, 2, 135, 161, 5, 28, 15, 8, 136, 137, 7, 4, 2, 2, 137, 138, 5, 28, 15, 2, 138, 139, 7, 6, 2, 2, 139, 161, 3, 2, 2, 2, 140, 141, 5, 34, 18, 2, 141, 142, 7, 4, 2, 2, 142, 143, 5, 28, 15, 2, 143, 144, 7, 6, 2, 2, 144, 161, 3, 2, 2, 2, 145, 146, 5, 30, 16, 2, 146, 147, 7, 17, 2, 2, 147, 148, 5, 28, 15, 4, 148, 161, 3, 2, 2, 2, 149, 156, 7, 18, 2, 2, 150, 152, 7, 5, 2, 2, 151, 150, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 153, 3, 2, 2, 2, 153, 155, 5, 32, 17, 2, 154, 151, 3, 2, 2, 2, 155, 158, 3, 2, 2, 2, 156, 154, 3, 2, 2, 2, 156, 157, 3, 2, 2, 2, 157, 159, 3, 2, 2, 2, 158, 156, 3, 2, 2, 2, 159, 161, 7, 19, 2, 2, 160, 129, 3, 2, 2, 2, 160, 131, 3, 2, 2, 2, 160, 132, 3, 2, 2, 2, 160, 133, 3, 2, 2, 2, 160, 134, 3, 2, 2, 2, 160, 136, 3, 2, 2, 2, 160, 140, 3, 2, 2, 2, 160, 145, 3, 2, 2, 2, 160, 149, 3, 2, 2, 2, 161, 179, 3, 2, 2, 2, 162, 163, 12, 12, 2, 2, 163, 164, 7, 13, 2, 2, 164, 178, 5, 28, 15, 13, 165, 166, 12, 11, 2, 2, 166, 167, 7, 14, 2, 2, 167, 178, 5, 28, 15, 12, 168, 169, 12, 10, 2, 2, 169, 170, 7, 9, 2, 2, 170, 178, 5, 28, 15, 11, 171, 172, 12, 9, 2, 2, 172, 173, 7, 15, 2, 2, 173, 178, 5, 28, 15, 10, 174, 175, 12, 7, 2, 2, 175, 176, 7, 16, 2, 2, 176, 178, 5, 28, 15, 8, 177, 162, 3, 2, 2, 2, 177, 165, 3, 2, 2, 2, 177, 168, 3, 2, 2, 2, 177, 171, 3, 2, 2, 2, 177, 174, 3, 2, 2, 2, 178, 181, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180, 29, 3, 2, 2, 2, 181, 179, 3, 2, 2, 2, 182, 183, 5, 36, 19, 2, 183, 31, 3, 2, 2, 2, 184, 185, 7, 20, 2, 2, 185, 186, 7, 31, 2, 2, 186, 187, 7, 5, 2, 2, 187, 188, 7, 31, 2, 2, 188, 189, 7, 21, 2, 2, 189, 33, 3, 2, 2, 2, 190, 191, 9, 2, 2, 2, 191, 35, 3, 2, 2, 2, 192, 193, 7, 29, 2, 2, 193, 37, 3, 2, 2, 2, 194, 195, 7, 30, 2, 2, 195, 39, 3, 2, 2, 2, 196, 197, 7, 32, 2, 2, 197, 41, 3, 2, 2, 2, 20, 45, 52, 57, 69, 74, 77, 81, 88, 93, 98, 103, 117, 126, 151, 156, 160, 177, 179]
\ No newline at end of file
add_xacc_test(PyXACCCompiler)
target_link_libraries(PyXACCCompilerTester xacc-py-compiler)
target_link_libraries(PyXACCCompilerTester CppMicroServices xacc-py-compiler)
......@@ -32,14 +32,15 @@
#include "PyXACCCompiler.hpp"
#include "XACC.hpp"
#include "IRGenerator.hpp"
#include "xacc_service.hpp"
using namespace xacc::quantum;
using namespace xacc;
class FakePyAcc : public xacc::Accelerator {
public:
virtual xacc::AcceleratorType getType() {
return xacc::AcceleratorType::qpu_gate;
virtual xacc::Accelerator::AcceleratorType getType() {
return xacc::Accelerator::AcceleratorType::qpu_gate;
}
virtual bool isValidBufferSize(const int nBits) { return true; }
......
......@@ -11,6 +11,9 @@
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include "XACC.hpp"
#include "xacc_service.hpp"
#include "Program.hpp"
#include "IRGenerator.hpp"
#include "IRProvider.hpp"
#include "InstructionIterator.hpp"
......
......@@ -14,21 +14,6 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}/tpls/cppmicroservices")
include(CppMicroServicesConfig)
#include_directories(${CMAKE_BINARY_DIR})
#include_directories(${CMAKE_SOURCE_DIR}/xacc)
#include_directories(${CMAKE_SOURCE_DIR}/xacc/ir)
#include_directories(${CMAKE_SOURCE_DIR}/xacc/compiler)
#include_directories(${CMAKE_SOURCE_DIR}/xacc/program)
#include_directories(${CMAKE_SOURCE_DIR}/xacc/accelerator)
#include_directories(${CMAKE_SOURCE_DIR}/xacc/utils)
#include_directories(${CMAKE_SOURCE_DIR}/tpls/rapidjson/include)
#include_directories(${CMAKE_SOURCE_DIR}/tpls/exprtk)
#include_directories(${CMAKE_SOURCE_DIR}/tpls/spdlog)
#include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
#include_directories(${GTEST_INCLUDE_DIRS})
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/utils)
add_subdirectory(utils)
add_subdirectory(gate)
add_subdirectory(aqc)
......
......@@ -54,7 +54,7 @@ usfunctionembedresources(TARGET
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc Boost::graph)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc Boost::graph PRIVATE CppMicroServices)
if(APPLE)
set_target_properties(xacc-quantum-aqc
......
......@@ -21,7 +21,9 @@ file(GLOB SRC
ir/instructions/*.cpp
utils/*.cpp
ir/algorithms/*.cpp
ir/transformations/*.cpp)
ir/transformations/*.cpp
ir/parser/*.cpp
ir/parser/generated/*.cpp)
# Set up dependencies to resources to track changes
......@@ -31,6 +33,7 @@ usFunctionGetResourceSource(TARGET ${LIBRARY_NAME} OUT SRC)
usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC)
add_library(${LIBRARY_NAME} SHARED ${SRC})
add_dependencies(${LIBRARY_NAME} antlr4_shared)
target_include_directories(${LIBRARY_NAME}
PRIVATE utils
......@@ -63,7 +66,7 @@ usFunctionEmbedResources(TARGET
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc Boost::graph)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc Boost::graph PRIVATE CppMicroServices)
if(APPLE)
set_target_properties(xacc-quantum-gate
......@@ -75,6 +78,7 @@ else()
set_target_properties(xacc-quantum-gate PROPERTIES LINK_FLAGS "-shared")
endif()
add_subdirectory(observable)
add_subdirectory(compiler)
add_subdirectory(ir)
add_subdirectory(utils)
......
......@@ -2,6 +2,8 @@
#include "InstructionIterator.hpp"
#include "XACC.hpp"
#include <fstream>
#include <set>
#define RAPIDJSON_HAS_STDSTRING 1
#include "rapidjson/document.h"
......
......@@ -2,6 +2,7 @@
#include "InstructionIterator.hpp"
#include "XACC.hpp"
#include "IRProvider.hpp"
#include "xacc_service.hpp"
namespace xacc {
namespace quantum {
......@@ -92,7 +93,7 @@ std::vector<std::shared_ptr<AcceleratorBuffer>> RichExtrapDecorator::execute(
}
// xacc::info("HI: " + newF->toString("q"));
newFuncs.push_back(newF);
}
......
......@@ -10,5 +10,5 @@ include_directories(${CMAKE_BINARY_DIR})
add_xacc_test(ImprovedSamplingDecorator)
add_xacc_test(RichExtrapDecorator)
target_link_libraries(RichExtrapDecoratorTester xacc-quantum-gate)
target_link_libraries(ImprovedSamplingDecoratorTester xacc-quantum-gate)
\ No newline at end of file
target_link_libraries(RichExtrapDecoratorTester CppMicroServices xacc-quantum-gate)
target_link_libraries(ImprovedSamplingDecoratorTester CppMicroServices xacc-quantum-gate)
\ No newline at end of file
......@@ -13,6 +13,7 @@
#include <gtest/gtest.h>
#include "XACC.hpp"
#include "ImprovedSamplingDecorator.hpp"
#include "xacc_service.hpp"
using namespace xacc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment