Commit 4fd9aeac authored by Mccaskey, Alex's avatar Mccaskey, Alex

Updates to build system to streamline exatn-config.cmake

Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent d7dc14c8
......@@ -187,6 +187,4 @@ if(PYTHON_INCLUDE_DIR)
add_subdirectory(python)
endif()
configure_file("${CMAKE_SOURCE_DIR}/cmake/exatn-config.cmake.in"
"${CMAKE_BINARY_DIR}/exatn-config.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/exatn-config.cmake" DESTINATION .)
......@@ -30,9 +30,10 @@ if(BLAS_LIB AND BLAS_PATH)
find_library(lp64 mkl_intel_lp64 HINTS ${BLAS_PATH})
find_library(gnu_thread mkl_gnu_thread HINTS ${BLAS_PATH})
find_library(core mkl_core HINTS ${BLAS_PATH})
find_library(rt mkl_rt HINTS ${BLAS_PATH})
message (STATUS "HOWDY: ${rt}")
set(BLAS_LIBRARIES "${lp64};${gnu_thread};${core};${rt};pthread;m;dl")
get_filename_component(EXATN_MKL_PATH ${gnu_thread} DIRECTORY)
set(BLAS_LIBRARIES "${lp64};${gnu_thread};${core};pthread;m;dl")
elseif(BLAS_LIB STREQUAL "ACML")
find_library(acml_mp acml_mp HINTS ${BLAS_PATH})
......@@ -48,7 +49,7 @@ if(BLAS_LIB AND BLAS_PATH)
endif()
message(STATUS "Appending ${BLAS_LIBRARIES} to ExaTensor Libraries")
set(REQUIRED_EXATENSOR_LIBS "${REQUIRED_EXATENSOR_LIBS};${BLAS_LIBRARIES}")
set(REQUIRED_EXATENSOR_LIBS "${BLAS_LIBRARIES};${REQUIRED_EXATENSOR_LIBS}")
endif()
if(WITH_LAPACK)
......@@ -106,8 +107,8 @@ set_property(TARGET ExaTensor::ExaTensor
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
if(EXA_TALSH_ONLY)
set(FULLPATHLIBS "${CMAKE_INSTALL_PREFIX}/lib/libtalsh.so")
set(NOTFULLPATHLIBS "libtalsh.so")
set(FULLPATHLIBS "${CMAKE_INSTALL_PREFIX}/lib/libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(NOTFULLPATHLIBS "libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(APPLE)
set(FULLPATHLIBS "${CMAKE_INSTALL_PREFIX}/lib/libtalsh.a")
......@@ -123,9 +124,9 @@ if(EXA_TALSH_ONLY)
else()
set(
FULLPATHLIBS
"${CMAKE_INSTALL_PREFIX}/lib/libtalsh.so;${CMAKE_INSTALL_PREFIX}/lib/libexatensor.so"
"${CMAKE_INSTALL_PREFIX}/lib/libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_INSTALL_PREFIX}/lib/libexatensor${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
set(NOTFULLPATHLIBS "libtalsh.so;libexatensor.so")
set(NOTFULLPATHLIBS "libtalsh${CMAKE_SHARED_LIBRARY_SUFFIX};libexatensor${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(APPLE)
set(
......@@ -148,8 +149,4 @@ add_subdirectory(numerics)
add_subdirectory(driver-rpc)
add_subdirectory(parser)
add_subdirectory(runtime)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/exatn-config.in
${CMAKE_BINARY_DIR}/scripts/exatn-config)
install(PROGRAMS ${CMAKE_BINARY_DIR}/scripts/exatn-config DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
add_subdirectory(scripts)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/exatn-config.cmake.in"
"${CMAKE_BINARY_DIR}/exatn-config.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/exatn-config.cmake" DESTINATION .)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/exatn-config.in
${CMAKE_BINARY_DIR}/scripts/exatn-config)
install(PROGRAMS ${CMAKE_BINARY_DIR}/scripts/exatn-config DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
......@@ -16,11 +16,13 @@ set (EXATN_LIBRARY_DIR "${EXATN_ROOT}/lib")
link_directories("${EXATN_ROOT}/lib")
set(EXATN_INCLUDE_ROOT "${EXATN_ROOT}/include")
set (EXATN_INCLUDE_DIRS "${EXATN_INCLUDE_ROOT}/cppmicroservices4;${EXATN_INCLUDE_ROOT}/exatn;${EXATN_INCLUDE_ROOT}/gtest;${EXATN_INCLUDE_ROOT}/exatensor")
set (EXATN_INCLUDE_DIRS "${EXATN_INCLUDE_ROOT}/cppmicroservices4;${EXATN_INCLUDE_ROOT}/exatn;${EXATN_INCLUDE_ROOT}/exatensor")
set (EXATN_LIBRARIES "exatn;exatn-numerics;exatn-utility;CppMicroServices")
set (BLAS_LIB "@BLAS_LIB@")
set (BLAS_PATH "@BLAS_PATH@")
set(EXATN_BLAS_LIB @BLAS_LIB@)
if (EXATN_BLAS_LIB MATCHES MKL)
set(EXATN_MKL_PATH "@EXATN_MKL_PATH@")
endif()
macro(exatn_add_test TESTNAME)
add_executable(${TESTNAME} ${ARGN})
......@@ -40,140 +42,31 @@ macro(exatn_enable_rpath LIBNAME)
endmacro()
set(EXATNLIB "libexatn.so")
set(CPPUSLIB "libCppMicroServices.so.4.0.0")
if (APPLE)
set(EXATNLIB "libexatn.dylib")
set(CPPUSLIB "libCppMicroServices.4.0.0.dylib")
endif()
add_library(ExaTensor::ExaTensor SHARED IMPORTED)
set(REQUIRED_EXATENSOR_LIBS
"@OpenMP_CXX_LIBRARIES@;@OpenMP_Fortran_LIBRARIES@;gfortran")
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"
)
endif()
if(BLAS_LIB AND BLAS_PATH)
set(BLAS_LIBRARIES "")
if (BLAS_LIB STREQUAL "ATLAS")
find_library(BLAS_LIBRARY blas HINTS ${BLAS_PATH})
set(BLAS_LIBRARIES "${BLAS_LIBRARY}")
elseif(BLAS_LIB STREQUAL "MKL")
find_library(lp64 mkl_intel_lp64 HINTS ${BLAS_PATH})
find_library(gnu_thread mkl_gnu_thread HINTS ${BLAS_PATH})
find_library(core mkl_core HINTS ${BLAS_PATH})
find_library(rt mkl_rt HINTS ${BLAS_PATH})
set(BLAS_LIBRARIES "${lp64};${gnu_thread};${core};${rt};pthread;m;dl")
elseif(BLAS_LIB STREQUAL "ACML")
find_library(acml_mp acml_mp HINTS ${BLAS_PATH})
set(BLAS_LIBRARIES "${acml_mp}")
elseif(BLAS_LIB STREQUAL "ESSL")
find_library(essl essl HINTS ${BLAS_PATH})
find_library(xlf90_r xlf90_r HINTS ${PATH_IBM_XL_FOR})
find_library(xlfmath xlfmath HINTS ${PATH_IBM_XL_FOR})
set(BLAS_LIBRARIES "${essl};${xlf90_r};${xlfmath}")
endif()
message(STATUS "Appending ${BLAS_LIBRARIES} to ExaTensor Libraries")
set(REQUIRED_EXATENSOR_LIBS "${REQUIRED_EXATENSOR_LIBS};${BLAS_LIBRARIES}")
endif()
if(MPI_ROOT_DIR)
set(
REQUIRED_EXATENSOR_LIBS
"${REQUIRED_EXATENSOR_LIBS};${MPI_CXX_LIBRARIES};${MPI_Fortran_LIBRARIES}")
endif()
set_target_properties(ExaTensor::ExaTensor
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
""
INTERFACE_LINK_LIBRARIES
"${REQUIRED_EXATENSOR_LIBS}")
set(EXATNLIB "libexatn@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(CPPUSLIB "libCppMicroServices@CMAKE_SHARED_LIBRARY_SUFFIX@.4.0.0")
set(EXATNRUNTIMELIB "libexatn-runtime@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(EXATNNUMERICSLIB "libexatn-numerics@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(EXATNGRAPHLIB "libexatn-runtime-graph@CMAKE_SHARED_LIBRARY_SUFFIX@")
set_property(TARGET ExaTensor::ExaTensor
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} @CMAKE_CXX_FLAGS@")
if(EXA_TALSH_ONLY)
set(FULLPATHLIBS "${EXATN_ROOT}/lib/libtalsh.so")
set(NOTFULLPATHLIBS "libtalsh.so")
if(APPLE)
set(FULLPATHLIBS "${EXATN_ROOT}/lib/libtalsh.a")
set(NOTFULLPATHLIBS "libtalsh.a")
endif()
set_target_properties(ExaTensor::ExaTensor
PROPERTIES IMPORTED_LOCATION_RELEASE
${FULLPATHLIBS}
IMPORTED_SONAME_RELEASE
${NOTFULLPATHLIBS})
else()
set(
FULLPATHLIBS
"${EXATN_ROOT}/lib/libtalsh.so;${EXATN_ROOT}/lib/libexatensor.so"
)
set(NOTFULLPATHLIBS "libtalsh.so;libexatensor.so")
if(APPLE)
set(
FULLPATHLIBS
"${EXATN_ROOT}/lib/libtalsh.a;${EXATN_ROOT}/lib/libexatensor.a"
)
set(NOTFULLPATHLIBS "libtalsh.a;libexatensor.a")
endif()
set_target_properties(ExaTensor::ExaTensor
PROPERTIES IMPORTED_LOCATION_RELEASE
${FULLPATHLIBS}
IMPORTED_SONAME_RELEASE
${NOTFULLPATHLIBS})
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEXATN_SERVICE -fPIC -DPATH_MAX=4096 -Wno-attributes")
if (NOT CUDA_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_GPU")
endif()
if (NOT TARGET CppMicroServices::CppMicroServices)
# Create imported target CppMicroServices::CppMicroServices
add_library(CppMicroServices::CppMicroServices SHARED IMPORTED)
# Create imported target CppMicroServices::CppMicroServices
add_library(CppMicroServices::CppMicroServices SHARED IMPORTED)
set_target_properties(CppMicroServices::CppMicroServices PROPERTIES
INTERFACE_COMPILE_FEATURES "cxx_variadic_templates;cxx_nullptr"
INTERFACE_INCLUDE_DIRECTORIES "${EXATN_INCLUDE_ROOT}/cppmicroservices4"
INTERFACE_LINK_LIBRARIES "dl;pthread"
)
set_target_properties(CppMicroServices::CppMicroServices PROPERTIES
INTERFACE_COMPILE_FEATURES "cxx_variadic_templates;cxx_nullptr"
INTERFACE_INCLUDE_DIRECTORIES "${EXATN_INCLUDE_ROOT}/cppmicroservices4"
INTERFACE_LINK_LIBRARIES "dl;pthread"
)
# Import target "CppMicroServices::CppMicroServices" for configuration "Release"
set_property(TARGET CppMicroServices::CppMicroServices APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(CppMicroServices::CppMicroServices PROPERTIES
IMPORTED_LOCATION_RELEASE "${EXATN_ROOT}/lib/${CPPUSLIB}"
IMPORTED_SONAME_RELEASE "${CPPUSLIB}"
# Import target "CppMicroServices::CppMicroServices" for configuration "Release"
set_property(TARGET CppMicroServices::CppMicroServices APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(CppMicroServices::CppMicroServices PROPERTIES
IMPORTED_LOCATION_RELEASE "${EXATN_ROOT}/lib/${CPPUSLIB}"
IMPORTED_SONAME_RELEASE "${CPPUSLIB}"
)
endif()
......@@ -190,7 +83,7 @@ add_library(exatn::exatn-numerics SHARED IMPORTED)
set_target_properties(exatn::exatn-numerics PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EXATN_INCLUDE_ROOT}/exatn;${EXATN_INCLUDE_ROOT}"
INTERFACE_LINK_LIBRARIES "ExaTensor::ExaTensor"
INTERFACE_LINK_LIBRARIES "@REQUIRED_EXATENSOR_LIBS@"
)
# Create imported target exatn::exatn-runtime
......@@ -213,31 +106,31 @@ set_target_properties(exatn::exatn-runtime-graph PROPERTIES
# Import target "exatn::exatn" for configuration "DEBUG"
set_property(TARGET exatn::exatn APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(exatn::exatn PROPERTIES
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/libexatn.so"
IMPORTED_SONAME_DEBUG "libexatn.so"
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/${EXATNLIB}"
IMPORTED_SONAME_DEBUG ${EXATNLIB}
)
# Import target "exatn::exatn-numerics" for configuration "DEBUG"
set_property(TARGET exatn::exatn-numerics APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(exatn::exatn-numerics PROPERTIES
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/libexatn-numerics.so"
IMPORTED_SONAME_DEBUG "libexatn-numerics.so"
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/${EXATNNUMERICSLIB}"
IMPORTED_SONAME_DEBUG ${EXATNNUMERICSLIB}
)
# Import target "exatn::exatn-runtime" for configuration "DEBUG"
set_property(TARGET exatn::exatn-runtime APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(exatn::exatn-runtime PROPERTIES
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/libexatn-runtime.so"
IMPORTED_SONAME_DEBUG "libexatn-runtime.so"
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/${EXATNRUNTIMELIB}"
IMPORTED_SONAME_DEBUG ${EXATNRUNTIMELIB}
)
# Import target "exatn::exatn-runtime-graph" for configuration "DEBUG"
set_property(TARGET exatn::exatn-runtime-graph APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(exatn::exatn-runtime-graph PROPERTIES
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/libexatn-runtime-graph.so"
IMPORTED_SONAME_DEBUG "libexatn-runtime-graph.so"
IMPORTED_LOCATION_DEBUG "${EXATN_ROOT}/lib/${EXATNGRAPHLIB}"
IMPORTED_SONAME_DEBUG ${EXATNGRAPHLIB}
)
set(ExaTN_FOUND TRUE)
\ No newline at end of file
set(ExaTN_FOUND TRUE)
set(EXATN_FOUND TRUE)
\ No newline at end of file
......@@ -17,18 +17,18 @@ def main(argv=None):
'-L', '@CMAKE_INSTALL_PREFIX@/lib', '-lCppMicroServices','-ltalsh', '-lexatn', '-lexatn-numerics', '-lexatn-runtime', '-lexatn-runtime-graph', '-ldl', '-lpthread']
if '@EXA_TALSH_ONLY@' != 'YES':
baseLibs += ['-lexatensor']
exatnLibs = '@REQUIRED_EXATENSOR_LIBS@'.split(';')
for i,e in enumerate(exatnLibs):
if e == 'gfortran':
exatnLibs[i] = '-lgfortran'
if e == 'pthread':
exatnLibs[i] = '-lpthread'
if e == 'dl':
exatnLibs[i] = '-ldl'
if e == 'm':
exatnLibs[i] = '-lm'
baseLibs += '@MPI_CXX_LIBRARIES@'.split(';') + exatnLibs
exatnLibs = '@REQUIRED_EXATENSOR_LIBS@'.split(';')
for i,e in enumerate(exatnLibs):
if e == 'gfortran':
exatnLibs[i] = '-lgfortran'
if e == 'pthread':
exatnLibs[i] = '-lpthread'
if e == 'dl':
exatnLibs[i] = '-ldl'
if e == 'm':
exatnLibs[i] = '-lm'
baseLibs += '@MPI_CXX_LIBRARIES@'.split(';') + exatnLibs
output += baseLibs
# Print out the linker flags used in CMake
......
#include "exatn.hpp"
using namespace exatn;
using namespace exatn::numerics;
int main() {
exatn::initialize();
using exatn::TensorOpCode;
exatn::initialize();
using exatn::TensorOpCode;
using exatn::numerics::Tensor;
using exatn::numerics::TensorShape;
using exatn::numerics::TensorOperation;
......
......@@ -30,7 +30,19 @@ endif()
if(EXATN_BUILD_TESTS)
enable_testing()
# DONT BUILD GTEST IN DEBUG
set(GTEST_BUILD_TYPE_FLIP FALSE)
if (CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "DEBUG")
set(CMAKE_BUILD_TYPE "Release")
set(GTEST_BUILD_TYPE_FLIP TRUE)
endif()
add_subdirectory(gtest)
if (GTEST_BUILD_TYPE_FLIP)
set(CMAKE_BUILD_TYPE "DEBUG")
endif()
mark_as_advanced(BUILD_GMOCK
BUILD_GTEST
BUILD_SHARED_LIBS
......@@ -99,6 +111,12 @@ else()
endif()
set(EXATENSOR_BUILD_TYPE OPT)
if (CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "DEBUG")
message(STATUS "Setting ExaTensor BUILD_TYPE to DEV")
set(EXATENSOR_BUILD_TYPE DEV)
endif()
if(APPLE)
message(STATUS "This is Mac OS build, building the TAL-SH CPU backend only")
......@@ -114,6 +132,7 @@ if(APPLE)
CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
CMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
TOOLKIT=${TOOLKIT}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=YES
......@@ -138,6 +157,7 @@ if(APPLE)
OMPI_CC=${CMAKE_C_COMPILER}
OMPI_FC=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=NO
EXATN_SERVICE=YES
......@@ -163,6 +183,7 @@ if(APPLE)
MPICH_CC=${CMAKE_C_COMPILER}
MPICH_FC=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=NO
EXATN_SERVICE=YES
......@@ -198,6 +219,7 @@ else()
CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
CMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=YES
EXATN_SERVICE=YES
......@@ -223,6 +245,7 @@ else()
OMPI_CC=${CMAKE_C_COMPILER}
OMPI_FC=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=NO
EXATN_SERVICE=YES
......@@ -250,6 +273,7 @@ else()
MPICH_CC=${CMAKE_C_COMPILER}
MPICH_FC=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=NO
EXATN_SERVICE=YES
......@@ -282,6 +306,7 @@ else()
CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
CMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=YES
EXATN_SERVICE=YES
......@@ -305,6 +330,7 @@ else()
OMPI_CC=${CMAKE_C_COMPILER}
OMPI_FC=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=NO
EXATN_SERVICE=YES
......@@ -330,6 +356,7 @@ else()
MPICH_CC=${CMAKE_C_COMPILER}
MPICH_FC=${CMAKE_Fortran_COMPILER}
TOOLKIT=${TOOLKIT}
BUILD_TYPE=${EXATENSOR_BUILD_TYPE}
EXA_NO_BUILD=${TALSHXX_EXISTS}
EXA_TALSH_ONLY=NO
EXATN_SERVICE=YES
......
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