Commit 1ca6e9f5 authored by Mccaskey, Alex's avatar Mccaskey, Alex

major core infrastructure updates, removed all of boost except graph. added...

major core infrastructure updates, removed all of boost except graph. added new variant tpl and cxxopts, updated optionsprovider
Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent ea52c33a
Pipeline #43697 failed with stages
in 4 minutes and 55 seconds
......@@ -2,13 +2,13 @@
# Copyright (c) 2017 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
project(xacc LANGUAGES CXX)
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
......@@ -34,7 +34,7 @@ IF("${isSystemDir}" STREQUAL "-1")
ENDIF("${isSystemDir}" STREQUAL "-1")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug, Release, RelWithDebInfo, MinSizeRel"
FORCE
)
......@@ -70,53 +70,29 @@ endif()
message(STATUS "${BoldGreen}Installing XACC to ${CMAKE_INSTALL_PREFIX}. Override with -DCMAKE_INSTALL_PREFIX=...${ColorReset}")
if (XACC_BUILD_TESTS)
enable_testing()
macro(add_xacc_test _TEST_NAME)
add_executable(${_TEST_NAME}Tester ${_TEST_NAME}Tester.cpp)
add_test(NAME xacc_${_TEST_NAME}Tester COMMAND ${_TEST_NAME}Tester)
target_link_libraries(${_TEST_NAME}Tester ${GTEST_LIBRARIES} xacc xacc-quantum-gate xacc-quantum-aqc)
endmacro()
macro(set_cache_variable VAR_NAME VAR_DESCRIPTION)
set(${VAR_NAME} ${${VAR_NAME}} CACHE INTERNAL ${VAR_DESCRIPTION})
message(STATUS "Set ${VAR_NAME} to ${${VAR_NAME}}.")
endmacro()
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0")
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wimplicit-fallthrough=0")
endif()
#if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0")
# set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wimplicit-fallthrough=0")
#endif()
include_directories(${CMAKE_BINARY_DIR}/tpls/cppmicroservices/include)
add_subdirectory(tpls)
include_directories(${CPR_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/tpls/spdlog)
include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
set(XACC_HAS_ANTLR FALSE)
if(TARGET antlr4_shared)
message (STATUS "XACC Building with Antlr4 support")
set(XACC_HAS_ANTLR TRUE)
endif()
add_subdirectory(xacc)
add_subdirectory(quantum)
if(PYTHON_INCLUDE_DIR)
if(PYTHON_INCLUDE_DIR)
add_subdirectory(python)
endif()
# Install the config file for external projects to use
# This is cool, users just add find_package(XACC REQUIRED) to
# This is cool, users just add find_package(XACC REQUIRED) to
# their CMake builds, and pass -DXACC_DIR=/path/to/install/xacc
# and CMake loads include paths, libs, etc
configure_file("${CMAKE_SOURCE_DIR}/cmake/xacc-config.cmake.in" "${CMAKE_BINARY_DIR}/xacc-config.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/xacc-config.cmake" DESTINATION .)
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/tests.cmake" DESTINATION share/xacc/)
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/format.cmake" DESTINATION share/xacc/)
install(FILES "${CMAKE_SOURCE_DIR}/tpls/mpark-variant/variant.hpp" DESTINATION include/xacc/)
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/spdlog" DESTINATION include )
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/exprtk" DESTINATION include )
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/eigen" DESTINATION include )
......
# - Config file for XACC
# To point to your install of XACC, pass the
# To point to your install of XACC, pass the
# XACC_ROOT flag to your cmake configure.
#
# It defines the following variables
# XACC_INCLUDE_DIRS - include directories for XACC
# XACC_LIBRARIES - libraries to link against
# XACC_LIBRARY_DIR - the XACC library directory
# XACC_LIBRARY_DIR - the XACC library directory
include(CTest)
if (NOT XACC_ROOT)
get_filename_component(XACC_ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
......@@ -18,13 +18,10 @@ set (XACC_LIBRARY_DIR "${XACC_ROOT}/lib")
link_directories("${XACC_ROOT}/lib")
set(XACC_INCLUDE_ROOT "${XACC_ROOT}/include")
set(XACC_HAS_ANTLR @XACC_HAS_ANTLR@)
if (${XACC_HAS_ANTLR})
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/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;boost_system;boost_filesystem;boost_regex;boost_graph;boost_program_options")
else()
set (XACC_INCLUDE_DIRS "${XACC_INCLUDE_ROOT}/cppmicroservices4;${XACC_INCLUDE_ROOT}/xacc;${XACC_INCLUDE_ROOT}/quantum/gate;${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;CppMicroServices;boost_system;boost_filesystem;boost_regex;boost_graph;boost_program_options")
endif()
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;boost_system;boost_filesystem;boost_regex;boost_graph;boost_program_options")
set (XACC_TEST_LIBRARIES "${XACC_LIBRARIES};gtest;gtest_main")
set(BOOST_ROOT ${XACC_ROOT})
macro(add_xacc_test _TEST_NAME)
......
......@@ -13,15 +13,15 @@ include_directories(${CMAKE_SOURCE_DIR}/tpls/exprtk)
include_directories(${CMAKE_SOURCE_DIR}/tpls/spdlog)
include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
include_directories(${CMAKE_SOURCE_DIR}/quantum/utils)
include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc/ir)
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)
if (${XACC_HAS_ANTLR})
add_subdirectory(compiler)
endif()
add_subdirectory(compiler)
include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/tpls/pybind11/include)
......@@ -35,7 +35,7 @@ add_library(_pyxacc SHARED xacc-py.cpp)
set_target_properties(_pyxacc PROPERTIES PREFIX "")
target_link_libraries(_pyxacc PUBLIC CppMicroServices xacc)
target_link_libraries(_pyxacc PUBLIC CppMicroServices xacc Boost::graph)
if(APPLE)
set_target_properties(_pyxacc PROPERTIES INSTALL_RPATH "@loader_path/lib")
......
......@@ -67,19 +67,6 @@ public:
*/
virtual std::shared_ptr<xacc::IR> compile(const std::string &src);
/**
* Return the command line options for this compiler
*
* @return options Description of command line options.
*/
virtual std::shared_ptr<options_description> getOptions() {
auto desc =
std::make_shared<options_description>("PyXACC Compiler Options");
return desc;
}
virtual bool handleOptions(variables_map &map) { return false; }
/**
* We don't allow translations for the PyXACC Compiler.
* @param bufferVariable
......
......@@ -41,21 +41,21 @@ struct type_caster<Variant<Ts...>> : variant_caster<Variant<Ts...>> {};
// of `visit`
template <> struct visit_helper<Variant> {
template <typename... Args>
static auto call(Args &&... args) -> decltype(boost::apply_visitor(args...)) {
return boost::apply_visitor(args...);
static auto call(Args &&... args) -> decltype(mpark::visit(args...)) {
return mpark::visit(args...);
}
};
template <typename... Ts>
struct type_caster<boost::variant<Ts...>>
: variant_caster<boost::variant<Ts...>> {};
struct type_caster<mpark::variant<Ts...>>
: variant_caster<mpark::variant<Ts...>> {};
// Specifies the function used to visit the variant -- `apply_visitor` instead
// of `visit`
template <> struct visit_helper<boost::variant> {
template <> struct visit_helper<mpark::variant> {
template <typename... Args>
static auto call(Args &&... args) -> decltype(boost::apply_visitor(args...)) {
return boost::apply_visitor(args...);
static auto call(Args &&... args) -> decltype(mpark::visit(args...)) {
return mpark::visit(args...);
}
};
} // namespace detail
......@@ -340,8 +340,8 @@ PYBIND11_MODULE(_pyxacc, m) {
(void (xacc::AcceleratorBuffer::*)(const std::string &)) &
xacc::AcceleratorBuffer::appendMeasurement,
"Append the measurement string")
.def("getMeasurementStrings",
&xacc::AcceleratorBuffer::getMeasurementStrings,
.def("getMeasurements",
&xacc::AcceleratorBuffer::getMeasurements,
"Return observed measurement bit strings")
.def("computeMeasurementProbability",
&xacc::AcceleratorBuffer::computeMeasurementProbability,
......@@ -445,6 +445,8 @@ PYBIND11_MODULE(_pyxacc, m) {
m.def("Initialize", (void (*)()) & xacc::Initialize,
"Initialize the framework. Use this if there are no command line "
"arguments to pass.");
m.def("PyInitialize", &xacc::PyInitialize,
"Initialize the framework from Python.");
// m.def("help", )
m.def("getAccelerator",
(std::shared_ptr<xacc::Accelerator>(*)(const std::string &)) &
......@@ -472,18 +474,9 @@ PYBIND11_MODULE(_pyxacc, m) {
py::return_value_policy::reference,
"Return the IRGenerator of given name.");
m.def("getConnectivity",
[](const std::string acc) -> std::vector<std::vector<int>> {
[](const std::string acc) -> std::vector<std::pair<int,int>> {
auto a = xacc::getAccelerator(acc);
auto connectivity = a->getAcceleratorConnectivity();
std::vector<std::vector<int>> edges;
for (int i = 0; i < connectivity->order(); ++i) {
for (int j = i; j < connectivity->order(); ++j) {
if (connectivity->edgeExists(i, j)) {
edges.push_back({i, j});
}
}
}
return edges;
return a->getAcceleratorConnectivity();
});
m.def("translate", &xacc::translate,
"Translate the provided IR Function to the given language.");
......@@ -647,7 +640,19 @@ PYBIND11_MODULE(_pyxacc, m) {
[](std::shared_ptr<Function> f, std::shared_ptr<Accelerator> acc,
const std::string algo) -> std::map<int, std::vector<int>> {
auto a = xacc::getService<xacc::quantum::EmbeddingAlgorithm>(algo);
auto hardware = acc->getAcceleratorConnectivity();
auto hardwareconnections = acc->getAcceleratorConnectivity();
std::set<int> nUniqueBits;
for (auto& edge : hardwareconnections) {
nUniqueBits.insert(edge.first);
nUniqueBits.insert(edge.second);
}
int nBits = *std::max_element(nUniqueBits.begin(), nUniqueBits.end()) + 1;
auto hardware = std::make_shared<AcceleratorGraph>(nBits);
for (auto& edge : hardwareconnections) {
hardware->addEdge(edge.first, edge.second);
}
int maxBitIdx = 0;
for (auto inst : f->getInstructions()) {
......
......@@ -107,6 +107,7 @@ def initialize():
file.write(contents)
file.close()
setIsPyApi()
PyInitialize(xaccLocation)
def setCredentials(opts):
......@@ -163,9 +164,9 @@ class DecoratorFunction(ABC):
self.__dict__.update(kwargs)
self.accelerator = None
self.src = '\n'.join(inspect.getsource(self.function).split('\n')[1:])
self.processVariables()
self.processVariables()
compiler = getCompiler('xacc-py')
if self.accelerator == None:
if 'accelerator' in self.kwargs:
......@@ -182,17 +183,17 @@ class DecoratorFunction(ABC):
else:
print('Setting accelerator: ', self.accelerator.name())
self.qpu = self.accelerator
ir = compiler.compile(self.src, self.qpu)
program = Program(self.qpu, ir)
self.compiledKernel = program.getKernels()[0]
def overrideAccelerator(self, acc):
self.accelerator = acc
def processVariables(self):
g = re.findall('=(\w+)', self.src)
frame = inspect.currentframe()
frame = inspect.currentframe()
for thing in g:
if thing in frame.f_back.f_locals['f'].__globals__:
if isinstance(frame.f_back.f_locals['f'].__globals__[thing], str):
......@@ -200,8 +201,8 @@ class DecoratorFunction(ABC):
else:
real = str(frame.f_back.f_locals['f'].__globals__[thing])
self.src = self.src.replace('='+thing, '='+real)
del frame
del frame
def nParameters(self):
return self.getFunction().nParameters()
......
......@@ -2,31 +2,36 @@
# Copyright (c) 2017 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
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_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)
file (GLOB HEADERS utils/*.hpp)
install(FILES ${HEADERS} DESTINATION include/quantum/utils)
# *******************************************************************************
# Copyright (c) 2017 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
# ******************************************************************************
# * Copyright (c) 2017 UT-Battelle, LLC. All rights reserved. This program and
# the accompanying materials are made available under the terms of the Eclipse
# Public License v1.0 and Eclipse Distribution License v.10 which accompany
# this distribution. The Eclipse Public License is available at
# http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
# License is available at https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
set (LIBRARY_NAME xacc-quantum-aqc)
# Contributors: Alexander J. McCaskey - initial API and implementation
# ******************************************************************************
# */
set(LIBRARY_NAME xacc-quantum-aqc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compiler)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compiler/default)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compiler)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compiler/default)
file (GLOB_RECURSE HEADERS *.hpp)
file (GLOB SRC *.cpp ir/*.cpp compiler/default/*.cpp)
file(GLOB_RECURSE HEADERS *.hpp)
file(GLOB SRC
*.cpp
ir/*.cpp
compiler/default/*.cpp)
add_library(${LIBRARY_NAME} SHARED ${SRC})
target_include_directories(${LIBRARY_NAME}
PRIVATE ir
compiler
compiler/default
${CMAKE_SOURCE_DIR}/quantum/utils
${CMAKE_SOURCE_DIR}/tpls/exprtk
${CMAKE_BINARY_DIR})
# Set up dependencies to resources to track changes
usFunctionGetResourceSource(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongetresourcesource(TARGET ${LIBRARY_NAME} OUT SRC)
# Generate bundle initialization code
usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongeneratebundleinit(TARGET ${LIBRARY_NAME} OUT SRC)
#----
add_library(${LIBRARY_NAME} SHARED ${SRC})
# ----
set(_bundle_name xacc_quantum_aqc)
set_target_properties(${LIBRARY_NAME} PROPERTIES
# This is required for every bundle
COMPILE_DEFINITIONS US_BUNDLE_NAME=${_bundle_name}
# This is for convenience, used by other CMake functions
US_BUNDLE_NAME ${_bundle_name}
)
#if(BUILD_SHARED_LIBS)
# set_target_properties(${LIBRARY_NAME} PROPERTIES
# CXX_VISIBILITY_PRESET hidden
# VISIBILITY_INLINES_HIDDEN 1
# )
#endif()
set_target_properties(${LIBRARY_NAME}
PROPERTIES # This is required for every bundle
COMPILE_DEFINITIONS
US_BUNDLE_NAME=${_bundle_name}
# This is for convenience, used by other CMake
# functions
US_BUNDLE_NAME ${_bundle_name})
# Embed meta-data from a manifest.json file
usFunctionEmbedResources(TARGET ${LIBRARY_NAME}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
FILES
manifest.json
)
usfunctionembedresources(TARGET
${LIBRARY_NAME}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc Boost::graph)
if(APPLE)
set_target_properties(xacc-quantum-aqc PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(xacc-quantum-aqc PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
set_target_properties(xacc-quantum-aqc
PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(xacc-quantum-aqc
PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
set_target_properties(xacc-quantum-aqc PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(xacc-quantum-aqc PROPERTIES LINK_FLAGS "-shared")
set_target_properties(xacc-quantum-aqc PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(xacc-quantum-aqc PROPERTIES LINK_FLAGS "-shared")
endif()
add_subdirectory(ir)
......@@ -66,5 +71,3 @@ add_subdirectory(compiler)
install(FILES ${HEADERS} DESTINATION include/quantum/aqc)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
......@@ -15,8 +15,9 @@
#include <map>
#include <vector>
#include <boost/algorithm/string.hpp>
#include "Utils.hpp"
#include <iostream>
namespace xacc {
namespace quantum {
......@@ -42,14 +43,13 @@ public:
std::string s(std::istreambuf_iterator<char>(stream), {});
std::vector<std::string> splitNewLine, splitColon, splitSpaces;
boost::split(splitNewLine, s, boost::is_any_of("\n"));
splitNewLine = xacc::split(s, '\n');
for (auto line : splitNewLine) {
if (!line.empty()) {
boost::split(splitColon, line, boost::is_any_of(":"));
splitColon = xacc::split(line,':');
auto probVert = std::stoi(splitColon[0]);
std::vector<int> hardwareVerts;
boost::split(splitSpaces, splitColon[1], boost::is_any_of(" "));
splitSpaces = xacc::split(splitColon[1], ' ');
for (auto i : splitSpaces) {
if (!i.empty()) {
hardwareVerts.push_back(std::stoi(i));
......
......@@ -46,17 +46,12 @@ public:
"publication.";
}
std::shared_ptr<options_description> getOptions() override {
auto desc =
std::make_shared<options_description>("Default Parameter Setter Options");
desc->add_options()("chain-strength", value<std::string>(),
"");
OptionPairs getOptions() override {
OptionPairs desc {{"chain-strength",
""}};
return desc;
}
bool handleOptions(variables_map &map) override {
return false;
}
};
} // namespace quantum
......
include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc/ir)
include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc/compiler)
include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc/compiler/default)
include_directories(${CMAKE_SOURCE_DIR}/quantum/utils)
include_directories(${CMAKE_BINARY_DIR})
add_xacc_test(Embedding)
add_xacc_test(TrivialEmbeddingAlgorithm)
target_link_libraries(TrivialEmbeddingAlgorithmTester xacc-quantum-aqc Boost::graph)
\ No newline at end of file
......@@ -2,13 +2,13 @@
# Copyright (c) 2017 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
# Gather tests
if(XACC_BUILD_TESTS)
......
......@@ -17,11 +17,10 @@
#include "DWQMI.hpp"
#include "XACC.hpp"
#include "exprtk.hpp"
#include <boost/math/constants/constants.hpp>
#include "GraphProvider.hpp"
#include "DWGraph.hpp"
static constexpr double pi = boost::math::constants::pi<double>();
static constexpr double pi = 3.141592653589793238;
using symbol_table_t = exprtk::symbol_table<double>;
using expression_t = exprtk::expression<double>;
......@@ -144,10 +143,10 @@ const int nRequiredBits() const override {
auto bits = inst->bits();
if (bits[0] == bits[1]) {
std::get<0>(graph.getVertex(bits[0]).properties) =
boost::get<double>(inst->getParameter(0));
mpark::get<double>(inst->getParameter(0));
} else {
graph.addEdge(bits[0], bits[1],
boost::get<double>(inst->getParameter(0)));
mpark::get<double>(inst->getParameter(0)));
}
}
......@@ -207,7 +206,7 @@ const int nRequiredBits() const override {
std::vector<double> biases;
for (auto i : instructions) {
if (i->bits()[0] == i->bits()[1]) {
biases.push_back(boost::get<double>(i->getParameter(0)));
biases.push_back(mpark::get<double>(i->getParameter(0)));
}
}
......@@ -218,7 +217,7 @@ const int nRequiredBits() const override {
std::vector<double> weights;
for (auto i : instructions) {
if (i->bits()[0] != i->bits()[1]) {
weights.push_back(boost::get<double>(i->getParameter(0)));
weights.push_back(mpark::get<double>(i->getParameter(0)));
}
}
......@@ -250,7 +249,7 @@ const int nRequiredBits() const override {
const int nParameters() override { return parameters.size(); }