Commit 984ac786 authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh
Browse files

Added cuTensor and cuQuantum as optional external dependencies in the build system.


Signed-off-by: default avatarDmitry I. Lyakh <quant4me@gmail.com>
parent c190582a
......@@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPATH_MAX=4096 -Wno-attributes")
project(exatn LANGUAGES CXX Fortran)
option(EXATN_BUILD_TESTS "Build ExaTN tests" OFF)
option(EXATN_BUILD_TESTS "Build ExaTN tests" ON)
option(CUDA_HOST_COMPILER "Provide the host compiler for nvcc" "")
option(BLAS_LIB "Provide the BLAS implementation: ATLAS,MKL,OPENBLAS,ACML,ESSL" "")
option(BLAS_PATH "Provide the path to the BLAS libraries" "")
......@@ -35,11 +35,11 @@ option(ENABLE_CUDA "Turn on CUDA support" OFF)
if(MPI_LIB)
if(NOT MPI_LIB STREQUAL "MPICH" AND NOT MPI_LIB STREQUAL "OPENMPI")
message(FATAL_ERROR "Invalid MPI_LIB choice: Available choices: MPICH (incl. Cray-MPICH), OPENMPI (incl. Spectrum-MPI). CMake is exiting.")
message(FATAL_ERROR "Invalid MPI_LIB choice: Available choices: MPICH (incl. Cray-MPICH), OPENMPI (incl. Spectrum-MPI)! CMake is exiting.")
endif()
if(NOT MPI_ROOT_DIR)
message(FATAL_ERROR "If you specify the MPI implementation, you must also specify the MPI root path (-DMPI_ROOT_DIR). CMake is exiting.")
message(FATAL_ERROR "If you specify the MPI implementation, you must also specify the MPI root path (-DMPI_ROOT_DIR)! CMake is exiting.")
endif()
if(NOT MPI_BIN_PATH)
......@@ -51,7 +51,7 @@ if(MPI_LIB)
else()
if(MPI_ROOT_DIR OR MPI_BIN_PATH)
message(FATAL_ERROR "If you specify the MPI root and/or bin paths, you should also specify the MPI_LIB choice (-DMPI_LIB). CMake is exiting.")
message(FATAL_ERROR "If you specify the MPI root and/or bin paths, you should also specify the MPI_LIB choice (-DMPI_LIB)! CMake is exiting.")
endif()
endif()
......@@ -60,67 +60,62 @@ endif()
if(BLAS_LIB)
if(NOT BLAS_PATH AND NOT BLAS_LIB STREQUAL "MKL")
message(FATAL_ERROR "Your choice of BLAS implementation requires specification of the path to the BLAS libraries (-DBLAS_PATH). CMake is exiting.")
message(FATAL_ERROR "Your choice of BLAS implementation requires specification of the path to the BLAS libraries (-DBLAS_PATH)! CMake is exiting.")
endif()
if(BLAS_LIB STREQUAL "ATLAS")
if(NOT EXISTS "${BLAS_PATH}/libblas.so")
message(FATAL_ERROR "The ATLAS BLAS library path does not contain libblas.so. CMake is exiting.")
message(FATAL_ERROR "The ATLAS BLAS library path does not contain libblas.so! CMake is exiting.")
endif()
elseif(BLAS_LIB STREQUAL "MKL")
if(NOT PATH_INTEL_ROOT)
message(FATAL_ERROR "The MKL BLAS choice requires the Intel root directory (-DPATH_INTEL_ROOT), for example /opt/intel. CMake is exiting.")
message(FATAL_ERROR "The MKL BLAS choice requires the Intel root directory (-DPATH_INTEL_ROOT), for example /opt/intel! CMake is exiting.")
endif()
set(BLAS_PATH ${PATH_INTEL_ROOT}/mkl/lib/intel64)
if(NOT EXISTS "${BLAS_PATH}/libmkl_core.so")
message(FATAL_ERROR "The MKL BLAS library path does not contain libmkl_core.so. CMake is exiting.")
message(FATAL_ERROR "The MKL BLAS library path does not contain libmkl_core.so! CMake is exiting.")
endif()
elseif(BLAS_LIB STREQUAL "OPENBLAS")
if(NOT EXISTS "${BLAS_PATH}/libopenblas.so")
message(FATAL_ERROR "The OPENBLAS BLAS library path does not contain libopenblas.so. CMake is exiting.")
message(FATAL_ERROR "The OPENBLAS BLAS library path does not contain libopenblas.so! CMake is exiting.")
endif()
elseif(BLAS_LIB STREQUAL "ACML")
if(NOT EXISTS "${BLAS_PATH}/libacml_mp.so")
message(FATAL_ERROR "The ACML BLAS library path does not contain libacml_mp.so. CMake is exiting.")
message(FATAL_ERROR "The ACML BLAS library path does not contain libacml_mp.so! CMake is exiting.")
endif()
elseif(BLAS_LIB STREQUAL "ESSL")
if(NOT EXISTS "${BLAS_PATH}/libessl.so")
message(FATAL_ERROR "The ESSL BLAS library path does not contain libessl.so. CMake is exiting.")
message(FATAL_ERROR "The ESSL BLAS library path does not contain libessl.so! CMake is exiting.")
endif()
if(NOT PATH_IBM_XL_CPP)
message(FATAL_ERROR "The ESSL BLAS choice requires the path to IBM XL C++ runtime libraries (-DPATH_IBM_XL_CPP). CMake is exiting.")
message(FATAL_ERROR "The ESSL BLAS choice requires the path to IBM XL C++ runtime libraries (-DPATH_IBM_XL_CPP)! CMake is exiting.")
endif()
if(NOT PATH_IBM_XL_FOR)
message(FATAL_ERROR "The ESSL BLAS choice requires the path to IBM XL Fortran runtime libraries (-DPATH_IBM_XL_FOR). CMake is exiting.")
message(FATAL_ERROR "The ESSL BLAS choice requires the path to IBM XL Fortran runtime libraries (-DPATH_IBM_XL_FOR)! CMake is exiting.")
endif()
if(NOT PATH_IBM_XL_SMP)
message(FATAL_ERROR "The ESSL BLAS choice requires the path to IBM XL SMP runtime libraries (-DPATH_IBM_XL_SMP). CMake is exiting.")
message(FATAL_ERROR "The ESSL BLAS choice requires the path to IBM XL SMP runtime libraries (-DPATH_IBM_XL_SMP)! CMake is exiting.")
endif()
else()
message(FATAL_ERROR "Invalid BLAS_LIB choice: ATLAS (default Linux), MKL, OPENBLAS, ACML, ESSL. CMake is exiting.")
message(FATAL_ERROR "Invalid BLAS_LIB choice: ATLAS (default Linux), MKL, OPENBLAS, ACML, ESSL! CMake is exiting.")
endif()
else()
if(BLAS_PATH)
message(FATAL_ERROR "If you specify the path to the BLAS libraries, you must also specify which BLAS (-DBLAS_LIB): ATLAS, MKL, OPENBLAS, ACML, ESSL. CMake is exiting.")
message(FATAL_ERROR "If you specify the path to the BLAS libraries, you must also specify which BLAS (-DBLAS_LIB): ATLAS, MKL, OPENBLAS, ACML, ESSL! CMake is exiting.")
endif()
endif()
if(NOT CMAKE_BUILD_TYPE)
set(
CMAKE_BUILD_TYPE "Release"
CACHE
STRING
"Choose the type of build, options are: Debug, Release, RelWithDebInfo, MinSizeRel"
FORCE)
set(CMAKE_BUILD_TYPE "Release"
CACHE STRING "Choose the type of build, options are: Debug, Release, RelWithDebInfo, MinSizeRel" FORCE)
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.exatn"
CACHE PATH "default install path"
FORCE)
CACHE PATH "default install path" FORCE)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
......@@ -131,14 +126,43 @@ find_package(OpenMP REQUIRED)
find_package(MPI)
if(ENABLE_CUDA)
find_package(CUDAExaTN)
if(NOT CUDA_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_GPU")
message(WARNING "You specified ENABLE_CUDA=TRUE but find_package(CUDA) could not find CUDA development headers or libraries")
endif()
if(CUTENSOR)
set(WITH_CUTENSOR "YES")
if(CUTENSOR_PATH)
if(NOT EXISTS "${CUTENSOR_PATH}/lib/11/libcutensor.so")
message(FATAL_ERROR "The provided cuTensor path/lib/11 does not contain libcutensor.so! CMake is exiting.")
endif()
else()
set(CUTENSOR_PATH ".")
message(WARNING "cuTensor path (-DCUTENSOR_PATH) is not explicitly provided, assuming system directories.")
endif()
if(CUQUANTUM)
set(WITH_CUQUANTUM "YES")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCUQUANTUM")
if(CUQUANTUM_PATH)
if(NOT EXISTS "${CUQUANTUM_PATH}/lib64/libcutensornet.so")
message(FATAL_ERROR "The provided cuQuantum path/lib64 does not contain libcutensornet.so! CMake is exiting.")
endif()
else()
message(FATAL_ERROR "cuQuantum path (-DCUQUANTUM_PATH) is not explicitly provided! Cmake is exiting.")
endif()
endif()
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_GPU")
set(CUDA_FOUND FALSE)
set(CUTENSOR FALSE)
set(CUQUANTUM FALSE)
endif()
#If BLAS implementation is not user specified, proceed with "NONE"
......@@ -193,13 +217,12 @@ add_subdirectory(src)
find_package(Python COMPONENTS Interpreter Development)
if(Python_FOUND)
if(${Python_VERSION} VERSION_GREATER_EQUAL 3.0.0)
message(STATUS "${BoldGreen}Found Python version ${Python_VERSION}. Building ExaTN Python API with ${Python_INCLUDE_DIRS}${ColorReset}")
add_subdirectory(python)
else()
if(${Python_VERSION} VERSION_GREATER_EQUAL 3.0.0)
message(STATUS "${BoldGreen}Found Python version ${Python_VERSION}. Building ExaTN Python API with ${Python_INCLUDE_DIRS}${ColorReset}")
add_subdirectory(python)
else()
message(STATUS "${BoldYellow}Found Python version ${Python_VERSION}. Version must be greater than 3.0.0, skipping Python API build.${ColorReset}")
endif()
endif()
else()
message(STATUS "${BoldYellow}Python interpreter or development headers not found. Skipping Python API build.${ColorReset}")
endif()
add_library(ExaTensor::ExaTensor SHARED IMPORTED)
set(REQUIRED_EXATENSOR_LIBS
"${OpenMP_CXX_LIBRARIES};${OpenMP_Fortran_LIBRARIES};gfortran")
set(REQUIRED_EXATENSOR_LIBS "${OpenMP_CXX_LIBRARIES};${OpenMP_Fortran_LIBRARIES};gfortran")
set(REQUIRED_EXATENSOR_INCLUDES "${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include")
if(CUDA_FOUND)
message(STATUS "CUDA ROOT DIR ${CUDA_TOOLKIT_ROOT_DIR}")
message(STATUS "CUDA LIBS ${CUDA_LIBRARIES}")
set(
REQUIRED_EXATENSOR_LIBS
"${REQUIRED_EXATENSOR_LIBS};${CUDA_LIBRARIES};${CUDA_CUBLAS_LIBRARIES};${CUDA_cudadevrt_LIBRARY};${CUDA_TOOLKIT_ROOT_DIR}/lib64/libnvToolsExt.so"
)
set(REQUIRED_EXATENSOR_INCLUDES
"${REQUIRED_EXATENSOR_INCLUDES};${CUDA_INCLUDE_DIRS}")
set(REQUIRED_EXATENSOR_LIBS "${REQUIRED_EXATENSOR_LIBS};${CUDA_LIBRARIES};${CUDA_CUBLAS_LIBRARIES};${CUDA_cudadevrt_LIBRARY};${CUDA_TOOLKIT_ROOT_DIR}/lib64/libnvToolsExt.so")
set(REQUIRED_EXATENSOR_INCLUDES "${REQUIRED_EXATENSOR_INCLUDES};${CUDA_INCLUDE_DIRS}")
if(CUTENSOR)
if(CUTENSOR_PATH AND NOT CUTENSOR_PATH STREQUAL ".")
message(STATUS "CUTENSOR ROOT DIR ${CUTENSOR_PATH}")
set(REQUIRED_EXATENSOR_INCLUDES "${REQUIRED_EXATENSOR_INCLUDES};${CUTENSOR_PATH}/include")
else()
message(STATUS "CUTENSOR IS IN SYSTEM DIRECTORIES")
endif()
set(REQUIRED_EXATENSOR_LIBS "cutensor;${REQUIRED_EXATENSOR_LIBS}")
if(CUQUANTUM AND CUQUANTUM_PATH)
message(STATUS "CUQUANTUM ROOT DIR ${CUQUANTUM_PATH}")
endif()
endif()
endif()
if(BLAS_LIB AND BLAS_PATH)
set(BLAS_LIBRARIES "")
if (BLAS_LIB STREQUAL "ATLAS")
if(BLAS_LIB STREQUAL "ATLAS")
find_library(BLAS_LIBRARY blas HINTS ${BLAS_PATH})
set(BLAS_LIBRARIES "${BLAS_LIBRARY}")
......@@ -37,8 +45,8 @@ if(BLAS_LIB AND BLAS_PATH)
elseif(BLAS_LIB STREQUAL "OPENBLAS")
find_library(openblas openblas HINTS ${BLAS_PATH})
set(BLAS_LIBRARIES "${openblas}")
find_library(openblas openblas HINTS ${BLAS_PATH})
set(BLAS_LIBRARIES "${openblas}")
elseif(BLAS_LIB STREQUAL "ACML")
......@@ -56,13 +64,14 @@ if(BLAS_LIB AND BLAS_PATH)
message(STATUS "Appending ${BLAS_LIBRARIES} to ExaTensor Libraries")
set(REQUIRED_EXATENSOR_LIBS "${BLAS_LIBRARIES};${REQUIRED_EXATENSOR_LIBS}")
endif()
if(WITH_LAPACK)
set(LAPACK_LIBRARIES "")
if (BLAS_LIB STREQUAL "ATLAS")
if(BLAS_LIB STREQUAL "ATLAS")
find_library(LAPACK_LIBRARY lapack HINTS ${BLAS_PATH})
set(LAPACK_LIBRARIES "${LAPACK_LIBRARY}")
......@@ -80,6 +89,7 @@ if(WITH_LAPACK)
set(LAPACK_LIBRARIES "${LAPACK_LIBRARY}")
elseif(BLAS_LIB STREQUAL "ACML")
find_library(acml_mp acml_mp HINTS ${BLAS_PATH})
set(LAPACK_LIBRARIES "${acml_mp}")
......@@ -97,13 +107,8 @@ if(WITH_LAPACK)
endif()
if(MPI_ROOT_DIR)
set(
REQUIRED_EXATENSOR_LIBS
"${REQUIRED_EXATENSOR_LIBS};${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
set(
REQUIRED_EXATENSOR_INCLUDES
"${REQUIRED_EXATENSOR_INCLUDES};${MPI_CXX_INCLUDE_DIRS};${MPI_Fortran_INCLUDE_DIRS}"
)
set(REQUIRED_EXATENSOR_LIBS "${REQUIRED_EXATENSOR_LIBS};${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
set(REQUIRED_EXATENSOR_INCLUDES "${REQUIRED_EXATENSOR_INCLUDES};${MPI_CXX_INCLUDE_DIRS};${MPI_Fortran_INCLUDE_DIRS}")
endif()
set_target_properties(ExaTensor::ExaTensor
......@@ -132,17 +137,11 @@ if(EXA_TALSH_ONLY)
${NOTFULLPATHLIBS})
else()
set(
FULLPATHLIBS
"${CMAKE_INSTALL_PREFIX}/lib/libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_INSTALL_PREFIX}/lib/libexatensor${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
set(FULLPATHLIBS "${CMAKE_INSTALL_PREFIX}/lib/libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_INSTALL_PREFIX}/lib/libexatensor${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(NOTFULLPATHLIBS "libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX};libexatensor${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(APPLE)
set(
FULLPATHLIBS
"${CMAKE_INSTALL_PREFIX}/lib/libtalsh.a;${CMAKE_INSTALL_PREFIX}/lib/libexatensor.a"
)
set(FULLPATHLIBS "${CMAKE_INSTALL_PREFIX}/lib/libtalsh.a;${CMAKE_INSTALL_PREFIX}/lib/libexatensor.a")
set(NOTFULLPATHLIBS "libtalsh.a;libexatensor.a")
endif()
......
if(NOT ${MPI_LIB} STREQUAL "NONE")
add_subdirectory(mpi)
endif()
......
......@@ -10,25 +10,24 @@ file(GLOB SRC
usfunctiongetresourcesource(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongeneratebundleinit(TARGET ${LIBRARY_NAME} OUT SRC)
add_library(${LIBRARY_NAME}
SHARED
${SRC}
)
add_library(${LIBRARY_NAME} SHARED ${SRC})
target_include_directories(
${LIBRARY_NAME}
target_include_directories(${LIBRARY_NAME}
PUBLIC . ..
node_executors/talsh node_executors/exatensor
graph_executors/eager graph_executors/lazy
../graph ${CMAKE_SOURCE_DIR}/src/exatn
)
node_executors/talsh
node_executors/exatensor
graph_executors/eager
graph_executors/lazy
../graph
${CMAKE_SOURCE_DIR}/src/exatn
)
set(_bundle_name exatn_runtime_executor)
set_target_properties(${LIBRARY_NAME}
PROPERTIES COMPILE_DEFINITIONS
US_BUNDLE_NAME=${_bundle_name}
US_BUNDLE_NAME
${_bundle_name})
US_BUNDLE_NAME=${_bundle_name}
US_BUNDLE_NAME
${_bundle_name})
usfunctionembedresources(TARGET
${LIBRARY_NAME}
......@@ -37,12 +36,15 @@ usfunctionembedresources(TARGET
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC CppMicroServices exatn-numerics exatn-runtime PRIVATE ExaTensor::ExaTensor)
target_link_libraries(${LIBRARY_NAME}
PUBLIC CppMicroServices exatn-numerics exatn-runtime exatn_runtime_cuquantum
PRIVATE ExaTensor::ExaTensor
)
exatn_configure_plugin_rpath(${LIBRARY_NAME})
if(EXATN_BUILD_TESTS)
#add_subdirectory(boost/tests)
if(CUQUANTUM)
add_subdirectory(cuquantum)
endif()
file (GLOB HEADERS *.hpp)
......
set(LIBRARY_NAME exatn_runtime_cuquantum)
file(GLOB SRC cuquantum_executor.cu)
set(CUDA_LIBRARIES PUBLIC ${CUDA_LIBRARIES})
set(CUDA_ARCH_BIN 86)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -shared -std c++17 -gencode arch=compute_${CUDA_ARCH_BIN},code=sm_${CUDA_ARCH_BIN} -rdc=true --compiler-options -fPIC")
cuda_add_library(${LIBRARY_NAME} SHARED ${SRC})
set_target_properties(${LIBRARY_NAME} PROPERTIES DEFINE_SYMBOL "")
target_include_directories(${LIBRARY_NAME}
PUBLIC .
${CMAKE_SOURCE_DIR}/src/exatn
)
target_link_libraries(${LIBRARY_NAME} PUBLIC exatn-numerics)
if(CUQUANTUM)
target_include_directories(${LIBRARY_NAME} PUBLIC ${CUQUANTUM_PATH}/include)
target_link_libraries(${LIBRARY_NAME} PRIVATE ${CUQUANTUM_PATH}/lib64/libcutensornet.so)
endif()
if(CUTENSOR AND NOT CUTENSOR_PATH STREQUAL ".")
target_include_directories(${LIBRARY_NAME} PUBLIC ${CUTENSOR_PATH}/include)
target_link_libraries(${LIBRARY_NAME} PRIVATE ${CUTENSOR_PATH}/lib/11/libcutensor.so)
endif()
exatn_configure_plugin_rpath(${LIBRARY_NAME})
if(EXATN_BUILD_TESTS)
#add_subdirectory(boost/tests)
endif()
file (GLOB HEADERS *.hpp)
install(FILES ${HEADERS} DESTINATION include/exatn)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
/** ExaTN: Tensor Runtime: Tensor network executor: NVIDIA cuQuantum
REVISION: 2021/12/14
Copyright (C) 2018-2021 Dmitry Lyakh
Copyright (C) 2018-2021 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
//#ifdef CUQUANTUM
#include "cuquantum_executor.hpp"
#include <iostream>
namespace exatn {
namespace runtime {
CuQuantumExecutor::CuQuantumExecutor()
{
const size_t version = cutensornetGetVersion();
std::cout << "#DEBUG(exatn::runtime::CuQuantumExecutor): Version " << version << std::endl;
}
} //namespace runtime
} //namespace exatn
//#endif //CUQUANTUM
/** ExaTN: Tensor Runtime: Tensor network executor: NVIDIA cuQuantum
REVISION: 2021/12/14
Copyright (C) 2018-2021 Dmitry Lyakh
Copyright (C) 2018-2021 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
//#ifdef CUQUANTUM
#ifndef EXATN_RUNTIME_CUQUANTUM_EXECUTOR_HPP_
#define EXATN_RUNTIME_CUQUANTUM_EXECUTOR_HPP_
#include <cutensornet.h>
#include <cutensor.h>
#include <cuda_runtime.h>
#include <unordered_map>
#include <vector>
#include <cassert>
#include "errors.hpp"
namespace exatn {
namespace runtime {
class CuQuantumExecutor {
public:
CuQuantumExecutor();
virtual ~CuQuantumExecutor() = default;
protected:
};
} //namespace runtime
} //namespace exatn
#endif //EXATN_RUNTIME_CUQUANTUM_EXECUTOR_HPP_
//#endif //CUQUANTUM
/** ExaTN:: Tensor Runtime: Tensor graph node executor
REVISION: 2021/07/02
REVISION: 2021/12/14
Copyright (C) 2018-2021 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2021 Oak Ridge National Laboratory (UT-Battelle)
......@@ -31,6 +31,8 @@ Rationale:
#include <vector>
#include <memory>
#include "errors.hpp"
namespace talsh{
class Tensor;
}
......
set(BUILD_SHARED_LIBS TRUE)
include_directories(${CMAKE_BINARY_DIR}/tpls/cppmicroservices/include)
include_directories(${CMAKE_BINARY_DIR}/tpls/cppmicroservices/framework/include)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-copy")
endif()
......@@ -23,10 +23,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(
FATAL_ERROR
"git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules"
)
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
......@@ -93,8 +90,8 @@ set(ExaTensor_WITH_LAPACK NO)
if(WITH_LAPACK)
set(LAPACK_LIBRARIES "")
set (ExaTensor_WITH_LAPACK YES)
if (BLAS_LIB STREQUAL "ATLAS")
set(ExaTensor_WITH_LAPACK YES)
if(BLAS_LIB STREQUAL "ATLAS")
set(LAPACK_LIBRARIES "-llapack")
elseif(BLAS_LIB STREQUAL "MKL")
elseif(BLAS_LIB STREQUAL "OPENBLAS")
......@@ -111,8 +108,24 @@ message(STATUS "The MPI bin path is set to ${MPI_BIN_PATH}")
message(STATUS "The BLAS implementation is set to ${BLAS_LIB}")
message(STATUS "The BLAS library path is set to ${BLAS_PATH}")
message(STATUS "The BLAS library must also have LAPACK: ${WITH_LAPACK}, ${LAPACK_LIBRARIES}, ${ExaTensor_WITH_LAPACK}")
message(STATUS "TAL-SH only build: ${EXA_TALSH_ONLY}")
message(STATUS "The CUDA Host compiler is set to ${CUDA_HOST_COMPILER}")
message(STATUS "Solely TAL-SH backend build: ${EXA_TALSH_ONLY}")
if(CUTENSOR)
message(STATUS "With cuTensor: YES")
if(CUTENSOR_PATH)
message(STATUS "The cuTensor library path is set to ${CUTENSOR_PATH}")
endif()
if(CUQUANTUM)
message(STATUS "With cuQuantum: YES")
if(CUQUANTUM_PATH)
message(STATUS "The cuQuantum library path is set to ${CUQUANTUM_PATH}")
endif()
else()
message(STATUS "With cuQuantum: NO")
endif()
else()
message(STATUS "With cuTensor: NO")
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
......@@ -124,7 +137,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Cray")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "IBM")
set(TOOLKIT "IBM")
else()
message(FATAL_ERROR "Your discovered compiler suite ${CMAKE_CXX_COMPILER_ID} is not supported. CMake is exiting.")
message(FATAL_ERROR "Your discovered compiler suite ${CMAKE_CXX_COMPILER_ID} is not supported! CMake is exiting.")
endif()
......@@ -138,7 +151,7 @@ if(APPLE)
message(STATUS "This is Mac OS build, building the TAL-SH CPU backend only")
if(BLAS_LIB STREQUAL "ACML" OR BLAS_LIB STREQUAL "ESSL")
message(FATAL_ERROR "Mac OS build does not support ACML or ESSL BLAS libraries. CMake is exiting.")
message(FATAL_ERROR "Mac OS build does not support ACML or ESSL BLAS libraries! CMake is exiting.")
endif()
if(NOT MPI_LIB OR MPI_LIB STREQUAL "NONE")
......@@ -257,6 +270,8 @@ else()
WITH_LAPACK=${ExaTensor_WITH_LAPACK}
PATH_LAPACK_LIB=${BLAS_PATH}
LAPACK_LIBS="${LAPACK_LIBRARIES}"
WITH_CUTENSOR="${WITH_CUTENSOR}"
PATH_CUTENSOR="${CUTENSOR_PATH}"
make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ExaTensor)
elseif(MPI_LIB STREQUAL "OPENMPI")
......@@ -288,6 +303,8 @@ else()
WITH_LAPACK=${ExaTensor_WITH_LAPACK}
PATH_LAPACK_LIB=${BLAS_PATH}
LAPACK_LIBS="${LAPACK_LIBRARIES}"
WITH_CUTENSOR="${WITH_CUTENSOR}"
PATH_CUTENSOR="${CUTENSOR_PATH}"
make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ExaTensor)
elseif(MPI_LIB STREQUAL "MPICH")
......@@ -319,6 +336,8 @@ else()
WITH_LAPACK=${ExaTensor_WITH_LAPACK}
PATH_LAPACK_LIB=${BLAS_PATH}
LAPACK_LIBS="${LAPACK_LIBRARIES}"
WITH_CUTENSOR="${WITH_CUTENSOR}"
PATH_CUTENSOR="${CUTENSOR_PATH}"
make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ExaTensor)
endif()
......@@ -420,10 +439,7 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
OUTPUT_VARIABLE GCC_VERSION)
# Just g++-5.0 and greater contain <codecvt> header. (test in ubuntu)
if(NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0))
message(
WARNING
"${PROJECT_NAME} requires g++ 5.0 or greater. ExaTN will not build ANTLR support."
)
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater! ExaTN will not build ANTLR support.")
else()
add_subdirectory(antlr)
endif()
......@@ -436,10 +452,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"
OUTPUT_VARIABLE CLANG_VERSION)
if(NOT
(CLANG_VERSION VERSION_GREATER 4.2.1 OR CLANG_VERSION VERSION_EQUAL 4.2.1))
message(
WARNING
"${PROJECT_NAME} requires clang 4.2.1 or greater. ExaTN will not build ANTLR support."
)
message(FATAL_ERROR "${PROJECT_NAME} requires clang 4.2.1 or greater! ExaTN will not build ANTLR support.")
else()
add_subdirectory(antlr)
endif()
......
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