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

Major repository restructure. quantum is now the quantum runtime package,...

Major repository restructure. quantum is now the quantum runtime package, moved rigetti, simple acc, and scaffold to impls dir
parent 9e85699c
......@@ -36,40 +36,34 @@ set(CMAKE_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
message(STATUS "C++ version ${CXX_STANDARD} configured.")
# Make sure all build libraries have reference to their dependents
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
#set (ScaffoldClang_ROOT_DIR "/usr/local/scaffold/build/Release+Asserts/bin")
#set (ScaffoldClang_HOST_TARGET "x86_64-unknown-linux-gnu")
if (EXISTS ${CMAKE_SOURCE_DIR}/tpls/fire)
message(STATUS "Fire found in tpls")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tpls/fire/cmake/Modules")
include(tests)
endif()
# We require MPI
find_package(MPI REQUIRED)
find_package(Boost COMPONENTS system program_options filesystem REQUIRED)
message(STATUS "Found Boost Headers = ${Boost_INCLUDE_DIRS}")
message(STATUS "Found Boost Libraries = ${Boost_LIBRARIES}")
if (NOT LLVM_ROOT)
# By default, users should install scaffold package from
# us, so it will be in this location
set (LLVM_ROOT /usr/local/scaffold/build/Release+Asserts)
endif()
find_package(Clang REQUIRED)
# We require Boost
find_package(Boost COMPONENTS system program_options filesystem REQUIRED)
# Look for OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
# Create a xacc config header file
configure_file("${CMAKE_SOURCE_DIR}/cmake/xacc_config.hpp.in" "${CMAKE_BINARY_DIR}/xacc_config.hpp")
install(FILES "${CMAKE_BINARY_DIR}/xacc_config.hpp" DESTINATION include)
# Include dirs that everyone will use
include_directories(${CMAKE_BINARY_DIR})
include_directories(${MPI_INCLUDE_PATH})
include_directories(${Boost_INCLUDE_DIRS})
......@@ -81,8 +75,10 @@ include_directories("${CMAKE_SOURCE_DIR}/xacc/program")
include_directories("${CMAKE_SOURCE_DIR}/xacc/accelerator")
include_directories("${CMAKE_SOURCE_DIR}/xacc/utils")
# Add subdirectories
add_subdirectory(tpls)
add_subdirectory(xacc)
add_subdirectory(quantum)
add_subdirectory(impls)
add_subdirectory(tools)
add_subdirectory(examples)
......@@ -28,22 +28,18 @@
# Initial API and implementation - Alex McCaskey
#
#**********************************************************************************/
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/accelerators)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/accelerators/firetensoraccelerator)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/tpls/eigen)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/tensors)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/tensors/impl)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/utils)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/instructions)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/functions)
link_directories(${CLANG_LIBRARY_DIRS})
add_executable(teleport_scaffold_firetensor teleport_scaffold_firetensor.cpp)
target_link_libraries(teleport_scaffold_firetensor ${Boost_LIBRARIES} dl)
if (TARGET xacc-scaffold)
add_executable(teleport_scaffold_simpleaccelerator teleport_scaffold_simpleaccelerator.cpp)
target_link_libraries(teleport_scaffold_simpleaccelerator ${Boost_LIBRARIES} dl)
if (TARGET xacc-rigetti)
add_executable(teleport_scaffold_rigetti teleport_scaffold_rigetti.cpp)
target_link_libraries(teleport_scaffold_rigetti ${Boost_LIBRARIES} dl)
if (TARGET xacc-rigetti)
add_executable(teleport_scaffold_rigetti teleport_scaffold_rigetti.cpp)
target_link_libraries(teleport_scaffold_rigetti ${Boost_LIBRARIES} dl)
endif()
endif()
......@@ -53,7 +53,7 @@ int main (int argc, char** argv) {
xacc::Initialize(argc, argv);
// Create a reference to the 10 qubit simulation Accelerator
auto qpu = xacc::getAccelerator("firetensor");
auto qpu = xacc::getAccelerator("simple");
// Allocate a register of qubits
auto qubitReg = qpu->createBuffer("qreg", 3);
......
......@@ -28,5 +28,6 @@
# Initial API and implementation - Alex McCaskey
#
#**********************************************************************************/
add_subdirectory(simple-simulator)
add_subdirectory(scaffold)
add_subdirectory(rigetti)
......@@ -29,32 +29,32 @@
#
#**********************************************************************************/
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/instructions)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/functions)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/util)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/tpls/simpleweb)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/accelerators)
find_package(OpenSSL)
if (OPENSSL_FOUND)
set (PACKAGE_NAME "Rigetti XACC Accelerator")
set (PACKAGE_DESCIPTION "Rigetti XACC Accelerator Framework")
set (LIBRARY_NAME xacc-rigetti)
file (GLOB_RECURSE HEADERS *.hpp)
file (GLOB SRC *.cpp)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/instructions)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/functions)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/util)
include_directories(${CMAKE_SOURCE_DIR}/tpls/fire/tpls/simpleweb)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set (PACKAGE_NAME "Rigetti XACC Accelerator")
set (PACKAGE_DESCIPTION "Rigetti XACC Accelerator Framework")
set (LIBRARY_NAME xacc-rigetti)
file (GLOB_RECURSE HEADERS *.hpp)
file (GLOB SRC *.cpp)
add_library(${LIBRARY_NAME} SHARED ${SRC})
add_library(${LIBRARY_NAME} SHARED ${SRC})
target_link_libraries(${LIBRARY_NAME} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} xacc-gateqir)
target_link_libraries(${LIBRARY_NAME} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} xacc-gateqir)
install(FILES ${HEADERS} DESTINATION include)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
install(FILES ${HEADERS} DESTINATION include)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc-gateqir;xacc-rigetti")
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc-gateqir;xacc-rigetti")
endif()
......@@ -31,8 +31,7 @@
#ifndef QUANTUM_GATE_ACCELERATORS_RIGETTIACCELERATOR_HPP_
#define QUANTUM_GATE_ACCELERATORS_RIGETTIACCELERATOR_HPP_
#include "AcceleratorBuffer.hpp"
#include "QPUGate.hpp"
#include "Accelerator.hpp"
#include "InstructionIterator.hpp"
#include "QuilVisitor.hpp"
#include "AsioNetworkingTool.hpp"
......@@ -53,7 +52,7 @@ namespace quantum {
* through Fire's HTTP Client utilities.
*
*/
class RigettiAccelerator : virtual public QPUGate {
class RigettiAccelerator : virtual public Accelerator {
public:
/**
......@@ -96,6 +95,24 @@ public:
virtual void execute(std::shared_ptr<AcceleratorBuffer> buffer,
const std::shared_ptr<xacc::Function> kernel);
/**
* This Accelerator models QPU Gate accelerators.
* @return
*/
virtual AcceleratorType getType() {
return AcceleratorType::qpu_gate;
}
/**
* We have no need to transform the IR for this Accelerator,
* so return an empty list, for now.
* @return
*/
virtual std::vector<xacc::IRTransformation> getIRTransformations() {
std::vector<xacc::IRTransformation> v;
return v;
}
/**
* Return all relevant RigettiAccelerator runtime options.
* Users can set the api-key, execution type, and number of triels
......
......@@ -28,31 +28,42 @@
# Initial API and implementation - Alex McCaskey
#
#**********************************************************************************/
set (PACKAGE_NAME "Scaffold XACC Runtime")
set (PACKAGE_DESCIPTION "Scaffold XACC Programming Framework")
set (LIBRARY_NAME xacc-scaffold)
file (GLOB HEADERS *.hpp)
file (GLOB SRC *.cpp)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules")
set(CMAKE_CXX_FLAGS "-D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -w -fomit-frame-pointer -fvisibility-inlines-hidden -fPIC -Woverloaded-virtual -Wcast-qual -rdynamic")
if (NOT LLVM_ROOT)
# By default, users should install scaffold package from
# us, so it will be in this location
set (LLVM_ROOT /usr/local/scaffold/build/Release+Asserts)
endif()
include_directories(${CLANG_INCLUDE_DIRS})
include_directories(${CLANG_INCLUDE_DIRS}/extra-tools)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate)
find_package(ScaffoldClang)
add_library(${LIBRARY_NAME} SHARED ${SRC})
if (CLANG_FOUND AND LLVM_FOUND)
set (PACKAGE_NAME "Scaffold XACC Runtime")
set (PACKAGE_DESCIPTION "Scaffold XACC Programming Framework")
set (LIBRARY_NAME xacc-scaffold)
install(FILES ${HEADERS} DESTINATION include)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
file (GLOB HEADERS *.hpp)
file (GLOB SRC *.cpp)
link_directories(${CLANG_LIBRARY_DIRS} ${LLVM_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "-D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -w -fomit-frame-pointer -fvisibility-inlines-hidden -fPIC -Woverloaded-virtual -Wcast-qual -rdynamic")
target_link_libraries(${LIBRARY_NAME} ${CLANG_LIBS} ${LLVM_LIBS} xacc-gateqir)
include_directories(${CLANG_INCLUDE_DIRS})
include_directories(${CLANG_INCLUDE_DIRS}/extra-tools)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate)
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};xacc-gateqir;${CLANG_LIBS};${LLVM_LIBS};dl;pthread")
#add_tests_with_flags("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};xacc-gateqir;${CLANG_LIBS};${LLVM_LIBS};dl;pthread" "-fno-rtti")
add_library(${LIBRARY_NAME} SHARED ${SRC})
install(FILES ${HEADERS} DESTINATION include)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
link_directories(${CLANG_LIBRARY_DIRS} ${LLVM_LIBRARY_DIRS})
target_link_libraries(${LIBRARY_NAME} ${CLANG_LIBS} ${LLVM_LIBS} xacc-gateqir)
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};xacc-gateqir;${CLANG_LIBS};${LLVM_LIBS};dl;pthread")
endif()
\ No newline at end of file
......@@ -28,9 +28,9 @@
#=============================================================================
if (${Clang_FIND_REQUIRED})
find_package(LLVM ${Clang_FIND_VERSION} REQUIRED)
find_package(ScaffoldLLVM ${Clang_FIND_VERSION} REQUIRED)
else ()
find_package(LLVM ${Clang_FIND_VERSION})
find_package(ScaffoldLLVM ${Clang_FIND_VERSION})
endif ()
set(CLANG_FOUND FALSE)
......@@ -99,8 +99,8 @@ if(CLANG_FOUND)
message(STATUS "Found Clang (LLVM version: ${LLVM_VERSION})")
message(STATUS " Include dirs: ${CLANG_INCLUDE_DIRS}")
message(STATUS " Clang libraries: ${CLANG_LIBS}")
message(STATUS " Libclang C library: ${CLANG_LIBCLANG_LIB}")
#message(STATUS " Clang libraries: ${CLANG_LIBS}")
#message(STATUS " Libclang C library: ${CLANG_LIBCLANG_LIB}")
else()
if(Clang_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find Clang")
......
......@@ -141,5 +141,5 @@ if (LLVM_FOUND)
message(STATUS "Found LLVM (version: ${LLVM_VERSION}): (using ${LLVM_CONFIG_EXECUTABLE})")
message(STATUS " Include dirs: ${LLVM_INCLUDE_DIRS}")
message(STATUS " LLVM libraries: ${LLVM_LIBS}")
#message(STATUS " LLVM libraries: ${LLVM_LIBS}")
endif()
......@@ -39,9 +39,9 @@ include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/gateqir/functions)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/accelerators)
set (PACKAGE_NAME "Fire Tensor XACC Accelerator")
set (PACKAGE_DESCIPTION "Fire Tensor XACC Accelerator Framework")
set (LIBRARY_NAME xacc-firetensor)
set (PACKAGE_NAME "Simple XACC Accelerator")
set (PACKAGE_DESCIPTION "Simple XACC Accelerator Framework")
set (LIBRARY_NAME xacc-simpleaccelerator)
file (GLOB_RECURSE HEADERS *.hpp)
file (GLOB SRC *.cpp)
......@@ -55,5 +55,5 @@ install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc-gateqir;xacc-firetensor")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc-gateqir;xacc-simpleaccelerator")
......@@ -28,19 +28,19 @@
* Initial API and implementation - Alex McCaskey
*
**********************************************************************************/
#include "FireTensorAccelerator.hpp"
#include "SimpleAccelerator.hpp"
namespace xacc {
namespace quantum {
std::shared_ptr<AcceleratorBuffer> FireTensorAccelerator::createBuffer(
std::shared_ptr<AcceleratorBuffer> SimpleAccelerator::createBuffer(
const std::string& varId) {
auto buffer = std::make_shared<SimulatedQubits<10>>(varId);
storeBuffer(varId, buffer);
return buffer;
}
std::shared_ptr<AcceleratorBuffer> FireTensorAccelerator::createBuffer(
std::shared_ptr<AcceleratorBuffer> SimpleAccelerator::createBuffer(
const std::string& varId, const int size) {
if (!isValidBufferSize(size)) {
XACCError("Invalid buffer size.");
......@@ -50,11 +50,11 @@ std::shared_ptr<AcceleratorBuffer> FireTensorAccelerator::createBuffer(
return buffer;
}
bool FireTensorAccelerator::isValidBufferSize(const int NBits) {
bool SimpleAccelerator::isValidBufferSize(const int NBits) {
return NBits <= 10;
}
void FireTensorAccelerator::execute(std::shared_ptr<AcceleratorBuffer> buffer,
void SimpleAccelerator::execute(std::shared_ptr<AcceleratorBuffer> buffer,
const std::shared_ptr<xacc::Function> kernel) {
// Cast to what we know should be SimulatedQubits
......@@ -62,7 +62,7 @@ void FireTensorAccelerator::execute(std::shared_ptr<AcceleratorBuffer> buffer,
if (!qubits) {
XACCError("Invalid derived AcceleratorBuffer passed to "
"FireTensorAccelerator. Must be of type SimulatedQubits<10>.");
"SimpleAccelerator. Must be of type SimulatedQubits<10>.");
}
// Create a lambda for each type of gate we may encounter,
......@@ -225,7 +225,7 @@ void FireTensorAccelerator::execute(std::shared_ptr<AcceleratorBuffer> buffer,
auto visitor = std::make_shared<FunctionalGateInstructionVisitor>(hadamard,
cnot, x, measure, z, cond);
XACCInfo("Execution Fire Tensor Accelerator Simulation.");
XACCInfo("Execution Simple Accelerator Simulation.");
// Our QIR is really a tree structure
// so create a pre-order tree traversal
......
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