Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
307 changes: 21 additions & 286 deletions CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmake/BuildInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
function(setup_build_info)
message(STATUS "Setting up build information...")

include(cmake/CollectBuildInfoVars.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/CollectBuildInfoVars.cmake)

set(BUILD_INFO_TEMPLATE "${CMAKE_SOURCE_DIR}/source/source_io/build_info.h.in")
set(BUILD_INFO_OUTPUT "${CMAKE_BINARY_DIR}/source/source_io/build_info.h")
Expand Down
30 changes: 15 additions & 15 deletions cmake/Testing.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Setup Testing Environment (GTest, CTest, AddTest function)
# Setup unit-test dependencies and the AddTest helper
# ==============================================================================

# include_guard(GLOBAL)
Expand All @@ -12,8 +12,9 @@ macro(set_if_higher VARIABLE VALUE)
endmacro()

# Add performance test in abacus
if(ENABLE_GOOGLEBENCH)
set(BUILD_TESTING ON)
# Benchmarks are test targets; do not make them implicitly enable the full
# unit-test tree for ordinary builds.
if(BUILD_TESTING AND ENABLE_GOOGLEBENCH)
find_package(benchmark HINTS ${BENCHMARK_DIR})
if(NOT ${benchmark_FOUND})
set(BENCHMARK_USE_BUNDLED_GTEST OFF)
Expand All @@ -38,17 +39,19 @@ endif()
add_coverage(${UT_TARGET})
endif()

# dependencies & link library
target_link_libraries(${UT_TARGET} PRIVATE ${UT_LIBS} Threads::Threads
GTest::gtest_main GTest::gmock_main)
if(ENABLE_GOOGLEBENCH)
# Dependencies & link library
# Share the numerical/MPI/OpenMP runtime closure but not
# the optional feature closure of the final binary
target_link_libraries(${UT_TARGET} PRIVATE
${UT_LIBS}
GTest::gtest_main
GTest::gmock_main
abacus::linalg_libs)
if(BUILD_TESTING AND ENABLE_GOOGLEBENCH)
target_link_libraries(
${UT_TARGET} PRIVATE benchmark::benchmark)
endif()

if(USE_OPENMP)
target_link_libraries(${UT_TARGET} PRIVATE OpenMP::OpenMP_CXX)
endif()

# Link to build info if needed
if("${UT_SOURCES}" MATCHES "parse_args.cpp")
Expand All @@ -64,8 +67,6 @@ endif()

if(BUILD_TESTING)
set_if_higher(CMAKE_CXX_STANDARD 14) # Required in orbital
include(CTest)
enable_testing()
find_package(GTest HINTS /usr/local/lib/ ${GTEST_DIR})
if(NOT ${GTest_FOUND})
include(FetchContent)
Expand All @@ -77,7 +78,6 @@ if(BUILD_TESTING)
GIT_PROGRESS TRUE)
FetchContent_MakeAvailable(googletest)
endif()
# TODO: Try the GoogleTest module.
# https://cmake.org/cmake/help/latest/module/GoogleTest.html
add_subdirectory(tests) # Contains integration tests
# Integration tests are registered from source/CMakeLists.txt after the
# final executable has been created.
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

include_guard(GLOBAL)

function(abacus_setup_cublasmp target_name)
function(abacus_setup_cublasmp)
abacus_add_feature_definitions(__CUBLASMP)

# 1. Search for cuBLASMp library and header files
Expand Down Expand Up @@ -72,7 +72,4 @@ function(abacus_setup_cublasmp target_name)
INTERFACE_INCLUDE_DIRECTORIES "${CUBLASMP_INCLUDE_DIR}")
endif()

# 5. Propagate library usage requirements to all ABACUS targets.
target_link_libraries(abacus_external_deps INTERFACE cublasMp::cublasMp)

endfunction()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

include_guard(GLOBAL)

function(abacus_setup_cusolvermp target_name)
function(abacus_setup_cusolvermp)
abacus_add_feature_definitions(__CUSOLVERMP)

# Find cuSOLVERMp first, then decide communicator backend.
Expand Down Expand Up @@ -126,10 +126,4 @@ function(abacus_setup_cusolvermp target_name)
INTERFACE_INCLUDE_DIRECTORIES "${CUSOLVERMP_INCLUDE_DIR}")
endif()

# === Link libraries and propagate include directories ===
if(_use_cal)
target_link_libraries(abacus_external_deps INTERFACE CAL::CAL cusolverMp::cusolverMp)
else()
target_link_libraries(abacus_external_deps INTERFACE NCCL::NCCL cusolverMp::cusolverMp)
endif()
endfunction()
3 changes: 1 addition & 2 deletions cmake/SetupNccl.cmake → cmake/modules/SetupNccl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include_guard(GLOBAL)

include(CheckIncludeFileCXX)

function(abacus_setup_nccl target_name)
function(abacus_setup_nccl)
find_library(NCCL_LIBRARY NAMES nccl
HINTS ${NCCL_PATH} ${NVHPC_ROOT_DIR}
PATH_SUFFIXES lib lib64 comm_libs/nccl/lib)
Expand Down Expand Up @@ -39,5 +39,4 @@ function(abacus_setup_nccl target_name)
endif()
endif()

target_link_libraries(abacus_external_deps INTERFACE NCCL::NCCL)
endfunction()
4 changes: 3 additions & 1 deletion python/pyabacus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ set(NAO_PATH "${ABACUS_SOURCE_DIR}/source_basis/module_nao")
set(HSOLVER_PATH "${ABACUS_SOURCE_DIR}/source_hsolver")
set(PSI_PATH "${ABACUS_SOURCE_DIR}/source_psi")
set(ENABLE_LCAO ON)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake")
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/../../cmake"
"${PROJECT_SOURCE_DIR}/../../cmake/modules")

# add math_libs
if(DEFINED ENV{MKLROOT} AND NOT DEFINED MKLROOT)
Expand Down
4 changes: 3 additions & 1 deletion python/pyabacus/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ set(NAO_PATH "${ABACUS_SOURCE_DIR}/source_basis/module_nao")
set(HSOLVER_PATH "${ABACUS_SOURCE_DIR}/source_hsolver")
set(PSI_PATH "${ABACUS_SOURCE_DIR}/source_psi")
set(ENABLE_LCAO ON)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake")
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/../../cmake"
"${PROJECT_SOURCE_DIR}/../../cmake/modules")
```
- This section sets various source paths and configuration options. It defines the paths to different modules and appends the custom CMake module path.

Expand Down
Loading
Loading