@@ -78,25 +78,23 @@ enable_language(C) # C needed even for basic platform introspection
7878
7979# Set install paths ============================================================
8080
81- set (TILEDARRAY_INSTALL_BINDIR "bin"
82- CACHE PATH "TiledArray binary install directory" )
83- set (TILEDARRAY_INSTALL_INCLUDEDIR "include"
84- CACHE PATH "TiledArray INCLUDE install directory" )
85- set (TILEDARRAY_INSTALL_LIBDIR "lib"
86- CACHE PATH "TiledArray LIB install directory" )
87- set (TILEDARRAY_INSTALL_SHAREDIR "share/tiledarray/${TILEDARRAY_EXT_VERSION} "
88- CACHE PATH "TiledArray DATA install directory" )
89- set (TILEDARRAY_INSTALL_DATADIR "${TILEDARRAY_INSTALL_SHAREDIR} /data"
90- CACHE PATH "TiledArray DATA install directory" )
91- set (TILEDARRAY_INSTALL_DOCDIR "${TILEDARRAY_INSTALL_SHAREDIR} /doc"
92- CACHE PATH "TiledArray DOC install directory" )
93- set (TILEDARRAY_INSTALL_CMAKEDIR "lib/cmake/tiledarray"
94- CACHE PATH "TiledArray CMAKE install directory" )
81+ include (GNUInstallDirs )
82+ set (TILEDARRAY_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR} "
83+ CACHE PATH "TiledArray binary install directory" )
84+ set (TILEDARRAY_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR} "
85+ CACHE PATH "TiledArray INCLUDE install directory" )
86+ set (TILEDARRAY_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR} "
87+ CACHE PATH "TiledArray LIB install directory" )
88+ set (TILEDARRAY_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR} /tiledarray/${TILEDARRAY_EXT_VERSION} "
89+ CACHE PATH "TiledArray DATA install directory" )
90+ set (TILEDARRAY_INSTALL_DOCDIR "${TILEDARRAY_INSTALL_DATADIR} /doc"
91+ CACHE PATH "TiledArray DOC install directory" )
92+ set (TILEDARRAY_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR} /cmake/tiledarray"
93+ CACHE PATH "TiledArray CMAKE install directory" )
9594
9695# Add module directory and modules =============================================
9796list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} /cmake/modules/)
9897include (CMakePushCheckState )
99- include (GNUInstallDirs )
10098include (AppendFlags )
10199include (RedefaultableOption )
102100include (DetectMADNESSConfig )
@@ -111,6 +109,7 @@ include(LoadFetchContent)
111109include (CMakeDependentOption )
112110include (CMakePackageConfigHelpers )
113111include (FeatureSummary )
112+ include (CTest ) # testing, defined BUILD_TESTING
114113
115114set (MPI_CXX_SKIP_MPICXX TRUE CACHE BOOL "MPI_CXX_SKIP_MPICXX" )
116115
@@ -130,10 +129,8 @@ add_feature_info(TBB ENABLE_TBB "Intel Thread-Building Blocks (TBB) supports pro
130129option (ENABLE_CUDA "Enable use of CUDA with TiledArray" OFF )
131130add_feature_info (CUDA ENABLE_CUDA "NVIDIA CUDA support for GPU" )
132131
133- if (ENABLE_CUDA)
134- option (ENABLE_CUDA_ERROR_CHECK "TiledArray will always check errors in CUDA calls" ON )
135- add_feature_info (CUDA_ERROR_CHECK ENABLE_CUDA_ERROR_CHECK "Checks CUDA Error" )
136- endif ()
132+ option (ENABLE_HIP "Enable use of HIP with TiledArray" OFF )
133+ add_feature_info (HIP ENABLE_HIP "AMD HIP/ROCm support for GPU" )
137134
138135option (ENABLE_GPERFTOOLS "Enable linking with Gperftools" OFF )
139136add_feature_info (GPERFTOOLS ENABLE_GPERFTOOLS "Google Performance Tools provide fast memory allocation and performance profiling" )
@@ -168,12 +165,16 @@ if(TA_ENABLE_TILE_OPS_LOGGING AND NOT DEFINED TA_TILE_OPS_LOG_LEVEL)
168165 set (TA_TILE_OPS_LOG_LEVEL 1)
169166endif (TA_ENABLE_TILE_OPS_LOGGING AND NOT DEFINED TA_TILE_OPS_LOG_LEVEL )
170167
171- option (TA_RANGEV3 "Enable Range-V3 library" OFF )
172- add_feature_info (TA_RANGEV3 TA_RANGEV3 "Range-V3 ranges library" )
168+ option (TA_TRACE_GLOBAL_COMM_STATS "Enable tracing of communication stats of global objects (DistEval's and DIstributedStorage) TiledArray" OFF )
169+ add_feature_info (TASK_TRACE_DEBUG TA_TRACE_GLOBAL_COMM_STATS "Debug communication stats of global objects (DistEval's and DIstributedStorage) TiledArray" )
170+ set (TILEDARRAY_ENABLE_GLOBAL_COMM_STATS_TRACE ${TA_TRACE_GLOBAL_COMM_STATS} )
173171
174172option (TA_TTG "Enable search/build of TTG library" OFF )
175173add_feature_info (TA_TTG TA_TTG "TTG library" )
176174
175+ option (IntelMKL_FAIR_DISPATCH "Enable fair dispatch in Intel MKL" OFF )
176+ add_feature_info (IntelMKL_FAIR_DISPATCH IntelMKL_FAIR_DISPATCH "Use of fair dispatch in Intel MKL" )
177+
177178# Enable shared library support options
178179redefaultable_option (TA_ASSUMES_ASLR_DISABLED "TiledArray assumes the Address Space Layout Randomization (ASLR) to be disabled" OFF )
179180add_feature_info (ASSUMES_ASLR_DISABLED TA_ASSUMES_ASLR_DISABLED
@@ -288,13 +289,6 @@ set_property(
288289 CACHE TA_ASSERT_POLICY PROPERTY
289290 STRINGS TA_ASSERT_THROW TA_ASSERT_ABORT TA_ASSERT_IGNORE )
290291
291- # if building unit tests default to throw to be able to test TA_ASSERT statements
292- if (NOT (TA_ASSERT_POLICY STREQUAL TA_ASSERT_THROW))
293- if (BUILD_TESTING)
294- message (FATAL_ERROR "TA_ASSERT_POLICY=${TA_ASSERT_POLICY} requires BUILD_TESTING=OFF" )
295- endif (BUILD_TESTING )
296- endif ()
297-
298292##########################
299293# Include source dirctories
300294##########################
@@ -305,15 +299,29 @@ include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
305299##########################
306300add_custom_target (External-tiledarray )
307301
302+ # ccache is an optional dep but must be found first so that the rest of dependencies can use it
303+ find_program (CCACHE ccache )
304+ if (CCACHE)
305+ mark_as_advanced (CCACHE )
306+ message (STATUS "Found ccache: ${CCACHE} " )
307+ set (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE} " CACHE STRING "Compiler launcher to use for compiling C++" )
308+ set (CMAKE_C_COMPILER_LAUNCHER "${CCACHE} " CACHE STRING "Compiler launcher to use for compiling C" )
309+ set (CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE} " CACHE STRING "Compiler launcher to use for compiling CUDA" )
310+ endif (CCACHE )
311+
308312# required deps:
309- # 1. CUDA first since others may depend on it
313+ # 1. derive runtime ( CUDA/HIP/...) first since others may depend on it
310314if (ENABLE_CUDA)
311315 include (external/cuda.cmake )
312316endif ()
317+ if (ENABLE_HIP)
318+ include (external/hip.cmake )
319+ endif ()
320+ include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchRangeV3.cmake )
321+ include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchMADWorld.cmake )
313322if (TA_TTG)
314323 include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchTTG.cmake )
315324endif (TA_TTG )
316- include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchMADWorld.cmake )
317325detect_MADNESS_configuration ()
318326include (external/eigen.cmake )
319327# the FetchContent-based version will not work due to BLT target name conflicts
@@ -331,28 +339,15 @@ if (ENABLE_WFN91_LINALG_DISCOVERY_KIT)
331339 include (FetchWfn91LinAlgModules )
332340 include (FindLinalg )
333341endif (ENABLE_WFN91_LINALG_DISCOVERY_KIT )
334- # BTAS does a better job of building and checking Boost since it uses Boost::serialization
335- # it also memorized the location of its config for use from install tree
342+ # Boost is to be discovered by the top cmake project, and every (sub)project needs to make sure it has all of its targets
343+ include ( external/boost.cmake )
336344include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchBTAS.cmake )
337- include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchBoost.cmake )
338345if (ENABLE_SCALAPACK)
339346 include (external/scalapackpp.cmake )
340347endif ()
341348
342- # optional deps:
343- # 1. ccache
344- find_program (CCACHE ccache )
345- if (CCACHE)
346- mark_as_advanced (CCACHE )
347- message (STATUS "Found ccache: ${CCACHE} " )
348- set (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE} " CACHE STRING "Compiler launcher to use for compiling C++" )
349- set (CMAKE_C_COMPILER_LAUNCHER "${CCACHE} " CACHE STRING "Compiler launcher to use for compiling C" )
350- endif (CCACHE )
351- # 2. range-v3
352- if (TA_RANGEV3)
353- include (${PROJECT_SOURCE_DIR} /cmake/modules/FindOrFetchRangeV3.cmake )
354- endif (TA_RANGEV3 )
355- # 3. TTG
349+ # other optional deps:
350+ # 2. TTG
356351# N.B. make sure TA configures MADNESS correctly
357352#if (TA_TTG)
358353# include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchTTG.cmake)
@@ -369,14 +364,20 @@ add_subdirectory(doc)
369364##########################
370365# checking/testing
371366##########################
372- include ( CTest )
367+ # N.B. CTest was included above
373368if (BUILD_TESTING)
374369 set (_ctest_args -V -R "tiledarray/unit/run-np.*" )
375370 set (_ctest_args_serial -V -R "tiledarray/unit/run-np-1" )
376371 if (DEFINED TA_UT_CTEST_TIMEOUT)
377372 list (APPEND _ctest_args --timeout ${TA_UT_CTEST_TIMEOUT} )
378373 list (APPEND _ctest_args_serial --timeout ${TA_UT_CTEST_TIMEOUT} )
379374 endif (DEFINED TA_UT_CTEST_TIMEOUT )
375+
376+ # if building unit tests need to configure with TA_ASSERT_POLICY=TA_ASSERT_THROW to be able to test TA_ASSERT statements
377+ if (NOT (TA_ASSERT_POLICY STREQUAL TA_ASSERT_THROW))
378+ message (WARNING "BUILD_TESTING=ON requires configuring with TA_ASSERT_POLICY=TA_ASSERT_THROW to engage REQUIRE_THROWS() tests; will skip these tests" )
379+ endif ()
380+
380381 add_custom_target_subproject (tiledarray check USES_TERMINAL COMMAND ${CMAKE_CTEST_COMMAND} ${_ctest_args} )
381382 add_custom_target_subproject (tiledarray check_serial USES_TERMINAL COMMAND ${CMAKE_CTEST_COMMAND} ${_ctest_args_serial} )
382383 add_subdirectory (tests )
@@ -431,7 +432,7 @@ CONFIGURE_FILE(
431432
432433# install config files
433434install (FILES ${PROJECT_BINARY_DIR} /tiledarray.pc
434- DESTINATION lib /pkgconfig)
435+ DESTINATION " ${CMAKE_INSTALL_LIBDIR} /pkgconfig" )
435436
436437# include extra cmake files
437438install (FILES
@@ -480,8 +481,11 @@ ADD_CUSTOM_TARGET(release
480481 COMMENT "Switch CMAKE_BUILD_TYPE to Release"
481482 )
482483
483- feature_summary (WHAT ALL
484- DESCRIPTION "=== TiledArray Package/Feature Info ===" )
484+ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME )
485+ feature_summary (WHAT ALL
486+ DESCRIPTION "=== TiledArray Package/Feature Info ===" )
487+ feature_summary (FILENAME ${CMAKE_CURRENT_BINARY_DIR} /features.log WHAT ALL )
488+ endif ()
485489
486490option (TA_PYTHON "Build TA python module" OFF )
487491if (TA_PYTHON)
0 commit comments