Skip to content

Commit b3c3ddb

Browse files
authored
Merge branch 'develop' into v2-2026-07-24
2 parents 7cc357b + 83c89c4 commit b3c3ddb

95 files changed

Lines changed: 655 additions & 439 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/cuda.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,15 @@ jobs:
7474
run: |
7575
cd tests/16_SDFT_GPU
7676
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
77+
78+
- name: Test 01_PW on GPU
79+
run: |
80+
cd tests/01_PW
81+
find . -name INPUT | while read f; do
82+
if grep -q "^device" "$f"; then
83+
sed -i 's/^device.*/device gpu/' "$f"
84+
else
85+
echo "device gpu" >> "$f"
86+
fi
87+
done
88+
bash ../integrate/Autotest.sh -n 1 -a abacus -f CASES_GPU.txt

.github/workflows/interface.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: actions/checkout@v7
3838

3939
- name: Set up Python 3.10
40-
uses: actions/setup-python@v6
40+
uses: actions/setup-python@v7
4141
with:
4242
python-version: "3.10"
4343

.github/workflows/pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v7
1919
- name: Set up Python
20-
uses: actions/setup-python@v6
20+
uses: actions/setup-python@v7
2121
with:
2222
python-version: 3.8
2323
- name: Build Pyabacus

CMakeLists.txt

Lines changed: 7 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ option(ENABLE_CNPY "Enable cnpy usage" OFF)
6868
cmake_dependent_option(ENABLE_ELPA "Enable ELPA for LCAO" ON "ENABLE_LCAO;ENABLE_MPI" OFF)
6969
cmake_dependent_option(ENABLE_LIBRI "Enable LibRI for hybrid functional"
7070
OFF "ENABLE_LCAO;ENABLE_MPI" OFF)
71-
cmake_dependent_option(ENABLE_EXX_DEV "Enable LibRI developing features" OFF "ENABLE_LIBRI" OFF)
7271
cmake_dependent_option(ENABLE_PEXSI "Enable PEXSI for LCAO" OFF "ENABLE_LCAO;ENABLE_MPI" OFF)
7372
cmake_dependent_option(ENABLE_MLALGO "Enable the machine learning algorithms"
7473
OFF "ENABLE_LCAO;ENABLE_MPI" OFF)
7574

75+
# EXX_DEV works with libRI PR#10 which is not merged into main branch; disabling it
76+
# cmake_dependent_option(ENABLE_EXX_DEV "Enable LibRI developing features" OFF "ENABLE_LIBRI" OFF)
77+
7678
# Two-center FFT is only used in LCAO
7779
cmake_dependent_option(ENABLE_FFT_TWO_CENTER "Enable FFT-based two-center integral method"
7880
ON "ENABLE_LCAO" OFF)
@@ -136,27 +138,6 @@ if(NOT DEFINED NVHPC_ROOT_DIR AND DEFINED ENV{NVHPC_ROOT})
136138
CACHE PATH "Path to NVIDIA HPC SDK root directory.")
137139
endif()
138140

139-
# Feature definitions are collected while options and dependencies are resolved
140-
# below. They are applied to targets in source/CMakeLists.txt.
141-
set_property(GLOBAL PROPERTY ABACUS_FEATURE_DEFINITIONS "")
142-
143-
function(abacus_normalize_definitions out_var)
144-
set(_defs)
145-
foreach(_def IN LISTS ARGN)
146-
if(_def MATCHES "^-D(.+)")
147-
list(APPEND _defs "${CMAKE_MATCH_1}")
148-
else()
149-
list(APPEND _defs "${_def}")
150-
endif()
151-
endforeach()
152-
set(${out_var} ${_defs} PARENT_SCOPE)
153-
endfunction()
154-
155-
function(abacus_add_feature_definitions)
156-
abacus_normalize_definitions(_defs ${ARGN})
157-
set_property(GLOBAL APPEND PROPERTY ABACUS_FEATURE_DEFINITIONS ${_defs})
158-
endfunction()
159-
160141
# enable json support
161142
if(ENABLE_RAPIDJSON)
162143
find_package(RapidJSON CONFIG REQUIRED)
@@ -167,7 +148,6 @@ if(ENABLE_RAPIDJSON)
167148
"Check if your RapidJSON installation provides a complete exported CMake configuration."
168149
)
169150
endif()
170-
abacus_add_feature_definitions(__RAPIDJSON)
171151
endif()
172152

