Skip to content

Commit ffcf75b

Browse files
committed
Merge branch 'master' into kmp5/feature/CP
2 parents e2fd8bd + fb5d5b8 commit ffcf75b

244 files changed

Lines changed: 16389 additions & 8015 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,26 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
os : [ macos-latest ]
16-
cxx : [ clang++, /usr/local/bin/g++-10 ]
15+
os : [ macos-latest, ubuntu-22.04 ]
1716
build_type : [ Release, Debug ]
1817
task_backend: [ Pthreads, PaRSEC ]
19-
prerequisites : [ gcc@10 boost eigen open-mpi bison scalapack ]
18+
include:
19+
- os: ubuntu-22.04
20+
cc: /usr/bin/gcc-12
21+
cxx: /usr/bin/g++-12
22+
- os: macos-latest
23+
cc: clang
24+
cxx: clang++
2025

2126
name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }} ${{ matrix.task_backend }}"
2227
runs-on: ${{ matrix.os }}
2328
env:
2429
CXX : ${{ matrix.cxx }}
30+
CCACHE_DIR : ${{github.workspace}}/build/.ccache
31+
CCACHE_COMPRESS : true
32+
CCACHE_COMPRESSLEVEL : 6
33+
OMPI_MCA_btl_vader_single_copy_mechanism : none
34+
PARSEC_MCA_runtime_bind_threads : 0
2535
BUILD_CONFIG : >
2636
-DMADNESS_TASK_BACKEND=${{ matrix.task_backend }}
2737
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
@@ -33,37 +43,48 @@ jobs:
3343
steps:
3444
- uses: actions/checkout@v2
3545

36-
- uses: maxim-lobanov/setup-xcode@v1
37-
with:
38-
xcode-version: '<14'
39-
4046
- name: Host system info
4147
shell: bash
4248
run: cmake -P ${{github.workspace}}/ci/host_system_info.cmake
4349

44-
- name: Install ${{matrix.prerequisites}}
50+
51+
- name: Install prerequisite MacOS packages
52+
if: ${{ matrix.os == 'macos-latest' }}
4553
run: |
46-
brew install ${{matrix.prerequisites}}
47-
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
54+
brew install ninja boost eigen open-mpi bison scalapack ccache
55+
echo "MPIEXEC=/opt/homebrew/bin/mpiexec" >> $GITHUB_ENV
56+
57+
- name: Install prerequisites Ubuntu packages
58+
if: ${{ matrix.os == 'ubuntu-22.04' }}
59+
run: |
60+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
61+
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
62+
sudo apt-get update
63+
sudo apt-get -y install ninja-build g++-12 liblapack-dev libboost-dev libboost-serialization-dev libboost-random-dev libeigen3-dev openmpi-bin libopenmpi-dev libtbb-dev ccache flex bison libscalapack-mpi-dev cmake doxygen
64+
sudo ln -s /usr/lib/x86_64-linux-gnu/libscalapack-openmpi.so /usr/lib/x86_64-linux-gnu/libscalapack.so
65+
echo "MPIEXEC=/usr/bin/mpiexec" >> $GITHUB_ENV
66+
67+
- name: Setup ccache
68+
uses: hendrikmuhs/ccache-action@v1.2
69+
with:
70+
key: ccache-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.task_backend }}
4871

4972
- name: "Configure build: ${{ env.BUILD_CONFIG }}"
5073
shell: bash
5174
run: |
5275
set -x;
53-
cmake -B${{github.workspace}}/build $BUILD_CONFIG || (cat CMakeFiles/CMakeOutput.log && cat CMakeFiles/CMakeError.log)
76+
cmake -B${{github.workspace}}/build $BUILD_CONFIG || (cat CMakeFiles/CMakeConfigureLog.yaml)
5477
5578
- name: Build
5679
working-directory: ${{github.workspace}}/build
5780
shell: bash
5881
run: |
59-
cmake --build . --target tiledarray
60-
cmake --build . --target examples
82+
ccache -p && ccache -z && cmake --build . --target tiledarray ta_test examples && ccache -s
6183
6284
- name: Test
6385
working-directory: ${{github.workspace}}/build
6486
shell: bash
6587
#run: ctest -C $${{matrix.build_type}}
6688
run: |
6789
source ${{github.workspace}}/ci/openmpi.env
68-
cmake --build . --target ta_test
6990
cmake --build . --target check-tiledarray

.gitlab-ci.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ variables:
1515
TA_UT_CTEST_TIMEOUT=3000
1616
${TA_PYTHON}
1717
${ENABLE_CUDA}
18+
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
1819
${BLA_VENDOR}
1920
${BLA_THREADS}
2021
${ENABLE_SCALAPACK}
@@ -24,11 +25,18 @@ before_script:
2425
# TODO optimize ta_test build memory consumption
2526
- export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=1}
2627
- echo "CMAKE_BUILD_PARALLEL_LEVEL=$CMAKE_BUILD_PARALLEL_LEVEL"
28+
# configure ccache
29+
- export CCACHE_DIR=/root/.ccache
30+
- export CCACHE_COMPRESS=true
31+
- export CCACHE_COMPRESSLEVEL=6
32+
# print out the ccache configuration
33+
- ccache -p
34+
# zero out the ccache statistics
35+
- ccache -z
2736

