Skip to content

Commit

Permalink
Migrate ODE function solver to C++ (Qiskit#442)
Browse files Browse the repository at this point in the history
* Calling c++ implementation of the numeric integrator solver function (just a
basic scaffolding)
* Adding C++ and helpers code (still not building)
* Adding tests for the C++ helpers on Python C API
* Adding my ordered_map to guarantee order insertion iteration (ala Python's OrderedDict)
* Adding muparserx library for parsing hamiltonian math expressions
* Now we can use both Cython and C++ func ODE solver depending on a config param: use_cpp_ode_func
* Disabling Pulse simulator related tests for Python 3.5
  • Loading branch information
atilag authored and chriseclectic committed Jan 23, 2020
1 parent b4259e7 commit a27db33
Show file tree
Hide file tree
Showing 69 changed files with 14,157 additions and 581 deletions.
48 changes: 42 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set(AER_SIMULATOR_CPP_EXTERNAL_LIBS
"${AER_SIMULATOR_CPP_SRC_DIR}/third-party/headers"
"${AER_SIMULATOR_CPP_SRC_DIR}/third-party/macos/lib"
"${AER_SIMULATOR_CPP_SRC_DIR}/third-party/win64/lib"
"${AER_SIMULATOR_CPP_SRC_DIR}/third-party/linux/lib"
"${USER_LIB_PATH}")

# TODO: We may want to change the prefix path for all the environments
Expand Down Expand Up @@ -178,19 +179,51 @@ endif()

message(STATUS "BLAS library found: ${BLAS_LIBRARIES}")

message(STATUS "Looking for spdlog library...")
find_package(spdlog)
if(spdlog_FOUND)
message(STATUS "spdlog found.")
set(SPDLOG_LIB spdlog::spdlog)
else()
message(STATUS "spdlog not found.")
set(SPDLOG_LIB "")
endif()


message(STATUS "Looking for muparserx library...")

set(MUPARSERX_LIB_PATH "${AER_SIMULATOR_CPP_SRC_DIR}/third-party/linux/lib")
if(APPLE)
set(MUPARSERX_LIB_PATH "${AER_SIMULATOR_CPP_SRC_DIR}/third-party/macos/lib")
elseif(WIN32)
set(MUPARSERX_LIB_PATH "${AER_SIMULATOR_CPP_SRC_DIR}/third-party/win32/lib")
endif()

find_library(MUPARSERX_LIB NAMES libmuparserx.a muparserx HINTS ${MUPARSERX_LIB_PATH})
if(${MUPARSERX_LIB} MATCHES "MUPARSERX-NOTFOUND")
message(FATAL_ERROR "No muparserx library found")
endif()
message(STATUS "Muparserx library found: ${MUPARSERX_LIB}")
# I keep this disabled on purpose, just in case I need to debug muparserx related problems
# file(GLOB MUPARSERX_SOURCES "${AER_SIMULATOR_CPP_SRC_DIR}/third-party/headers/muparserx/*.cpp")


# Set dependent libraries
set(AER_LIBRARIES
${OPENMP_EXTERNAL_LIB}
${BLAS_LIBRARIES}
nlohmann_json
Threads::Threads
${CMAKE_DL_LIBS})
${OPENMP_EXTERNAL_LIB}
${BLAS_LIBRARIES}
nlohmann_json
Threads::Threads
${SPDLOG_LIB}
${CMAKE_DL_LIBS}
${MUPARSERX_LIB})

# Cython build is only enabled if building through scikit-build.
if(SKBUILD) # Terra Addon build
add_subdirectory(qiskit/providers/aer/openpulse/cy)
add_subdirectory(qiskit/providers/aer/openpulse/qutip_lite/cy)
add_subdirectory(qiskit/providers/aer/backends/wrappers)
add_subdirectory(src/simulators/open_pulse)
else() # Standalone build
add_executable(qasm_simulator ${AER_SIMULATOR_CPP_MAIN})
set_target_properties(qasm_simulator PROPERTIES
Expand All @@ -209,5 +242,8 @@ endif()

# Tests
if(BUILD_TESTS)
add_subdirectory(test)
# These tests were meant to be as an example, or template for C++ specific
# code, but they're not being maintained, so we are disabling them until we
# have real C++ tests in the codebase.
# add_subdirectory(test)
endif()
Loading

0 comments on commit a27db33

Please sign in to comment.