173153
# get commit info
@@ -193,7 +173,6 @@ if(COMMIT_INFO)
193173
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
194174
RESULT_VARIABLE GIT_COMMIT_DATE_RESULT)
195175
if(GIT_COMMIT_HASH_RESULT EQUAL 0 AND GIT_COMMIT_DATE_RESULT EQUAL 0)
196-
abacus_add_feature_definitions(COMMIT_INFO)
197176
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/commit.h"
198177
"#define COMMIT \"${GIT_COMMIT_HASH} (${GIT_COMMIT_DATE})\"\n")
199178
set(ABACUS_COMMIT_INFO_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
@@ -272,14 +251,6 @@ if (USE_DSP)
272251
set(ABACUS_BIN_NAME abacus_dsp)
273252
endif()
274253

275-
if (USE_CUDA_ON_DCU)
276-
abacus_add_feature_definitions(__CUDA_ON_DCU)
277-
endif()
278-
279-
if (USE_CUDA_MPI)
280-
abacus_add_feature_definitions(__CUDA_MPI)
281-
endif()
282-
283254
list(APPEND CMAKE_MODULE_PATH
284255
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
285256
"${PROJECT_SOURCE_DIR}/cmake/modules")
@@ -346,58 +317,25 @@ if(ENABLE_ASAN)
346317
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
347318
endif()
348319

349-
if(NOT CMAKE_BUILD_TYPE AND NOT MSVC)
350-
add_compile_options(-O3 -g)
351-
endif()
352-
353320
if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
354-
# stick to strict floating point model on Intel Compiler
355-
add_compile_options(-fp-model=strict)
356-
set(ENABLE_ABACUS_LIBM OFF) # Force turn off ENABLE_ABACUS_LIBM on Intel Compiler
357-
set(CMAKE_CXX_FLAGS
358-
"${CMAKE_CXX_FLAGS} -Wno-write-strings "
359-
)
360-
endif()
361-
362-
if(ENABLE_ABACUS_LIBM)
363-
abacus_add_feature_definitions(__ABACUS_LIBM)
364-
endif()
365-
366-
if(ENABLE_NATIVE_OPTIMIZATION)
367-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
368-
endif()
369-
370-
# Windows (native build, e.g. MinGW-w64 or MSVC) portability defines:
371-
# _USE_MATH_DEFINES - expose M_PI and friends from <cmath>
372-
# NOMINMAX - stop <windows.h> defining min()/max() macros
373-
# _CRT_SECURE_NO_WARNINGS - silence CRT "use _s function" deprecations
374-
if(WIN32)
375-
abacus_add_feature_definitions(_USE_MATH_DEFINES NOMINMAX _CRT_SECURE_NO_WARNINGS)
321+
# Force turn off ENABLE_ABACUS_LIBM on Intel Compiler
322+
message(WARNING "ENABLE_ABACUS_LIBM is not available with Intel compilers; switching it off")
323+
set(ENABLE_ABACUS_LIBM OFF)
376324
endif()
377325

378326
if(ENABLE_LCAO)
379-
abacus_add_feature_definitions(__LCAO)
380327
if(ENABLE_ELPA)
381328
find_package(ELPA REQUIRED)
382-
abacus_add_feature_definitions(__ELPA)
383-
endif()
384-
if(ENABLE_FFT_TWO_CENTER)
385-
abacus_add_feature_definitions(USE_NEW_TWO_CENTER)
386329
endif()
387330
if(ENABLE_PEXSI)
388331
find_package(PEXSI REQUIRED CONFIG)
389332
if(PEXSI_VERSION VERSION_LESS "2.0.0")
390333
message(FATAL_ERROR "PEXSI >= 2.0.0 is required")
391334
endif()
392-
abacus_add_feature_definitions(__PEXSI)
393335
set(CMAKE_CXX_STANDARD 14)
394336
endif()
395337
endif()
396338

397-
if(DEBUG_INFO)
398-
abacus_add_feature_definitions(__DEBUG)
399-
endif()
400-
401339
if(ENABLE_MPI)
402340
if(NOT CMAKE_CROSSCOMPILING)
403341
# FindMPI runs a probe executable to determine the MPI library version,
@@ -406,18 +344,9 @@ if(ENABLE_MPI)
406344
set(MPI_DETERMINE_LIBRARY_VERSION TRUE)
407345
endif()
408346
find_package(MPI COMPONENTS CXX REQUIRED)
409-
abacus_add_feature_definitions(__MPI)
410-
endif()
411-
412-
413-
if (USE_DSP)
414-
abacus_add_feature_definitions(__DSP)
415347
endif()
416348

417-
418-
419-
if (USE_SW)
420-
abacus_add_feature_definitions(__SW)
349+
if(USE_SW)
421350
set(SW ON)
422351
endif()
423352

@@ -440,10 +369,8 @@ if(USE_KML)
440369
endif()
441370

442371
find_package(KML REQUIRED COMPONENTS ${_kml_components})
443-
abacus_add_feature_definitions(__KML)
444372
elseif(MKLROOT OR MKL_ROOT)
445373
find_package(MKL REQUIRED)
446-
abacus_add_feature_definitions(__MKL)
447374
elseif(NOT USE_SW)
448375
find_package(Lapack REQUIRED)
449376
# ScaLAPACK is a distributed-memory library and is only needed for the
@@ -538,16 +465,7 @@ if(USE_CUDA)
538465
endif()
539466
enable_language(CUDA)
540467
if(USE_CUDA)
541-
abacus_add_feature_definitions(__CUDA)
542-
abacus_add_feature_definitions(__UT_USE_CUDA)
543-
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
544-
set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G" CACHE STRING "CUDA flags for debug build" FORCE)
545-
endif()
546-
if (ENABLE_OPENMP AND OpenMP_CXX_FOUND)
547-
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS}" CACHE STRING "CUDA flags" FORCE)
548-
endif()
549468
if (ENABLE_NCCL_PARALLEL_DEVICE)
550-
abacus_add_feature_definitions(__NCCL_PARALLEL_DEVICE)
551469
include(cmake/modules/SetupNccl.cmake)
552470
abacus_setup_nccl()
553471
endif()
@@ -616,9 +534,6 @@ if(USE_ROCM)
616534
)
617535
endif()
618536