2837
ubuntu:
2938
stage: build
3039
tags:
31-
- docker
3240
- ${RUNNER_TAGS}
3341
timeout: 3h
3442
image: valeevgroup/${IMAGE}
@@ -52,26 +60,20 @@ ubuntu:
5260
- build/CMakeCache.txt
5361
- build/CMakeFiles/CMakeOutput.log
5462
- build/CMakeFiles/CMakeError.log
63+
- build/CMakeFiles/CMakeConfigureLog.yaml
5564
reports:
5665
metrics: build/metrics.txt
5766
parallel:
5867
matrix:
59-
- IMAGE : [ "ubuntu:18.04", "ubuntu:20.04" ]
68+
- IMAGE : [ "ubuntu:22.04" ]
6069
CXX: [ g++ ]
61-
BUILD_TYPE : [ "Release" ]
62-
BLA_VENDOR : [ "BLAS_PREFERENCE_LIST=IntelMKL" ]
63-
BLA_THREADS : [ "IntelMKL_THREAD_LAYER=tbb" ]
64-
# ENABLE_SCALAPACK : [ "ENABLE_SCALAPACK=ON", "ENABLE_SCALAPACK=OFF" ]
65-
TA_PYTHON : [ "TA_PYTHON=OFF" ] # needs to be fixed for MKL
66-
RUNNER_TAGS: [ linux ]
67-
- IMAGE : [ "ubuntu:18.04", "ubuntu:20.04" ]
68-
CXX: [ g++, clang++-9 ]
69-
BUILD_TYPE : [ "Release", "Debug" ]
70-
ENABLE_SCALAPACK : [ "ENABLE_SCALAPACK=ON", "ENABLE_SCALAPACK=OFF" ]
71-
RUNNER_TAGS: [ linux ]
72-
- IMAGE : [ "ubuntu:18.04", "ubuntu:20.04" ]
73-
CXX: [ g++ ]
74-
BUILD_TYPE : [ "Release", "Debug" ]
70+
BUILD_TYPE : [ "RelWithDebInfo" ]
71+
TA_PYTHON : [ "TA_PYTHON=OFF" ]
7572
ENABLE_CUDA : [ "ENABLE_CUDA=ON" ]
7673
TA_TARGETS : [ "tiledarray examples-tiledarray check_serial-tiledarray" ]
7774
RUNNER_TAGS: [ cuda ]
75+
76+
77+
after_script:
78+
# print out the ccache statistics
79+
- ccache -s

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ repos:
3838
name: Format C/C++ code using clang-format.
3939
language: system
4040
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
41-
entry: clang-format -i
42-
args: [--style=file]
41+
entry: bin/admin/clang-format.sh
42+
args: [--style=file -i]

CMakeLists.txt

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -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 =============================================
9796
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
9897
include(CMakePushCheckState)
99-
include(GNUInstallDirs)
10098
include(AppendFlags)
10199
include(RedefaultableOption)
102100
include(DetectMADNESSConfig)
@@ -111,6 +109,7 @@ include(LoadFetchContent)
111109
include(CMakeDependentOption)
112110
include(CMakePackageConfigHelpers)
113111
include(FeatureSummary)
112+
include(CTest) # testing, defined BUILD_TESTING
114113

115114
set(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
130129
option(ENABLE_CUDA "Enable use of CUDA with TiledArray" OFF)
131130
add_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

138135
option(ENABLE_GPERFTOOLS "Enable linking with Gperftools" OFF)
139136
add_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)
169166
endif(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

174172
option(TA_TTG "Enable search/build of TTG library" OFF)
175173
add_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
178179
redefaultable_option(TA_ASSUMES_ASLR_DISABLED "TiledArray assumes the Address Space Layout Randomization (ASLR) to be disabled" OFF)
179180
add_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
##########################
306300
add_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
310314
if(ENABLE_CUDA)
311315
include(external/cuda.cmake)
312316
endif()
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)
313322
if (TA_TTG)
314323
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchTTG.cmake)
315324
endif(TA_TTG)
316-
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchMADWorld.cmake)
317325
detect_MADNESS_configuration()
318326
include(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)
333341
endif(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)
336344
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchBTAS.cmake)
337-
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchBoost.cmake)
338345
if(ENABLE_SCALAPACK)
339346
include(external/scalapackpp.cmake)
340347
endif()
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
373368
if (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
433434
install(FILES ${PROJECT_BINARY_DIR}/tiledarray.pc
434-
DESTINATION lib/pkgconfig)
435+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
435436

436437
# include extra cmake files
437438
install(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

486490
option(TA_PYTHON "Build TA python module" OFF)
487491
if (TA_PYTHON)

0 commit comments

Comments
 (0)