-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from tnguyen-ornl/tnguyen/dm-full
Implement density matrix simulation via full tensor network contraction
- Loading branch information
Showing
9 changed files
with
1,607 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
find_package(ExaTN QUIET) | ||
|
||
if (ExaTN_FOUND) | ||
message(STATUS "Found ExaTN at ${EXATN_ROOT}") | ||
set (PACKAGE_NAME "TNQVM ExaTN Density Matrix Visitor") | ||
set (PACKAGE_DESCIPTION "TNQVM ExaTN Density Matrix backend") | ||
set (LIBRARY_NAME tnqvm-exatn-dm) | ||
|
||
if (TNQVM_MPI_ENABLED) | ||
find_package(MPI REQUIRED) | ||
message(STATUS "Found a suitable MPI compiler ${MPI_CXX_COMPILER}.") | ||
message(STATUS "Compiler vendor is [${CMAKE_CXX_COMPILER_ID}]") | ||
message(STATUS "Include path: ${MPI_CXX_INCLUDE_DIRS}") | ||
message(STATUS "Compile flags: ${MPI_CXX_COMPILE_FLAGS}") | ||
message(STATUS "Link flags: ${MPI_CXX_LINK_FLAGS}") | ||
message(STATUS "Libraries: ${MPI_CXX_LIBRARIES}") | ||
include_directories(${MPI_CXX_INCLUDE_DIRS}) | ||
link_libraries(${MPI_CXX_LIBRARIES}) | ||
add_definitions(-DTNQVM_MPI_ENABLED) | ||
endif() | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTNQVM_HAS_EXATN") | ||
set(CMAKE_INSTALL_RPATH "${EXATN_ROOT}/lib") | ||
set(EXATN_VISITOR_CPP_FILE ExaTnDmVisitor.cpp) | ||
|
||
if (EXATN_BLAS_LIB MATCHES MKL) | ||
# Fix for bug #30 | ||
message(STATUS "Exatn built with MKL, updating our build: ${EXATN_MKL_PATH}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTNQVM_EXATN_USES_MKL_BLAS") | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ExaTnDmVisitor.cpp" | ||
"${CMAKE_BINARY_DIR}/tnqvm/visitors/exatn-mpo/ExaTnDmVisitor.cpp" @ONLY) | ||
set(EXATN_VISITOR_CPP_FILE ${CMAKE_BINARY_DIR}/tnqvm/visitors/exatn-mpo/ExaTnDmVisitor.cpp) | ||
endif() | ||
|
||
file (GLOB HEADERS *.hpp) | ||
file (GLOB SRC ${EXATN_VISITOR_CPP_FILE}) | ||
|
||
usFunctionGetResourceSource(TARGET ${LIBRARY_NAME} OUT SRC) | ||
usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC) | ||
|
||
add_library(${LIBRARY_NAME} SHARED ${SRC}) | ||
|
||
set(_bundle_name tnqvm_exatn_dm) | ||
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 | ||
) | ||
|
||
target_include_directories(${LIBRARY_NAME} PUBLIC . .. ${XACC_DIR}/include/xacc/) | ||
|
||
# Links to ExaTN using its linker config flags. | ||
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc::xacc exatn::exatn xacc::quantum_gate) | ||
|
||
if(APPLE) | ||
set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path/../lib") | ||
set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") | ||
else() | ||
set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib;${EXATN_ROOT}/lib;${BLAS_PATH}") | ||
set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-shared") | ||
endif() | ||
|
||
install(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/plugins) | ||
|
||
if(TNQVM_BUILD_TESTS) | ||
add_subdirectory(tests) | ||
endif() | ||
else() | ||
message(STATUS "ExaTN not found, skipping ExaTNVisitor build") | ||
endif() |
Oops, something went wrong.