619-
abacus_add_feature_definitions(__ROCM)
620-
abacus_add_feature_definitions(__UT_USE_ROCM)
621-
abacus_add_feature_definitions(__HIP_PLATFORM_HCC__)
622537
endif()
623538

624539
if(ENABLE_ASAN)
@@ -632,10 +547,6 @@ if(ENABLE_ASAN)
632547
add_link_options(-fsanitize=address)
633548
endif()
634549

635-
if(ENABLE_FLOAT_FFTW)
636-
abacus_add_feature_definitions(__ENABLE_FLOAT_FFTW)
637-
endif()
638-
639550
if(ENABLE_MLALGO)
640551
find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR})
641552
if(NOT libnpy_SOURCE_DIR)
@@ -648,8 +559,6 @@ if(ENABLE_MLALGO)
648559
FetchContent_MakeAvailable(libnpy)
649560
else()
650561
endif()
651-
652-
abacus_add_feature_definitions(__MLALGO)
653562
endif()
654563

655564
# Torch uses outdated components to detect CUDA arch, causing failure on
@@ -683,7 +592,6 @@ if (ENABLE_CNPY)
683592

684593
# find ZLIB and link
685594
find_package(ZLIB REQUIRED)
686-
abacus_add_feature_definitions(__USECNPY)
687595
endif()
688596

689597
function(git_submodule_update)
@@ -714,47 +622,29 @@ if(ENABLE_LIBRI)
714622
find_package(LibRI REQUIRED)
715623
find_package(LibComm REQUIRED)
716624
find_package(cereal REQUIRED CONFIG)
717-
abacus_add_feature_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0
718-
TEST_EXX_RADIAL=1)
719-
if(ENABLE_EXX_DEV)
720-
abacus_add_feature_definitions(__EXX_DEV)
721-
endif()
722625
endif()
723626

724627
if(ENABLE_LIBXC)
725628
find_package(Libxc CONFIG REQUIRED)
726629
if(Libxc_VERSION VERSION_LESS "5.1.7")
727630
message(FATAL_ERROR "Libxc >= 5.1.7 is required")
728631
endif()
729-
abacus_add_feature_definitions(USE_LIBXC)
730632
endif()
731633

732634
if(DEFINED DeePMD_DIR)
733-
abacus_add_feature_definitions(__DPMD HIGH_PREC)
734-
add_compile_options(-Wl,--no-as-needed)
735635
find_package(DeePMD REQUIRED)
736-
if(DeePMDC_FOUND)
737-
abacus_add_feature_definitions(__DPMDC)
738-
endif()
739636
endif()
740637

