Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/build_test_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:

- tag: gnu
external_toolchain_args: ""
build_args: "-DENABLE_LIBXC=ON -DENABLE_MLALGO=ON -DENABLE_LIBRI=ON -DENABLE_DFTD4=ON -DENABLE_PEXSI=ON"
build_args: "-DENABLE_LIBXC=ON -DENABLE_MLALGO=ON -DENABLE_LIBRI=ON -DENABLE_DFTD4=ON -DENABLE_PEXSI=ON -DENABLE_JSON=ON"
name: "Build extra components with GNU toolchain"
- tag: intel
external_toolchain_args: "--with-intel"
build_args: "-DENABLE_LIBXC=ON -DENABLE_MLALGO=ON -DENABLE_LIBRI=ON -DENABLE_DFTD4=ON"
build_args: "-DENABLE_LIBXC=ON -DENABLE_MLALGO=ON -DENABLE_LIBRI=ON -DENABLE_DFTD4=ON -DENABLE_JSON=ON"
name: "Build extra components with Intel toolchain"

- tag: cuda
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_test_makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Build
# TODO: Remove nlohmann-json installation here since Dockerfile will have installed it.
run: |
apt update && apt install -y nlohmann-json3-dev
export I_MPI_CXX=icpx
chmod a+x generate_build_info.sh
cd source
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
-DENABLE_LIBXC=ON \
-DENABLE_LIBRI=ON \
-DENABLE_GOOGLEBENCH=ON \
-DENABLE_RAPIDJSON=ON \
-DENABLE_JSON=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
-DENABLE_LIBXC=ON \
-DENABLE_LIBRI=ON \
-DENABLE_GOOGLEBENCH=ON \
-DENABLE_RAPIDJSON=ON \
-DENABLE_JSON=ON \
-DENABLE_FLOAT_FFTW=ON \
-DENABLE_DFTD4=ON \
-DENABLE_PEXSI=ON \
Expand Down
25 changes: 13 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ option(ENABLE_NATIVE_OPTIMIZATION

option(COMMIT_INFO "Print commit information in log" ON)
option(ENABLE_GOOGLEBENCH "Enable GOOGLE-benchmark usage" OFF)
option(ENABLE_RAPIDJSON "Enable rapid-json usage" OFF)
option(ENABLE_JSON "Enable JSON output" OFF)
Comment thread
Growl1234 marked this conversation as resolved.
option(ENABLE_CNPY "Enable cnpy usage" OFF)

# Options requiring MPI and LCAO
Expand Down Expand Up @@ -110,6 +110,14 @@ abacus_rename_option(USE_OPENMP ENABLE_OPENMP)
abacus_rename_option(USE_ABACUS_LIBM ENABLE_ABACUS_LIBM)
abacus_rename_option(INFO MATH_INFO)

if(DEFINED CACHE{ENABLE_RAPIDJSON})
message(
FATAL_ERROR
"ENABLE_RAPIDJSON is no longer supported. "
"ABACUS now uses nlohmann-json as its JSON backend; "
"please use -DENABLE_JSON=ON instead.")
endif()

if(DEFINED CACHE{ENABLE_LIBCOMM})
message(
DEPRECATION
Expand Down Expand Up @@ -139,15 +147,8 @@ if(NOT DEFINED NVHPC_ROOT_DIR AND DEFINED ENV{NVHPC_ROOT})
endif()

# enable json support
if(ENABLE_RAPIDJSON)
find_package(RapidJSON CONFIG REQUIRED)
if(NOT TARGET RapidJSON)
message(
FATAL_ERROR
"RapidJSON was found, but target RapidJSON is missing. "
"Check if your RapidJSON installation provides a complete exported CMake configuration."
)
endif()
if(ENABLE_JSON)
find_package(nlohmann_json REQUIRED)
endif()

# get commit info
Expand Down Expand Up @@ -284,8 +285,8 @@ if(CCACHE)
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE} ${CMAKE_CUDA_COMPILER_LAUNCHER})
endif()

# Choose build type from: Debug Release RelWithDebInfo MinSizeRel Select
# 'Release' configuration for best performance; this will disable all
# Choose build type from: Debug Release RelWithDebInfo MinSizeRel
# Select 'Release' configuration for best performance; this will disable all
# assertions. Other default configurations are also available, see:
# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#default-and-custom-configurations
# For default flags, see:
Expand Down
12 changes: 2 additions & 10 deletions Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM nvidia/cuda:12.2.0-devel-ubuntu22.04

RUN apt update && apt install -y --no-install-recommends \
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libfftw3-dev libcereal-dev \
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy ca-certificates \
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy ca-certificates nlohmann-json3-dev \
bc cmake git g++ make time sudo unzip vim wget libopenmpi-dev gfortran libtool-bin && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -25,19 +25,11 @@ RUN cd /tmp && \
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
cd /tmp && rm -rf elpa-$ELPA_VER

# RapidJSON
RUN cd /tmp && \
wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz && \
tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a && \
cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF && \
cmake --build build --target install && \
cd /tmp && rm -rf rapidjson-24b5e7a rapidjson-24b5e7a.tar.gz

ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null

RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
cd abacus-develop && \
cmake -B build -DUSE_CUDA=ON -DENABLE_RAPIDJSON=ON && \
cmake -B build -DUSE_CUDA=ON -DENABLE_JSON=ON && \
cmake --build build -j $(nproc) && \
cmake --install build && \
rm -rf build && \
Expand Down
12 changes: 2 additions & 10 deletions Dockerfile.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FROM ubuntu:22.04
RUN apt update && apt install -y --no-install-recommends \
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev \
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy \
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy nlohmann-json3-dev \
libmetis-dev libparmetis-dev libsuperlu-dist-dev \
bc cmake git g++ make time sudo unzip vim wget gfortran ca-certificates && \
rm -rf /var/lib/apt/lists/*
Expand All @@ -28,14 +28,6 @@ RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-wit
--quiet -O libtorch.zip && \
unzip -q libtorch.zip -d /opt && rm libtorch.zip

# RapidJSON
RUN cd /tmp && \
wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz && \
tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a && \
cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF && \
cmake --build build --target install && \
cd /tmp && rm -r rapidjson-24b5e7a rapidjson-24b5e7a.tar.gz

ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake

# PEXSI
Expand All @@ -56,7 +48,7 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve

RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
cd abacus-develop && \
cmake -B build -DENABLE_MLALGO=ON -DENABLE_PEXSI=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
cmake -B build -DENABLE_MLALGO=ON -DENABLE_PEXSI=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_JSON=ON && \
cmake --build build -j $(nproc) && \
cmake --install build && \
rm -rf build
Expand Down
12 changes: 2 additions & 10 deletions Dockerfile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM intel/oneapi-hpckit:2025.2.2-0-devel-ubuntu22.04

RUN apt-get update && apt-get install -y \
bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \
libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \
libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev nlohmann-json3-dev \
pkg-config build-essential autoconf automake libtool ca-certificates && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -22,14 +22,6 @@ RUN cd /tmp && \
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
cd /tmp && rm -rf elpa-$ELPA_VER

# RapidJSON
RUN cd /tmp && \
wget --quiet https://codeload.github.com/Tencent/rapidjson/tar.gz/24b5e7a -O rapidjson-24b5e7a.tar.gz && \
tar -xzf rapidjson-24b5e7a.tar.gz && cd rapidjson-24b5e7a && \
cmake -B build -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF && \
cmake --build build --target install && \
cd /tmp && rm -r rapidjson-24b5e7a rapidjson-24b5e7a.tar.gz

# LibTorch (Note: Using pre-built Torch library with MKL might cause issues)
RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \
unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip
Expand All @@ -43,7 +35,7 @@ RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --de
-DENABLE_MLALGO=ON \
-DENABLE_LIBXC=ON \
-DENABLE_LIBRI=ON \
-DENABLE_RAPIDJSON=ON \
-DENABLE_JSON=ON \
-DCMAKE_BUILD_TYPE=Release && \
cmake --build build -j $(nproc) && \
cmake --install build && \
Expand Down
10 changes: 4 additions & 6 deletions cmake/CollectBuildInfoVars.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,10 @@ else()
set(ABACUS_GOOGLEBENCH_VERSION "Disabled")
endif()

if(DEFINED RapidJSON_DIR AND ENABLE_RAPIDJSON)
set(ABACUS_RAPIDJSON_VERSION "yes (path: ${RapidJSON_DIR})")
elseif(ENABLE_RAPIDJSON)
set(ABACUS_RAPIDJSON_VERSION "yes (from git origin/master)")
if(ENABLE_JSON)
set(ABACUS_JSON_VERSION "yes (nlohmann-json v${nlohmann_json_VERSION})")
else()
set(ABACUS_RAPIDJSON_VERSION "no")
set(ABACUS_JSON_VERSION "no")
endif()

if(ENABLE_MLALGO)
Expand Down Expand Up @@ -458,7 +456,7 @@ if(ENABLE_EXX_DEV)
message(" (EXX developing features enabled)")
endif()
message(" DFT-D4 = ${ABACUS_DFTD4_VERSION}")
message(" RAPIDJSON = ${ABACUS_RAPIDJSON_VERSION}")
message(" JSON = ${ABACUS_JSON_VERSION}")
message(" PEXSI = ${ABACUS_PEXSI_VERSION}")
message(" CNPY = ${ABACUS_CNPY_VERSION}")
message(" -------------------------------------------------------------------")
Expand Down
4 changes: 4 additions & 0 deletions docs/advanced/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ vdw_d4_model d4 # or d4s for the smooth D4S model

If `vdw_d4_xc` is set to `default`, ABACUS will infer the functional name from `dft_functional` or pseudopotential metadata and pass it to the DFT-D4 library. The `vdw_d4_model` keyword selects the dispersion model inside the DFT-D4 library; the default is `d4`, while `d4s` enables the smooth D4S model.

## Build with JSON support

ABACUS uses [nlohmann-json](https://github.com/nlohmann/json) for optional JSON output. To build ABACUS with JSON support, pass `-DENABLE_JSON=ON` to CMake.

## Build Unit Tests

To build tests for ABACUS, define `BUILD_TESTING` flag. You can also specify path to local installation of [Googletest](https://github.com/google/googletest) by setting `GTEST_DIR` flags. If not found in local, the configuration process will try to download it automatically.
Expand Down
Loading
Loading