741638
if(DEFINED NEP_DIR)
742639
find_package(NEP REQUIRED)
743-
744-
if(NEP_FOUND)
745-
abacus_add_feature_definitions(__NEP)
746-
endif()
747640
endif()
748641

749642
if(DEFINED TensorFlow_DIR)
750643
find_package(TensorFlow REQUIRED)
751644
endif()
752645

753-
abacus_add_feature_definitions(__FFTW3 __SELINV METIS)
754-
755646
if(MATH_INFO)
756647
message(STATUS "Will gather math lib info.")
757-
abacus_add_feature_definitions(GATHER_INFO)
758648
# modifications on blas_connector and lapack_connector
759649
endif()
760650

cmake/CompilerConfiguration.cmake

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
include(CheckCXXCompilerFlag)
2+
3+
# Match the existing fallback when no build type is specified, but keep the
4+
# options scoped to ABACUS targets.
5+
if(NOT CMAKE_BUILD_TYPE AND NOT MSVC)
6+
target_compile_options(abacus_compile_requirements INTERFACE -O3 -g)
7+
endif()
8+
9+
target_compile_options(abacus_compile_requirements INTERFACE
10+
"$<$<COMPILE_LANG_AND_ID:CXX,Intel,IntelLLVM>:-fp-model=strict;-Wno-write-strings>")
11+
12+
if(ENABLE_NATIVE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
13+
set(_abacus_native_candidates)
14+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
15+
OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
16+
set(_abacus_native_candidates -march=native -mcpu=native)
17+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
18+
set(_abacus_native_candidates -xHOST)
19+
endif()
20+
foreach(_flag IN LISTS _abacus_native_candidates)
21+
string(MAKE_C_IDENTIFIER "ABACUS_HAS_${_flag}" _var)
22+
check_cxx_compiler_flag("${_flag}" ${_var})
23+
if(${_var})
24+
target_compile_options(abacus_compile_requirements INTERFACE
25+
"$<$<COMPILE_LANGUAGE:CXX>:${_flag}>")
26+
break()
27+
endif()
28+
endforeach()
29+
endif()
30+
31+
if(USE_CUDA)
32+
target_compile_options(abacus_compile_requirements INTERFACE
33+
"$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>>:-g;-G>")
34+
if(ENABLE_OPENMP AND OpenMP_CXX_FOUND)
35+
separate_arguments(_abacus_openmp_cxx_flags NATIVE_COMMAND
36+
"${OpenMP_CXX_FLAGS}")
37+
foreach(_flag IN LISTS _abacus_openmp_cxx_flags)
38+
target_compile_options(abacus_compile_requirements INTERFACE
39+
"$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:-Xcompiler=${_flag}>")
40+
endforeach()
41+
endif()
42+
endif()
43+
44+
unset(_abacus_native_candidates)
45+
unset(_abacus_openmp_cxx_flags)
46+
unset(_flag)
47+
unset(_var)

cmake/modules/SetupCuBlasMp.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
include_guard(GLOBAL)
66

77
function(abacus_setup_cublasmp)
8-
abacus_add_feature_definitions(__CUBLASMP)
9-
108
# 1. Search for cuBLASMp library and header files
119
# libcublasmp.so
1210
find_library(CUBLASMP_LIBRARY NAMES cublasmp

cmake/modules/SetupCuSolverMp.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
include_guard(GLOBAL)
66

77
function(abacus_setup_cusolvermp)
8-
abacus_add_feature_definitions(__CUSOLVERMP)
9-
108
# Find cuSOLVERMp first, then decide communicator backend.
119
find_library(CUSOLVERMP_LIBRARY NAMES cusolverMp
1210
HINTS ${CAL_CUSOLVERMP_PATH} ${NVHPC_ROOT_DIR}
@@ -82,8 +80,6 @@ function(abacus_setup_cusolvermp)
8280
# - _use_cal=ON -> cal communicator backend
8381
# - _use_cal=OFF -> NCCL communicator backend
8482
if(_use_cal)
85-
abacus_add_feature_definitions(__USE_CAL)
86-
8783
find_library(CAL_LIBRARY NAMES cal
8884
HINTS ${CAL_CUSOLVERMP_PATH} ${NVHPC_ROOT_DIR}
8985
PATH_SUFFIXES lib lib64 math_libs/lib64)

0 commit comments

Comments
 (0)