From 0d9f3a07bcc0d4c70d1404c4b6571036b53966ea Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:21:52 +0800 Subject: [PATCH 01/26] Toolchain: backport 202503 baseline to LTS Partial cherry-pick from 388226b1e. Excludes forbidden NEP/libtorch installer changes and keeps changes scoped to toolchain. --- toolchain/README.md | 16 ++++++++-------- toolchain/build_abacus_aocc-aocl.sh | 4 +++- toolchain/build_abacus_gcc-aocl.sh | 4 +++- toolchain/build_abacus_gnu.sh | 6 ++++-- toolchain/build_abacus_intel.sh | 6 ++++-- toolchain/install_abacus_toolchain_new.sh | 7 ++++--- toolchain/scripts/lib/config_manager.sh | 9 --------- toolchain/scripts/lib/user_interface.sh | 9 --------- toolchain/scripts/stage2/install_aocl.sh | 6 +++--- toolchain/scripts/stage2/install_openblas.sh | 2 +- toolchain/scripts/stage3/install_elpa.sh | 8 ++------ toolchain/scripts/tool_kit.sh | 5 +---- toolchain/toolchain_aocc-aocl.sh | 11 ++++------- toolchain/toolchain_gcc-aocl.sh | 5 +---- toolchain/toolchain_gnu.sh | 4 +--- toolchain/toolchain_intel.sh | 5 +---- 16 files changed, 40 insertions(+), 67 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index 5f45417bd73..48cfe7d1bea 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -1,4 +1,4 @@ -# ABACUS Toolchain (for LTS) +# ABACUS Toolchain [![Version](https://img.shields.io/badge/version-2025.3-blue.svg)](https://github.com/deepmodeling/abacus-develop/tree/develop/toolchain) [![License](https://img.shields.io/badge/license-GPL--compatible-green.svg)](#license) @@ -124,7 +124,7 @@ Before running the toolchain, please make sure you have loaded the related envir - [LibNPY](https://github.com/llohse/libnpy) - NumPy I/O for C++ - [LibRI](https://github.com/abacusmodeling/LibRI) - Resolution of Identity library - [LibComm](https://github.com/abacusmodeling/LibComm) - Communication library - - [NEP](https://github.com/brucefan1983/NEP_CPU) - Neuroevolution Potential (Not Supported) + - [NEP](https://github.com/brucefan1983/NEP_CPU) - Neuroevolution Potential - [Cereal](https://github.com/USCiLab/cereal) - C++ serialization library - [RapidJSON](https://github.com/Tencent/rapidjson) - Fast JSON parser/generator - **Reference mirror:** [CP2K static downloads](https://www.cp2k.org/static/downloads) @@ -151,21 +151,21 @@ Mix online and offline packages as needed - the toolchain automatically detects ## Supported Toolchains ### GNU Toolchain -- **Compilers**: System GCC (≥5.0) or installed GCC +- **Compilers**: System GCC (≥5.0) - **MPI**: OpenMPI or MPICH - **Math**: OpenBLAS + ScaLAPACK - **Features**: Most stable, widely compatible ### Intel Toolchain -- **Compilers**: Intel OneAPI (icx/icpx/ifx or classic icc/icpc/ifort) with system/installed GCC (≥5.0) +- **Compilers**: Intel OneAPI (icx/icpx/ifx or classic icc/icpc/ifort) - **MPI**: Intel MPI - **Math**: Intel MKL -- **Features**: Optimized performance for Intel Machine +- **Features**: Optimized performance, EXX support ### AMD Toolchain -- **Compilers**: AMD AOCC or system/installed GCC +- **Compilers**: AMD AOCC or GCC - **Math**: AMD AOCL (Optimized math libraries) -- **Features**: AMD processor optimization (e.g., Zen3+) +- **Features**: AMD processor optimization ## Dependencies @@ -193,7 +193,7 @@ Mix online and offline packages as needed - the toolchain automatically detects | LibComm | master | EXX calculations | GPL-3.0 | Install | | LibTorch | 2.1.2 / 1.12.1 | MLALGO support | BSD-3-Clause | Optional | | LibNPY | 1.0.1 / 1.0.1 | NumPy I/O | MIT | Optional | -| NEP | main | Neuroevolution potential | MIT | Not Supported | +| NEP | main | Neural network potential | MIT | Optional | Also, [Intel-oneAPI](https://www.intel.cn/content/www/cn/zh/developer/tools/oneapi/toolkits.html) and AMD [AOCC](https://www.amd.com/zh-cn/developer/aocc.html) and [AOCL](https://www.amd.com/zh-cn/developer/aocl.html) are supported in toolchain by setting them to system option, but one should install them manually by server administrator. diff --git a/toolchain/build_abacus_aocc-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh index d8b4396f3d5..a586442421b 100755 --- a/toolchain/build_abacus_aocc-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -33,6 +33,7 @@ FFTW3=$AOCLhome LIBRI=$INSTALL_DIR/LibRI-master LIBCOMM=$INSTALL_DIR/LibComm-master USE_CUDA=OFF # set ON to enable gpu-abacus +# NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd @@ -59,7 +60,8 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DENABLE_DEEPKS=1 \ +# -DNEP_DIR=$NEP_DIR \ +# -DENABLE_MLALGO=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ # -DDeePMD_DIR=$DEEPMD \ diff --git a/toolchain/build_abacus_gcc-aocl.sh b/toolchain/build_abacus_gcc-aocl.sh index 71e03278742..65e2491ee90 100755 --- a/toolchain/build_abacus_gcc-aocl.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -33,6 +33,7 @@ FFTW3=$AOCLhome LIBRI=$INSTALL_DIR/LibRI-master LIBCOMM=$INSTALL_DIR/LibComm-master USE_CUDA=OFF # set ON to enable gpu-abacus +# NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd @@ -57,7 +58,8 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DENABLE_DEEPKS=1 \ +# -DNEP_DIR=$NEP_DIR \ +# -DENABLE_MLALGO=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ # -DDeePMD_DIR=$DEEPMD \ diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index f9487ed3ebe..b373ca1a108 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash #SBATCH -J build_abacus_gnu #SBATCH -N 1 #SBATCH -n 16 @@ -31,6 +31,7 @@ RAPIDJSON=$INSTALL_DIR/rapidjson-master/ LIBRI=$INSTALL_DIR/LibRI-master LIBCOMM=$INSTALL_DIR/LibComm-master USE_CUDA=OFF # set ON to enable gpu-abacus +# NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # @@ -55,7 +56,8 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DENABLE_DEEPKS=1 \ +# -DNEP_DIR=$NEP_DIR \ +# -DENABLE_MLALGO=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ # -DDeePMD_DIR=$DEEPMD \ diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index a6a4bb21bf8..29575bf4e57 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash #SBATCH -J build_abacus_intel #SBATCH -N 1 #SBATCH -n 16 @@ -30,6 +30,7 @@ RAPIDJSON=$INSTALL_DIR/rapidjson-master LIBRI=$INSTALL_DIR/LibRI-master LIBCOMM=$INSTALL_DIR/LibComm-master USE_CUDA=OFF # set ON to enable gpu-abacus +# NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem @@ -53,7 +54,8 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DENABLE_DEEPKS=1 \ +# -DNEP_DIR=$NEP_DIR \ +# -DENABLE_MLALGO=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ # -DDeePMD_DIR=$DEEPMD \ diff --git a/toolchain/install_abacus_toolchain_new.sh b/toolchain/install_abacus_toolchain_new.sh index c16aaf30e86..6669c87dc38 100755 --- a/toolchain/install_abacus_toolchain_new.sh +++ b/toolchain/install_abacus_toolchain_new.sh @@ -1,14 +1,15 @@ #!/bin/bash -e # ============================================================================ -# ABACUS Toolchain Installation Script (New refractored version) +# ABACUS Toolchain Installation Script (New Version - Enhanced UI) # ============================================================================ # This is the new refactored version of the ABACUS toolchain installation script. -# It provides the most main functionality as the original script but with -# improved modularity, maintainability, extensibility, and beautiful terminal output. +# It provides the same functionality as the original script but with improved +# modularity, maintainability, extensibility, and beautiful terminal output. # # Author: Quantum Misaka by Trae SOLO # Date: 2025-10-16 +# Enhanced: Beautiful terminal UI with harmonious color scheme # ============================================================================ # Set script name for error reporting diff --git a/toolchain/scripts/lib/config_manager.sh b/toolchain/scripts/lib/config_manager.sh index 6d67bf02617..3ba967c5e41 100644 --- a/toolchain/scripts/lib/config_manager.sh +++ b/toolchain/scripts/lib/config_manager.sh @@ -481,11 +481,6 @@ config_validate() { CONFIG_CACHE["ARCH_NUM"]="no" fi - # Backward compatibility: also export ARCH_NUM to environment when set - if [[ -n "${CONFIG_CACHE[ARCH_NUM]}" ]]; then - export ARCH_NUM="${CONFIG_CACHE[ARCH_NUM]}" - fi - return 0 } @@ -611,10 +606,6 @@ config_export_to_env() { for key in "${!CONFIG_CACHE[@]}"; do export "$key"="${CONFIG_CACHE[$key]}" done - - # Backward compatibility for stage scripts expecting uppercase GPU flags - # Installers (e.g., stage3/install_elpa.sh) read ENABLE_CUDA, not enable_cuda - export ENABLE_CUDA="${CONFIG_CACHE[enable_cuda]}" # Export package list variables export tool_list diff --git a/toolchain/scripts/lib/user_interface.sh b/toolchain/scripts/lib/user_interface.sh index 2c18d7bf3f2..c942379daae 100644 --- a/toolchain/scripts/lib/user_interface.sh +++ b/toolchain/scripts/lib/user_interface.sh @@ -690,15 +690,6 @@ ui_show_summary() { echo " ├─ Kernel: $(uname -r)" echo " ├─ glibc: $(ui_get_glibc_version)" echo " ├─ CPU Cores: $(nproc 2>/dev/null || echo "unknown")" - # CPU model detection - local cpu_model="unknown" - if command -v lscpu &> /dev/null; then - cpu_model=$(LC_ALL=C lscpu | awk -F: '/^Model name/{print $2}' | sed 's/^[[:space:]]*//') - fi - if [[ -z "$cpu_model" || "$cpu_model" == "unknown" ]] && [[ -r /proc/cpuinfo ]]; then - cpu_model=$(awk -F: '/model name|Hardware|Processor/{print $2; exit}' /proc/cpuinfo | sed 's/^[[:space:]]*//') - fi - echo " ├─ CPU Model: ${cpu_model}" if command -v free &> /dev/null; then local mem_gb=$(free -g | awk '/^Mem:/ {print $2}') echo " ├─ Memory: ${mem_gb}GB" diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index c2c3b10e754..e085e9877f8 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -80,9 +80,9 @@ export AOCL_ROOT="${pkg_install_dir}" export AOCL_CFLAGS="${AOCL_CFLAGS}" export AOCL_LDFLAGS="${AOCL_LDFLAGS}" export AOCL_LIBS="${AOCL_LIBS}" -export MATH_CFLAGS="\${MATH_CFLAGS} ${AOCL_CFLAGS}" -export MATH_LDFLAGS="\${MATH_LDFLAGS} ${AOCL_LDFLAGS}" -export MATH_LIBS="\${MATH_LIBS} ${AOCL_LIBS}" +export FAST_MATH_CFLAGS="\${FAST_MATH_CFLAGS} ${AOCL_CFLAGS}" +export FAST_MATH_LDFLAGS="\${FAST_MATH_LDFLAGS} ${AOCL_LDFLAGS}" +export FAST_MATH_LIBS="\${FAST_MATH_LIBS} ${AOCL_LIBS}" EOF fi diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 03da6205bc2..f2a24b1be47 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -28,7 +28,7 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "openblas" "$version_suffix" -openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" +openblas_pkg="openblas-${openblas_ver}.tar.gz" source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 50cd499452f..c5ffc770630 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -114,11 +114,9 @@ case "$with_elpa" in fi fi for TARGET in "cpu" "nvidia"; do - # Accept both uppercase and lowercase GPU enable flags for compatibility - gpu_enabled="${ENABLE_CUDA:-${enable_cuda}}" - [ "$TARGET" = "nvidia" ] && [ "$gpu_enabled" != "__TRUE__" ] && continue + [ "$TARGET" = "nvidia" ] && [ "$ENABLE_CUDA" != "__TRUE__" ] && continue # disable cpu if cuda is enabled, only install one - [ "$TARGET" != "nvidia" ] && [ "$gpu_enabled" = "__TRUE__" ] && continue + [ "$TARGET" != "nvidia" ] && [ "$ENABLE_CUDA" = "__TRUE__" ] && continue # extend the pkg_install_dir by TARGET # this linking method is totally different from cp2k toolchain # for cp2k, ref https://github.com/cp2k/cp2k/commit/6fe2fc105b8cded84256248f68c74139dd8fc2e9 @@ -141,7 +139,6 @@ case "$with_elpa" in --with-cuda-path=${CUDA_PATH:-${CUDA_HOME:-/CUDA_HOME-notset}} \ --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --with-NVIDIA-GPU-compute-capability=$([ "$TARGET" = "nvidia" ] && echo "sm_$ARCH_NUM" || echo "sm_70") \ - --enable-nvidia-cub --with-cusolver \ OMPI_MCA_plm_rsh_agent=/bin/false \ FC=${MPIFC} \ CC=${MPICC} \ @@ -173,7 +170,6 @@ case "$with_elpa" in --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --with-cuda-path=${CUDA_PATH:-${CUDA_HOME:-/CUDA_HOME-notset}} \ --with-NVIDIA-GPU-compute-capability=$([ "$TARGET" = "nvidia" ] && echo "sm_$ARCH_NUM" || echo "sm_70") \ - --enable-nvidia-cub --with-cusolver \ FC=${MPIFC} \ CC=${MPICC} \ CXX=${MPICXX} \ diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 8c288ec2722..15d97d3e2d9 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -956,7 +956,6 @@ download_pkg_from_url() { "strict") echo "Downloading with strict certificate validation: $__url" if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then - rm -f "$__filename" report_error "failed to download $__url (strict certificate validation)" recommend_offline_installation "$__filename" "$__url" if [ "${PACK_RUN}" != "__TRUE__" ]; then @@ -967,7 +966,6 @@ download_pkg_from_url() { "skip") echo "Downloading with certificate validation disabled: $__url" if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then - rm -f "$__filename" report_error "failed to download $__url" recommend_offline_installation "$__filename" "$__url" if [ "${PACK_RUN}" != "__TRUE__" ]; then @@ -978,12 +976,11 @@ download_pkg_from_url() { "smart"|*) # Smart fallback: try with certificate validation first, then without echo "Attempting secure download: $__url" - if wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then + if wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" 2>/dev/null; then echo "Download successful with certificate validation" else echo "Certificate validation failed, retrying without certificate check..." if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then - rm -f "$__filename" report_error "failed to download $__url (both secure and insecure attempts failed)" recommend_offline_installation "$__filename" "$__url" if [ "${PACK_RUN}" != "__TRUE__" ]; then diff --git a/toolchain/toolchain_aocc-aocl.sh b/toolchain/toolchain_aocc-aocl.sh index 5d271d8f21c..32a80fe177f 100755 --- a/toolchain/toolchain_aocc-aocl.sh +++ b/toolchain/toolchain_aocc-aocl.sh @@ -39,10 +39,10 @@ WITH_RAPIDJSON="install" WITH_LIBRI="install" WITH_LIBCOMM="install" -# Optional Features (MLALGO support) -WITH_LIBTORCH="no" -WITH_LIBNPY="no" -WITH_NEP="no" # Not Supported in LTS +# Optional Features (DeepKS support) +WITH_LIBTORCH="no" # Set to "install" for DeepKS support +WITH_LIBNPY="no" # Set to "install" for DeepKS support +WITH_NEP="no" # AMD Compiler Options WITH_FLANG="no" # Flang is not recommended in current stage @@ -71,10 +71,7 @@ CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 -# Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) -# Note: main(2.1.2) version of LibTorch need glibc > 2.27 -# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # Note: AOCC-AOCL toolchain uses AOCL for math libraries (FFTW, ScaLAPACK) # so OpenBLAS and ScaLAPACK version selections are not applicable diff --git a/toolchain/toolchain_gcc-aocl.sh b/toolchain/toolchain_gcc-aocl.sh index 4580222dd14..bd342a85abd 100755 --- a/toolchain/toolchain_gcc-aocl.sh +++ b/toolchain/toolchain_gcc-aocl.sh @@ -42,7 +42,7 @@ WITH_LIBCOMM="install" # Optional Features (MLALGO support) WITH_LIBTORCH="no" WITH_LIBNPY="no" -WITH_NEP="no" # Not Supported in LTS +WITH_NEP="no" # ELPA-GPU Support (uncomment and modify as needed) # ENABLE_CUDA="yes" @@ -68,10 +68,7 @@ CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 -# Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) -# Note: main(2.1.2) version of LibTorch need glibc > 2.27 -# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # Note: GCC-AOCL toolchain uses AOCL for math libraries (FFTW, ScaLAPACK) # so OpenBLAS and ScaLAPACK version selections are not applicable diff --git a/toolchain/toolchain_gnu.sh b/toolchain/toolchain_gnu.sh index 34b7fc4b14f..df41de31fa7 100755 --- a/toolchain/toolchain_gnu.sh +++ b/toolchain/toolchain_gnu.sh @@ -42,7 +42,7 @@ WITH_LIBCOMM="install" # Optional Features (MLALGO support) WITH_LIBTORCH="no" WITH_LIBNPY="no" -WITH_NEP="no" # Not Supported in LTS +WITH_NEP="no" # ELPA-GPU Support (uncomment and modify as needed) # ENABLE_CUDA="yes" @@ -72,8 +72,6 @@ LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 SCALAPACK_VERSION="main" # main=2.2.2, alt=2.2.1 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) -# Note: main(2.1.2) version of LibTorch need glibc > 2.27 -# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # ============================================================================ # Execute Installation (DO NOT MODIFY BELOW THIS LINE) diff --git a/toolchain/toolchain_intel.sh b/toolchain/toolchain_intel.sh index ffcc62abd53..acd6f38ead3 100755 --- a/toolchain/toolchain_intel.sh +++ b/toolchain/toolchain_intel.sh @@ -43,7 +43,7 @@ WITH_LIBCOMM="install" # Optional Features (MLALGO support) WITH_LIBTORCH="no" WITH_LIBNPY="no" -WITH_NEP="no" # Not Supported in LTS +WITH_NEP="no" # ELPA-GPU Support (uncomment and modify as needed) # ENABLE_CUDA="yes" @@ -87,10 +87,7 @@ INTELMPI_CLASSIC="no" # Set to "yes" to use classic Intel MPI wrappers (mpiicc CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 ELPA_VERSION="alt" # main=2025.06.001, alt=2024.05.001 for intel oneapi<2024.2 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 -# Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) -# Note: main(2.1.2) version of LibTorch need glibc > 2.27 -# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # Note: Intel toolchain uses MKL for math libraries (FFTW, ScaLAPACK) # so OpenBLAS, FFTW, and ScaLAPACK version selections are not applicable From 76a89b98085b633249b3f166a8383456897c20c1 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:26 +0800 Subject: [PATCH 02/26] Backport: [Toolchain] Fix AOCL linking problem and other ver-202503 patch (#6623) Partial cherry-pick from e43b1cd5a. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- toolchain/README.md | 12 ++++++------ toolchain/install_abacus_toolchain_new.sh | 7 +++---- toolchain/scripts/lib/user_interface.sh | 9 +++++++++ toolchain/scripts/stage2/install_aocl.sh | 6 +++--- toolchain/scripts/tool_kit.sh | 3 +++ toolchain/toolchain_aocc-aocl.sh | 9 ++++++--- toolchain/toolchain_gcc-aocl.sh | 3 +++ toolchain/toolchain_gnu.sh | 2 ++ toolchain/toolchain_intel.sh | 3 +++ 9 files changed, 38 insertions(+), 16 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index 48cfe7d1bea..8727e7f35d6 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -151,21 +151,21 @@ Mix online and offline packages as needed - the toolchain automatically detects ## Supported Toolchains ### GNU Toolchain -- **Compilers**: System GCC (≥5.0) +- **Compilers**: System GCC (≥5.0) or installed GCC - **MPI**: OpenMPI or MPICH - **Math**: OpenBLAS + ScaLAPACK - **Features**: Most stable, widely compatible ### Intel Toolchain -- **Compilers**: Intel OneAPI (icx/icpx/ifx or classic icc/icpc/ifort) +- **Compilers**: Intel OneAPI (icx/icpx/ifx or classic icc/icpc/ifort) with system/installed GCC (≥5.0) - **MPI**: Intel MPI - **Math**: Intel MKL -- **Features**: Optimized performance, EXX support +- **Features**: Optimized performance for Intel Machine ### AMD Toolchain -- **Compilers**: AMD AOCC or GCC +- **Compilers**: AMD AOCC or system/installed GCC - **Math**: AMD AOCL (Optimized math libraries) -- **Features**: AMD processor optimization +- **Features**: AMD processor optimization (e.g., Zen3+) ## Dependencies @@ -193,7 +193,7 @@ Mix online and offline packages as needed - the toolchain automatically detects | LibComm | master | EXX calculations | GPL-3.0 | Install | | LibTorch | 2.1.2 / 1.12.1 | MLALGO support | BSD-3-Clause | Optional | | LibNPY | 1.0.1 / 1.0.1 | NumPy I/O | MIT | Optional | -| NEP | main | Neural network potential | MIT | Optional | +| NEP | main | Neuroevolution potential | MIT | Optional | Also, [Intel-oneAPI](https://www.intel.cn/content/www/cn/zh/developer/tools/oneapi/toolkits.html) and AMD [AOCC](https://www.amd.com/zh-cn/developer/aocc.html) and [AOCL](https://www.amd.com/zh-cn/developer/aocl.html) are supported in toolchain by setting them to system option, but one should install them manually by server administrator. diff --git a/toolchain/install_abacus_toolchain_new.sh b/toolchain/install_abacus_toolchain_new.sh index 6669c87dc38..c16aaf30e86 100755 --- a/toolchain/install_abacus_toolchain_new.sh +++ b/toolchain/install_abacus_toolchain_new.sh @@ -1,15 +1,14 @@ #!/bin/bash -e # ============================================================================ -# ABACUS Toolchain Installation Script (New Version - Enhanced UI) +# ABACUS Toolchain Installation Script (New refractored version) # ============================================================================ # This is the new refactored version of the ABACUS toolchain installation script. -# It provides the same functionality as the original script but with improved -# modularity, maintainability, extensibility, and beautiful terminal output. +# It provides the most main functionality as the original script but with +# improved modularity, maintainability, extensibility, and beautiful terminal output. # # Author: Quantum Misaka by Trae SOLO # Date: 2025-10-16 -# Enhanced: Beautiful terminal UI with harmonious color scheme # ============================================================================ # Set script name for error reporting diff --git a/toolchain/scripts/lib/user_interface.sh b/toolchain/scripts/lib/user_interface.sh index c942379daae..2c18d7bf3f2 100644 --- a/toolchain/scripts/lib/user_interface.sh +++ b/toolchain/scripts/lib/user_interface.sh @@ -690,6 +690,15 @@ ui_show_summary() { echo " ├─ Kernel: $(uname -r)" echo " ├─ glibc: $(ui_get_glibc_version)" echo " ├─ CPU Cores: $(nproc 2>/dev/null || echo "unknown")" + # CPU model detection + local cpu_model="unknown" + if command -v lscpu &> /dev/null; then + cpu_model=$(LC_ALL=C lscpu | awk -F: '/^Model name/{print $2}' | sed 's/^[[:space:]]*//') + fi + if [[ -z "$cpu_model" || "$cpu_model" == "unknown" ]] && [[ -r /proc/cpuinfo ]]; then + cpu_model=$(awk -F: '/model name|Hardware|Processor/{print $2; exit}' /proc/cpuinfo | sed 's/^[[:space:]]*//') + fi + echo " ├─ CPU Model: ${cpu_model}" if command -v free &> /dev/null; then local mem_gb=$(free -g | awk '/^Mem:/ {print $2}') echo " ├─ Memory: ${mem_gb}GB" diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index e085e9877f8..c2c3b10e754 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -80,9 +80,9 @@ export AOCL_ROOT="${pkg_install_dir}" export AOCL_CFLAGS="${AOCL_CFLAGS}" export AOCL_LDFLAGS="${AOCL_LDFLAGS}" export AOCL_LIBS="${AOCL_LIBS}" -export FAST_MATH_CFLAGS="\${FAST_MATH_CFLAGS} ${AOCL_CFLAGS}" -export FAST_MATH_LDFLAGS="\${FAST_MATH_LDFLAGS} ${AOCL_LDFLAGS}" -export FAST_MATH_LIBS="\${FAST_MATH_LIBS} ${AOCL_LIBS}" +export MATH_CFLAGS="\${MATH_CFLAGS} ${AOCL_CFLAGS}" +export MATH_LDFLAGS="\${MATH_LDFLAGS} ${AOCL_LDFLAGS}" +export MATH_LIBS="\${MATH_LIBS} ${AOCL_LIBS}" EOF fi diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 15d97d3e2d9..14eab2a7e28 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -956,6 +956,7 @@ download_pkg_from_url() { "strict") echo "Downloading with strict certificate validation: $__url" if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then + rm -f "$__filename" report_error "failed to download $__url (strict certificate validation)" recommend_offline_installation "$__filename" "$__url" if [ "${PACK_RUN}" != "__TRUE__" ]; then @@ -966,6 +967,7 @@ download_pkg_from_url() { "skip") echo "Downloading with certificate validation disabled: $__url" if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then + rm -f "$__filename" report_error "failed to download $__url" recommend_offline_installation "$__filename" "$__url" if [ "${PACK_RUN}" != "__TRUE__" ]; then @@ -981,6 +983,7 @@ download_pkg_from_url() { else echo "Certificate validation failed, retrying without certificate check..." if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then + rm -f "$__filename" report_error "failed to download $__url (both secure and insecure attempts failed)" recommend_offline_installation "$__filename" "$__url" if [ "${PACK_RUN}" != "__TRUE__" ]; then diff --git a/toolchain/toolchain_aocc-aocl.sh b/toolchain/toolchain_aocc-aocl.sh index 32a80fe177f..edfe1f20ae8 100755 --- a/toolchain/toolchain_aocc-aocl.sh +++ b/toolchain/toolchain_aocc-aocl.sh @@ -39,9 +39,9 @@ WITH_RAPIDJSON="install" WITH_LIBRI="install" WITH_LIBCOMM="install" -# Optional Features (DeepKS support) -WITH_LIBTORCH="no" # Set to "install" for DeepKS support -WITH_LIBNPY="no" # Set to "install" for DeepKS support +# Optional Features (MLALGO support) +WITH_LIBTORCH="no" +WITH_LIBNPY="no" WITH_NEP="no" # AMD Compiler Options @@ -71,7 +71,10 @@ CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 +# Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) +# Note: main(2.1.2) version of LibTorch need glibc > 2.27 +# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # Note: AOCC-AOCL toolchain uses AOCL for math libraries (FFTW, ScaLAPACK) # so OpenBLAS and ScaLAPACK version selections are not applicable diff --git a/toolchain/toolchain_gcc-aocl.sh b/toolchain/toolchain_gcc-aocl.sh index bd342a85abd..7a21670ab9f 100755 --- a/toolchain/toolchain_gcc-aocl.sh +++ b/toolchain/toolchain_gcc-aocl.sh @@ -68,7 +68,10 @@ CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 +# Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) +# Note: main(2.1.2) version of LibTorch need glibc > 2.27 +# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # Note: GCC-AOCL toolchain uses AOCL for math libraries (FFTW, ScaLAPACK) # so OpenBLAS and ScaLAPACK version selections are not applicable diff --git a/toolchain/toolchain_gnu.sh b/toolchain/toolchain_gnu.sh index df41de31fa7..23176722b4e 100755 --- a/toolchain/toolchain_gnu.sh +++ b/toolchain/toolchain_gnu.sh @@ -72,6 +72,8 @@ LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 SCALAPACK_VERSION="main" # main=2.2.2, alt=2.2.1 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) +# Note: main(2.1.2) version of LibTorch need glibc > 2.27 +# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # ============================================================================ # Execute Installation (DO NOT MODIFY BELOW THIS LINE) diff --git a/toolchain/toolchain_intel.sh b/toolchain/toolchain_intel.sh index acd6f38ead3..29138b6e5a3 100755 --- a/toolchain/toolchain_intel.sh +++ b/toolchain/toolchain_intel.sh @@ -87,7 +87,10 @@ INTELMPI_CLASSIC="no" # Set to "yes" to use classic Intel MPI wrappers (mpiicc CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 ELPA_VERSION="alt" # main=2025.06.001, alt=2024.05.001 for intel oneapi<2024.2 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 +# Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) +# Note: main(2.1.2) version of LibTorch need glibc > 2.27 +# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA # Note: Intel toolchain uses MKL for math libraries (FFTW, ScaLAPACK) # so OpenBLAS, FFTW, and ScaLAPACK version selections are not applicable From 60976f62b8dc6e0740da1d8bf2451d61034c1695 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:27 +0800 Subject: [PATCH 03/26] Backport: [develop][Toolchain] fix elpa-gpu installation problem in toolchain (#6632) Partial cherry-pick from 3e89604ff. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- toolchain/build_abacus_gnu.sh | 2 +- toolchain/build_abacus_intel.sh | 2 +- toolchain/scripts/lib/config_manager.sh | 9 +++++++++ toolchain/scripts/stage2/install_openblas.sh | 2 +- toolchain/scripts/stage3/install_elpa.sh | 8 ++++++-- toolchain/scripts/tool_kit.sh | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index b373ca1a108..37f5603f6ea 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e #SBATCH -J build_abacus_gnu #SBATCH -N 1 #SBATCH -n 16 diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 29575bf4e57..c347b623a1b 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e #SBATCH -J build_abacus_intel #SBATCH -N 1 #SBATCH -n 16 diff --git a/toolchain/scripts/lib/config_manager.sh b/toolchain/scripts/lib/config_manager.sh index 3ba967c5e41..6d67bf02617 100644 --- a/toolchain/scripts/lib/config_manager.sh +++ b/toolchain/scripts/lib/config_manager.sh @@ -481,6 +481,11 @@ config_validate() { CONFIG_CACHE["ARCH_NUM"]="no" fi + # Backward compatibility: also export ARCH_NUM to environment when set + if [[ -n "${CONFIG_CACHE[ARCH_NUM]}" ]]; then + export ARCH_NUM="${CONFIG_CACHE[ARCH_NUM]}" + fi + return 0 } @@ -606,6 +611,10 @@ config_export_to_env() { for key in "${!CONFIG_CACHE[@]}"; do export "$key"="${CONFIG_CACHE[$key]}" done + + # Backward compatibility for stage scripts expecting uppercase GPU flags + # Installers (e.g., stage3/install_elpa.sh) read ENABLE_CUDA, not enable_cuda + export ENABLE_CUDA="${CONFIG_CACHE[enable_cuda]}" # Export package list variables export tool_list diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index f2a24b1be47..03da6205bc2 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -28,7 +28,7 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "openblas" "$version_suffix" -openblas_pkg="openblas-${openblas_ver}.tar.gz" +openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index c5ffc770630..50cd499452f 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -114,9 +114,11 @@ case "$with_elpa" in fi fi for TARGET in "cpu" "nvidia"; do - [ "$TARGET" = "nvidia" ] && [ "$ENABLE_CUDA" != "__TRUE__" ] && continue + # Accept both uppercase and lowercase GPU enable flags for compatibility + gpu_enabled="${ENABLE_CUDA:-${enable_cuda}}" + [ "$TARGET" = "nvidia" ] && [ "$gpu_enabled" != "__TRUE__" ] && continue # disable cpu if cuda is enabled, only install one - [ "$TARGET" != "nvidia" ] && [ "$ENABLE_CUDA" = "__TRUE__" ] && continue + [ "$TARGET" != "nvidia" ] && [ "$gpu_enabled" = "__TRUE__" ] && continue # extend the pkg_install_dir by TARGET # this linking method is totally different from cp2k toolchain # for cp2k, ref https://github.com/cp2k/cp2k/commit/6fe2fc105b8cded84256248f68c74139dd8fc2e9 @@ -139,6 +141,7 @@ case "$with_elpa" in --with-cuda-path=${CUDA_PATH:-${CUDA_HOME:-/CUDA_HOME-notset}} \ --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --with-NVIDIA-GPU-compute-capability=$([ "$TARGET" = "nvidia" ] && echo "sm_$ARCH_NUM" || echo "sm_70") \ + --enable-nvidia-cub --with-cusolver \ OMPI_MCA_plm_rsh_agent=/bin/false \ FC=${MPIFC} \ CC=${MPICC} \ @@ -170,6 +173,7 @@ case "$with_elpa" in --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --with-cuda-path=${CUDA_PATH:-${CUDA_HOME:-/CUDA_HOME-notset}} \ --with-NVIDIA-GPU-compute-capability=$([ "$TARGET" = "nvidia" ] && echo "sm_$ARCH_NUM" || echo "sm_70") \ + --enable-nvidia-cub --with-cusolver \ FC=${MPIFC} \ CC=${MPICC} \ CXX=${MPICXX} \ diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 14eab2a7e28..8c288ec2722 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -978,7 +978,7 @@ download_pkg_from_url() { "smart"|*) # Smart fallback: try with certificate validation first, then without echo "Attempting secure download: $__url" - if wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" 2>/dev/null; then + if wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then echo "Download successful with certificate validation" else echo "Certificate validation failed, retrying without certificate check..." From de4d975f982afaeabe123153833edfdd609175ec Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:28 +0800 Subject: [PATCH 04/26] Backport: Update Cereal URL in FindCereal.cmake (#6722) Partial cherry-pick from b809520d6. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- cmake/FindCereal.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindCereal.cmake b/cmake/FindCereal.cmake index e32f94711ae..801420a4917 100644 --- a/cmake/FindCereal.cmake +++ b/cmake/FindCereal.cmake @@ -15,7 +15,7 @@ if(NOT CEREAL_INCLUDE_DIR) include(FetchContent) FetchContent_Declare( cereal - URL https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.0.tar.gz + URL https://codeload.github.com/MCresearch/cereal/tar.gz/master ) FetchContent_Populate(cereal) set(CEREAL_INCLUDE_DIR ${cereal_SOURCE_DIR}/include) From b2d5e3728ddf7b3c8f51c20e7aa84eb5819f697f Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:29 +0800 Subject: [PATCH 05/26] Backport: Fix: Update LibRI URL in FindLibRI.cmake to use codeload for fetching (#6723) Partial cherry-pick from 19a9e542b. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- cmake/FindLibRI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindLibRI.cmake b/cmake/FindLibRI.cmake index b8f060a483d..7fd62718c7d 100644 --- a/cmake/FindLibRI.cmake +++ b/cmake/FindLibRI.cmake @@ -16,7 +16,7 @@ if(NOT LIBRI_DIR) include(FetchContent) FetchContent_Declare( LibRI - URL https://github.com/abacusmodeling/LibRI/archive/refs/tags/v0.2.1.1.tar.gz + URL https://codeload.github.com/abacusmodeling/LibRI//tar.gz/v0.2.1.1 ) FetchContent_Populate(LibRI) set(LIBRI_DIR ${libri_SOURCE_DIR}) From 308dc7e9abdd2e6c12219eaf81faa623479ac3be Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:30 +0800 Subject: [PATCH 06/26] Backport: Toolchain: Use fixed commit hash instead of master branch (#7193) Partial cherry-pick from d26a604ee. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- cmake/FindCereal.cmake | 2 +- cmake/FindLibComm.cmake | 2 +- cmake/FindLibRI.cmake | 2 +- toolchain/scripts/package_versions.sh | 24 +++++------ toolchain/scripts/patches/6190.patch | 41 ------------------- toolchain/scripts/stage4/install_cereal.sh | 6 +-- toolchain/scripts/stage4/install_libcomm.sh | 2 +- toolchain/scripts/stage4/install_libri.sh | 2 +- toolchain/scripts/stage4/install_rapidjson.sh | 2 +- 9 files changed, 19 insertions(+), 64 deletions(-) delete mode 100644 toolchain/scripts/patches/6190.patch diff --git a/cmake/FindCereal.cmake b/cmake/FindCereal.cmake index 801420a4917..f6c5f398776 100644 --- a/cmake/FindCereal.cmake +++ b/cmake/FindCereal.cmake @@ -15,7 +15,7 @@ if(NOT CEREAL_INCLUDE_DIR) include(FetchContent) FetchContent_Declare( cereal - URL https://codeload.github.com/MCresearch/cereal/tar.gz/master + URL https://codeload.github.com/USCiLab/cereal/tar.gz/22a1b369f39be918ca79206a83c4facd759f9105 ) FetchContent_Populate(cereal) set(CEREAL_INCLUDE_DIR ${cereal_SOURCE_DIR}/include) diff --git a/cmake/FindLibComm.cmake b/cmake/FindLibComm.cmake index 9921badb93b..28016bfaa7b 100644 --- a/cmake/FindLibComm.cmake +++ b/cmake/FindLibComm.cmake @@ -16,7 +16,7 @@ if(NOT LIBCOMM_DIR) include(FetchContent) FetchContent_Declare( LibComm - URL https://github.com/abacusmodeling/LibComm/archive/refs/tags/v0.1.1.tar.gz + URL https://codeload.github.com/abacusmodeling/LibComm/tar.gz/965bf90713ce5598bae4fd957d417065f77ceb42 ) FetchContent_Populate(LibComm) set(LIBCOMM_DIR ${libcomm_SOURCE_DIR}) diff --git a/cmake/FindLibRI.cmake b/cmake/FindLibRI.cmake index 7fd62718c7d..3208a862190 100644 --- a/cmake/FindLibRI.cmake +++ b/cmake/FindLibRI.cmake @@ -16,7 +16,7 @@ if(NOT LIBRI_DIR) include(FetchContent) FetchContent_Declare( LibRI - URL https://codeload.github.com/abacusmodeling/LibRI//tar.gz/v0.2.1.1 + URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/e6d78e0504693d2a464c72b87d3240ce183fd881 ) FetchContent_Populate(LibRI) set(LIBRI_DIR ${libri_SOURCE_DIR}) diff --git a/toolchain/scripts/package_versions.sh b/toolchain/scripts/package_versions.sh index b8e689c3672..3ef4bf08dd9 100644 --- a/toolchain/scripts/package_versions.sh +++ b/toolchain/scripts/package_versions.sh @@ -99,22 +99,22 @@ libnpy_main_sha256="43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0f libnpy_alt_ver="1.0.1" libnpy_alt_sha256="43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0fba44" -# Master branch packages (no fixed versions) -cereal_ver="master" -cereal_sha256="--no-checksum" +# Branch packages cut with specific commits +cereal_ver="22a1b369f39be918ca79206a83c4facd759f9105" +cereal_sha256="ca3d544456f93ea3176eab85e2e7892063af45b20467bb4ad9c1c51068e521c6" -libcomm_ver="master" -libcomm_sha256="--no-checksum" +libcomm_ver="965bf90713ce5598bae4fd957d417065f77ceb42" +libcomm_sha256="1d1626b833c51efa7ab844af140e022e063ea64389c9e47b168c24fcc05b7323" -libri_ver="master" -libri_sha256="--no-checksum" +libri_ver="e6d78e0504693d2a464c72b87d3240ce183fd881" +libri_sha256="ead14f05b645f3d028e09f715abaa0e8fca3d1d6d61804239c4858b33397286a" -rapidjson_ver="master" -rapidjson_sha256="--no-checksum" +rapidjson_ver="24b5e7a8b27f42fa16b96fc70aade9106cf7102f" +rapidjson_sha256="2d2601a82d2d3b7e143a3c8d43ef616671391034bc46891a9816b79cf2d3e7a8" # NEP (Neural Evolution Potential) - CPU version -nep_ver="main" -nep_sha256="--no-checksum" +nep_ver="629ec5dda3127e046fde3f8082aedfca8deb915e" +nep_sha256="57803d2e98ca5c8ced09e3e8d21ac1a0dbd61dda1977997864195f8c54b9b1f9" # ============================================================================= # Package Variable Loading Function @@ -265,4 +265,4 @@ load_package_vars() { return 1 ;; esac -} \ No newline at end of file +} diff --git a/toolchain/scripts/patches/6190.patch b/toolchain/scripts/patches/6190.patch deleted file mode 100644 index 5d4d3f3f300..00000000000 --- a/toolchain/scripts/patches/6190.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 409db5e910279224bd7e78f8188450c7e7d34d87 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 10 Sep 2024 18:11:40 -0700 -Subject: [PATCH] Fix instances of - -Wmissing-template-arg-list-after-template-kw. - -Clang has a new warning that requires a template argument list after using -the template keyword. Remove uses of the template keyword when we're not -specifying types. - -See https://github.com/llvm/llvm-project/issues/94194 for the upstream -clang changes - -Signed-off-by: Khem Raj ---- - include/cereal/types/tuple.hpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/include/cereal/types/tuple.hpp b/include/cereal/types/tuple.hpp -index 80c68075..5c79eca9 100644 ---- a/include/cereal/types/tuple.hpp -+++ b/include/cereal/types/tuple.hpp -@@ -95,7 +95,7 @@ namespace cereal - template inline - static void apply( Archive & ar, std::tuple & tuple ) - { -- serialize::template apply( ar, tuple ); -+ serialize::apply( ar, tuple ); - ar( CEREAL_NVP_(tuple_element_name::c_str(), - std::get( tuple )) ); - } -@@ -116,7 +116,7 @@ namespace cereal - template inline - void CEREAL_SERIALIZE_FUNCTION_NAME( Archive & ar, std::tuple & tuple ) - { -- tuple_detail::serialize>::value>::template apply( ar, tuple ); -+ tuple_detail::serialize>::value>::apply( ar, tuple ); - } - } // namespace cereal - - \ No newline at end of file diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 5d5852a3371..f9b9659ab91 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -50,7 +50,7 @@ case "$with_cereal" in # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${cereal_ver}" =~ ^(master|main|develop)$ ]]; then + if [[ "${cereal_ver}" =~ ^[0-9a-f]{40}$ ]]; then url="https://codeload.github.com/USCiLab/cereal/tar.gz/${cereal_ver}" else url="https://codeload.github.com/USCiLab/cereal/tar.gz/v${cereal_ver}" @@ -72,10 +72,6 @@ case "$with_cereal" in echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname tar -xzf $filename - #unzip -q $filename - # apply patch files for libri installation in issue #6190, Kai Luo - # echo ${SCRIPT_DIR} - cd $dirname && pwd && patch -p1 < ${SCRIPT_DIR}/patches/6190.patch cd "${BUILDDIR}" # mkdir -p "${pkg_install_dir}" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index f5b0c227152..ba779b88bed 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -55,7 +55,7 @@ case "$with_libcomm" in # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${libcomm_ver}" =~ ^(master|main|develop)$ ]]; then + if [[ "${libcomm_ver}" =~ ^[0-9a-f]{40}$ ]]; then url="https://codeload.github.com/abacusmodeling/LibComm/tar.gz/${libcomm_ver}" else url="https://codeload.github.com/abacusmodeling/LibComm/tar.gz/v${libcomm_ver}" diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index ba0ee25c46a..186a7572eaa 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -53,7 +53,7 @@ case "$with_libri" in # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${libri_ver}" =~ ^(master|main|develop)$ ]]; then + if [[ "${libri_ver}" =~ ^[0-9a-f]{40}$ ]]; then url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/${libri_ver}" else url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/v${libri_ver}" diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index da6727ac405..480f8d61775 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -51,7 +51,7 @@ case "$with_rapidjson" in # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${rapidjson_ver}" =~ ^(master|main|develop)$ ]]; then + if [[ "${rapidjson_ver}" =~ ^[0-9a-f]{40}$ ]]; then url="https://codeload.github.com/Tencent/rapidjson/tar.gz/${rapidjson_ver}" else url="https://codeload.github.com/Tencent/rapidjson/tar.gz/v${rapidjson_ver}" From 37d4e75c02c5eca430277002ef4768d121a94a44 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:32 +0800 Subject: [PATCH 07/26] Backport: Toolchain: Remove redundant exporting variables (#7230) Partial cherry-pick from d54cc6f86. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- toolchain/scripts/package_versions.sh | 8 ++-- toolchain/scripts/stage0/install_amd.sh | 9 ----- toolchain/scripts/stage0/install_cmake.sh | 3 +- toolchain/scripts/stage0/install_gcc.sh | 9 +---- toolchain/scripts/stage0/install_intel.sh | 9 ----- toolchain/scripts/stage1/install_intelmpi.sh | 10 ----- toolchain/scripts/stage1/install_mpich.sh | 39 ++++++++++--------- toolchain/scripts/stage1/install_openmpi.sh | 12 +++--- toolchain/scripts/stage2/install_aocl.sh | 18 --------- toolchain/scripts/stage2/install_openblas.sh | 25 ++++-------- toolchain/scripts/stage3/install_elpa.sh | 26 +++++-------- toolchain/scripts/stage3/install_fftw.sh | 20 ++++------ toolchain/scripts/stage3/install_libxc.sh | 23 +++++------ toolchain/scripts/stage3/install_scalapack.sh | 10 +---- toolchain/scripts/stage4/install_cereal.sh | 16 +++----- toolchain/scripts/stage4/install_libcomm.sh | 12 +++--- toolchain/scripts/stage4/install_libnpy.sh | 9 ++--- toolchain/scripts/stage4/install_libri.sh | 12 +++--- toolchain/scripts/stage4/install_rapidjson.sh | 16 +++----- toolchain/scripts/tool_kit.sh | 2 +- 20 files changed, 91 insertions(+), 197 deletions(-) diff --git a/toolchain/scripts/package_versions.sh b/toolchain/scripts/package_versions.sh index 3ef4bf08dd9..c6e5769c2fe 100644 --- a/toolchain/scripts/package_versions.sh +++ b/toolchain/scripts/package_versions.sh @@ -75,10 +75,10 @@ libxc_alt_ver="6.2.2" libxc_alt_sha256="f72ed08af7b9dff5f57482c5f97bff22c7dc49da9564bc93871997cbda6dacf3" # ScaLAPACK (supports dual versions) - main=2.2.2, alt=2.2.1 -scalapack_main_ver="2.2.2" -scalapack_main_sha256="a2f0c9180a210bf7ffe126c9cb81099cf337da1a7120ddb4cbe4894eb7b7d022" -scalapack_alt_ver="2.2.1" -scalapack_alt_sha256="4aede775fdb28fa44b331875730bcd5bab130caaec225fadeccf424c8fcb55aa" +scalapack_main_ver="2.2.3" +scalapack_main_sha256="5d93701eca663925e98010dd8d0f45fd79b2191d74e5afa5711d587370a8b9dd" +scalapack_alt_ver="2.2.2" +scalapack_alt_sha256="a2f0c9180a210bf7ffe126c9cb81099cf337da1a7120ddb4cbe4894eb7b7d022" # ============================================================================= # STAGE 4: Advanced Feature Libraries diff --git a/toolchain/scripts/stage0/install_amd.sh b/toolchain/scripts/stage0/install_amd.sh index e3565a7dff8..e0fda73712f 100755 --- a/toolchain/scripts/stage0/install_amd.sh +++ b/toolchain/scripts/stage0/install_amd.sh @@ -85,15 +85,6 @@ export FC="${FC}" export F90="${F90}" export F77="${F77}" EOF - if [ "${with_amd}" != "__SYSTEM__" ]; then - cat << EOF >> "${BUILDDIR}/setup_amd" -prepend_path PATH "${pkg_install_dir}/bin" -prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" -prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path CPATH "${pkg_install_dir}/include" -EOF - fi cat << EOF >> "${BUILDDIR}/setup_amd" export AMD_CFLAGS="${AMD_CFLAGS}" export AMD_LDFLAGS="${AMD_LDFLAGS}" diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index 8692bfb0582..b3ef274c0e7 100755 --- a/toolchain/scripts/stage0/install_cmake.sh +++ b/toolchain/scripts/stage0/install_cmake.sh @@ -91,7 +91,7 @@ case "${with_cmake}" in fi pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}" #pkg_install_dir="${HOME}/apps/cmake/${cmake_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}" if verify_checksums "${install_lock_file}"; then echo "cmake-${cmake_ver} is already installed, skipping it." @@ -138,7 +138,6 @@ if [ "${with_cmake}" != "__DONTUSE__" ]; then if [ "${with_cmake}" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_cmake" prepend_path PATH "${pkg_install_dir}/bin" -export PATH="${pkg_install_dir}/bin":\${PATH} EOF cat "${BUILDDIR}/setup_cmake" >> $SETUPFILE fi diff --git a/toolchain/scripts/stage0/install_gcc.sh b/toolchain/scripts/stage0/install_gcc.sh index 7930d6a9f71..fe4b4c44ad5 100755 --- a/toolchain/scripts/stage0/install_gcc.sh +++ b/toolchain/scripts/stage0/install_gcc.sh @@ -49,7 +49,7 @@ case "${with_gcc}" in repack_filename="gcc-${gcc_ver}-with-prereq.tar.gz" repkg_install_dir="${INSTALLDIR}/${repack_filename}" #pkg_install_dir="${HOME}/apps/gcc/${gcc_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" if verify_checksums "${install_lock_file}"; then echo "gcc-${gcc_ver} is already installed, skipping it." else @@ -229,13 +229,6 @@ prepend_path LD_RUN_PATH "${pkg_install_dir}/lib64" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib64" prepend_path CPATH "${pkg_install_dir}/include" -export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} -export LD_LIBRARY_PATH="${pkg_install_dir}/lib64":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="${pkg_install_dir}/lib":\${LD_RUN_PATH} -export LD_RUN_PATH="${pkg_install_dir}/lib64":\${LD_RUN_PATH} -export LIBRARY_PATH="${pkg_install_dir}/lib":\${LIBRARY_PATH} -export LIBRARY_PATH="${pkg_install_dir}/lib64":\${LIBRARY_PATH} -export CPATH="${pkg_install_dir}/include":\${CPATH} EOF fi cat << EOF >> "${BUILDDIR}/setup_gcc" diff --git a/toolchain/scripts/stage0/install_intel.sh b/toolchain/scripts/stage0/install_intel.sh index 53ef5527eaa..246a2f01438 100755 --- a/toolchain/scripts/stage0/install_intel.sh +++ b/toolchain/scripts/stage0/install_intel.sh @@ -89,15 +89,6 @@ export FC="${FC}" export F90="${F90}" export F77="${F77}" EOF - if [ "${with_intel}" != "__SYSTEM__" ]; then - cat << EOF >> "${BUILDDIR}/setup_intel" -prepend_path PATH "${pkg_install_dir}/bin" -prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" -prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path CPATH "${pkg_install_dir}/include" -EOF - fi cat << EOF >> "${BUILDDIR}/setup_intel" export INTEL_CFLAGS="${INTEL_CFLAGS}" export INTEL_LDFLAGS="${INTEL_LDFLAGS}" diff --git a/toolchain/scripts/stage1/install_intelmpi.sh b/toolchain/scripts/stage1/install_intelmpi.sh index 5f311c4b5e7..f844744e83b 100755 --- a/toolchain/scripts/stage1/install_intelmpi.sh +++ b/toolchain/scripts/stage1/install_intelmpi.sh @@ -144,16 +144,6 @@ export CP_CFLAGS="\${CP_CFLAGS} IF_MPI(${INTELMPI_CFLAGS}|)" export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${INTELMPI_LDFLAGS}|)" export CP_LIBS="\${CP_LIBS} IF_MPI(${INTELMPI_LIBS}|)" EOF - if [ "${with_intelmpi}" != "__SYSTEM__" ]; then - cat << EOF >> "${BUILDDIR}/setup_intelmpi" -prepend_path PATH "${pkg_install_dir}/bin" -export PATH="${pkg_install_dir}/bin":\${PATH} -export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="${pkg_install_dir}/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="${pkg_install_dir}/lib":\${LIBRARY_PATH} -export CPATH="${pkg_install_dir}/include":\${CPATH} -EOF - fi cat "${BUILDDIR}/setup_intelmpi" >> ${SETUPFILE} fi diff --git a/toolchain/scripts/stage1/install_mpich.sh b/toolchain/scripts/stage1/install_mpich.sh index cafda9200d1..82993c2505c 100755 --- a/toolchain/scripts/stage1/install_mpich.sh +++ b/toolchain/scripts/stage1/install_mpich.sh @@ -48,7 +48,7 @@ case "${with_mpich}" in echo "==================== Installing MPICH ====================" pkg_install_dir="${INSTALLDIR}/mpich-${mpich_ver}" #pkg_install_dir="${HOME}/apps/mpich/${mpich_ver}-intel" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" url="https://www.mpich.org/static/downloads/${mpich_ver}/${mpich_pkg}" if verify_checksums "${install_lock_file}"; then echo "mpich-${mpich_ver} is already installed, skipping it." @@ -81,6 +81,8 @@ case "${with_mpich}" in MPICC="" \ FFLAGS="${FCFLAGS} ${compat_flag}" \ FCFLAGS="${FCFLAGS} ${compat_flag}" \ + --without-x \ + --enable-gl=no \ --with-device=${MPICH_DEVICE} \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log @@ -90,19 +92,19 @@ case "${with_mpich}" in fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip system check" - else - check_dir "${pkg_install_dir}/bin" - check_dir "${pkg_install_dir}/lib" - check_dir "${pkg_install_dir}/include" - check_install ${pkg_install_dir}/bin/mpiexec "mpich" && MPIRUN="${pkg_install_dir}/bin/mpiexec" || exit 1 - check_install ${pkg_install_dir}/bin/mpicc "mpich" && MPICC="${pkg_install_dir}/bin/mpicc" || exit 1 - check_install ${pkg_install_dir}/bin/mpicxx "mpich" && MPICXX="${pkg_install_dir}/bin/mpicxx" || exit 1 - check_install ${pkg_install_dir}/bin/mpifort "mpich" && MPIFC="${pkg_install_dir}/bin/mpifort" || exit 1 - MPIFORT="${MPIFC}" - MPIF77="${MPIFC}" - MPICH_CFLAGS="-I'${pkg_install_dir}/include'" - MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'" + exit 0 fi + check_dir "${pkg_install_dir}/bin" + check_dir "${pkg_install_dir}/lib" + check_dir "${pkg_install_dir}/include" + check_install ${pkg_install_dir}/bin/mpiexec "mpich" && MPIRUN="${pkg_install_dir}/bin/mpiexec" || exit 1 + check_install ${pkg_install_dir}/bin/mpicc "mpich" && MPICC="${pkg_install_dir}/bin/mpicc" || exit 1 + check_install ${pkg_install_dir}/bin/mpicxx "mpich" && MPICXX="${pkg_install_dir}/bin/mpicxx" || exit 1 + check_install ${pkg_install_dir}/bin/mpifort "mpich" && MPIFC="${pkg_install_dir}/bin/mpifort" || exit 1 + MPIFORT="${MPIFC}" + MPIF77="${MPIFC}" + MPICH_CFLAGS="-I'${pkg_install_dir}/include'" + MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'" ;; __SYSTEM__) echo "==================== Finding MPICH from system paths ====================" @@ -174,11 +176,10 @@ EOF if [ "${with_mpich}" != "__SYSTEM__" ]; then cat << EOF >> "${BUILDDIR}/setup_mpich" prepend_path PATH "${pkg_install_dir}/bin" -export PATH="${pkg_install_dir}/bin":\${PATH} -export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH "${pkg_install_dir}/lib":\${LD_RUN_PATH} -export LIBRARY_PATH "${pkg_install_dir}/lib":\${LIBRARY_PATH} -export CPATH "${pkg_install_dir}/include":\${CPATH} +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path CPATH "${pkg_install_dir}/include" EOF fi cat "${BUILDDIR}/setup_mpich" >> ${SETUPFILE} @@ -189,6 +190,8 @@ cat << EOF >> ${INSTALLDIR}/lsan.supp # MPICH 3.3.2 with GCC 10.3.0 leak:MPIR_Find_local_and_external leak:MPIU_Find_local_and_external +# MPICH 4.2.3 +leak:MPL_malloc EOF load "${BUILDDIR}/setup_mpich" diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index 6656fb9a971..d134358ffa8 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -47,7 +47,7 @@ case "${with_openmpi}" in __INSTALL__) echo "==================== Installing OpenMPI ====================" pkg_install_dir="${INSTALLDIR}/openmpi-${openmpi_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" url="https://download.open-mpi.org/release/open-mpi/v${openmpi_ver%.*}/${openmpi_pkg}" if verify_checksums "${install_lock_file}"; then echo "openmpi-${openmpi_ver} is already installed, skipping it." @@ -200,12 +200,10 @@ EOF if [ "${with_openmpi}" != "__SYSTEM__" ]; then cat << EOF >> "${BUILDDIR}/setup_openmpi" prepend_path PATH "${pkg_install_dir}/bin" -export PATH="${pkg_install_dir}/bin":\${PATH} -export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="${pkg_install_dir}/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="${pkg_install_dir}/lib":\${LIBRARY_PATH} -export CPATH="${pkg_install_dir}/include":\${CPATH} - +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path CPATH "${pkg_install_dir}/include" EOF fi cat "${BUILDDIR}/setup_openmpi" >> ${SETUPFILE} diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index c2c3b10e754..a7f9b377915 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -57,24 +57,6 @@ case "${with_aocl}" in ;; esac if [ "$with_aocl" != "__DONTUSE__" ]; then - if [ "$with_aocl" != "__SYSTEM__" ]; then - cat << EOF > "${BUILDDIR}/setup_aocl" -prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path LD_RUN_PATH "$pkg_install_dir/lib" -prepend_path LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -prepend_path CPATH "$pkg_install_dir/include" -export LD_LIBRARY_PATH="$pkg_install_dir/lib:"\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib:"\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib:"\${LIBRARY_PATH} -export CPATH="$pkg_install_dir/include:"\${CPATH} -export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig:"\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir:"\${CMAKE_PREFIX_PATH} -export AOCL_ROOT=${pkg_install_dir} -EOF - cat "${BUILDDIR}/setup_aocl" >> $SETUPFILE - fi cat << EOF >> "${BUILDDIR}/setup_aocl" export AOCL_ROOT="${pkg_install_dir}" export AOCL_CFLAGS="${AOCL_CFLAGS}" diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 03da6205bc2..3b5800f54f2 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -46,7 +46,7 @@ case "${with_openblas}" in __INSTALL__) echo "==================== Installing OpenBLAS ====================" pkg_install_dir="${INSTALLDIR}/openblas-${openblas_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" if verify_checksums "${install_lock_file}"; then echo "openblas-${openblas_ver} is already installed, skipping it." else @@ -172,19 +172,10 @@ esac if [ "$with_openblas" != "__DONTUSE__" ]; then if [ "$with_openblas" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_openblas" -prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path LD_RUN_PATH "$pkg_install_dir/lib" -prepend_path LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -prepend_path CPATH "$pkg_install_dir/include" -export LD_LIBRARY_PATH="$pkg_install_dir/lib:"\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib:"\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib:"\${LIBRARY_PATH} -export CPATH="$pkg_install_dir/include:"\${CPATH} -export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig:"\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir:"\${CMAKE_PREFIX_PATH} -export OPENBLAS_ROOT=${pkg_install_dir} +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path CPATH "${pkg_install_dir}/include" EOF cat "${BUILDDIR}/setup_openblas" >> $SETUPFILE fi @@ -196,10 +187,8 @@ export OPENBLAS_LIBS="${OPENBLAS_LIBS}" export MATH_CFLAGS="\${MATH_CFLAGS} ${OPENBLAS_CFLAGS}" export MATH_LDFLAGS="\${MATH_LDFLAGS} ${OPENBLAS_LDFLAGS}" export MATH_LIBS="\${MATH_LIBS} ${OPENBLAS_LIBS}" -export PKG_CONFIG_PATH="${pkg_install_dir}/lib/pkgconfig" -export CMAKE_PREFIX_PATH="${pkg_install_dir}" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 50cd499452f..a3d981fa690 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -57,7 +57,7 @@ case "$with_elpa" in echo "==================== Installing ELPA ====================" pkg_install_dir="${INSTALLDIR}/elpa-${elpa_ver}" #pkg_install_dir="${HOME}/lib/elpa/${elpa_ver}-gcc8" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" enable_openmp="yes" # specific settings needed on CRAY Linux Environment @@ -250,25 +250,18 @@ prepend_path CPATH "$elpa_include" EOF if [ "$with_elpa" != "__SYSTEM__" ]; then cat << EOF >> "${BUILDDIR}/setup_elpa" -prepend_path PATH "$pkg_install_dir/bin" -prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path CPATH "$pkg_install_dir/include" -prepend_path LD_RUN_PATH "$pkg_install_dir/lib" -prepend_path LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -export PATH="$pkg_install_dir/bin":\${PATH} -export LD_LIBRARY_PATH="$pkg_install_dir/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib":\${LIBRARY_PATH} -export CPATH="$pkg_install_dir/include":\${CPATH} -export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig":\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir":\${CMAKE_PREFIX_PATH} -export ELPA_ROOT="$pkg_install_dir" +prepend_path PATH "${pkg_install_dir}/bin" +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path CPATH "${pkg_install_dir}/include" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF cat "${BUILDDIR}/setup_elpa" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_elpa" +export ELPA_ROOT="${pkg_install_dir}" export ELPA_CFLAGS="${ELPA_CFLAGS}" export ELPA_LDFLAGS="${ELPA_LDFLAGS}" export ELPA_LIBS="${ELPA_LIBS}" @@ -276,7 +269,6 @@ export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__ELPA IF_CUDA(-D__ELPA_NVIDIA_GPU|)|)" export CP_CFLAGS="\${CP_CFLAGS} IF_MPI(${ELPA_CFLAGS}|)" export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${ELPA_LDFLAGS}|)" export CP_LIBS="IF_MPI(${ELPA_LIBS}|) \${CP_LIBS}" -export ELPA_ROOT="$pkg_install_dir" export ELPA_VERSION="${elpa_ver}" EOF diff --git a/toolchain/scripts/stage3/install_fftw.sh b/toolchain/scripts/stage3/install_fftw.sh index 7f1a05dbcf6..31396455d62 100755 --- a/toolchain/scripts/stage3/install_fftw.sh +++ b/toolchain/scripts/stage3/install_fftw.sh @@ -45,7 +45,7 @@ case "$with_fftw" in require_env MPI_LIBS echo "==================== Installing FFTW ====================" pkg_install_dir="${INSTALLDIR}/fftw-${fftw_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" if verify_checksums "${install_lock_file}"; then echo "fftw-${fftw_ver} is already installed, skipping it." else @@ -128,18 +128,12 @@ if [ "$with_fftw" != "__DONTUSE__" ]; then FFTW_LIBS+="-lfftw3 -lfftw3_omp" if [ "$with_fftw" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_fftw" -prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path LD_RUN_PATH "$pkg_install_dir/lib" -prepend_path LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path CPATH "$pkg_install_dir/include" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -export LD_LIBRARY_PATH="$pkg_install_dir/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib":\${LIBRARY_PATH} -export CPATH="$pkg_install_dir/include":\${CPATH} -export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig":\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir":\${CMAKE_PREFIX_PATH} +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path CPATH "${pkg_install_dir}/include" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi # we may also want to cover FFT_SG diff --git a/toolchain/scripts/stage3/install_libxc.sh b/toolchain/scripts/stage3/install_libxc.sh index 4fc7ff66099..3afb4b4fee2 100755 --- a/toolchain/scripts/stage3/install_libxc.sh +++ b/toolchain/scripts/stage3/install_libxc.sh @@ -47,7 +47,7 @@ case "$with_libxc" in echo "==================== Installing LIBXC ====================" pkg_install_dir="${INSTALLDIR}/libxc-${libxc_ver}" #pkg_install_dir="${HOME}/lib/libxc/${libxc_ver}-gcc8" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" if verify_checksums "${install_lock_file}"; then echo "libxc-${libxc_ver} is already installed, skipping it." else @@ -77,6 +77,7 @@ case "$with_libxc" in -DCMAKE_VERBOSE_MAKEFILE=ON \ -DENABLE_FORTRAN=ON \ -DENABLE_PYTHON=OFF \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DBUILD_TESTING=OFF .. \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log @@ -113,18 +114,12 @@ if [ "$with_libxc" != "__DONTUSE__" ]; then LIBXC_LIBS="-lxcf03 -lxc" if [ "$with_libxc" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_libxc" -prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path LD_RUN_PATH "$pkg_install_dir/lib" -prepend_path LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path CPATH "$pkg_install_dir/include" -prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -export LD_LIBRARY_PATH="$pkg_install_dir/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib":\${LIBRARY_PATH} -export CPATH="$pkg_install_dir/include":\${CPATH} -export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig":\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir":\${CMAKE_PREFIX_PATH} +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path CPATH "${pkg_install_dir}/include" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF cat "${BUILDDIR}/setup_libxc" >> $SETUPFILE fi @@ -136,7 +131,7 @@ export CP_DFLAGS="\${CP_DFLAGS} -D__LIBXC" export CP_CFLAGS="\${CP_CFLAGS} ${LIBXC_CFLAGS}" export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBXC_LDFLAGS}" export CP_LIBS="${LIBXC_LIBS} \${CP_LIBS}" -export LIBXC_ROOT="$pkg_install_dir" +export LIBXC_ROOT="${pkg_install_dir}" EOF fi diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index 3ffbf42c7d2..e03742efa2e 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -44,7 +44,7 @@ case "${with_scalapack}" in __INSTALL__) echo "==================== Installing ScaLAPACK ====================" pkg_install_dir="${INSTALLDIR}/scalapack-${scalapack_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" if verify_checksums "${install_lock_file}"; then echo "scalapack-${scalapack_ver} is already installed, skipping it." else @@ -119,19 +119,13 @@ prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" -export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="${pkg_install_dir}/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="${pkg_install_dir}/lib":\${LIBRARY_PATH} -export PKG_CONFIG_PATH="${pkg_install_dir}/lib/pkgconfig":\${PKG_CONFIG_PATH} -export CMAKE_PREFIX_PATH="${pkg_install_dir}":\${CMAKE_PREFIX_PATH} -export SCALAPACK_ROOT="${pkg_install_dir}" EOF cat "${BUILDDIR}/setup_scalapack" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_scalapack" +export SCALAPACK_ROOT="${pkg_install_dir}" export SCALAPACK_LDFLAGS="${SCALAPACK_LDFLAGS}" export SCALAPACK_LIBS="${SCALAPACK_LIBS}" -export SCALAPACK_ROOT="${pkg_install_dir}" export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__SCALAPACK|)" export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${SCALAPACK_LDFLAGS}|)" export CP_LIBS="IF_MPI(-lscalapack|) \${CP_LIBS}" diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index f9b9659ab91..6ec7c593c65 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -46,7 +46,7 @@ case "$with_cereal" in echo "==================== Installing CEREAL ====================" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/cereal/${cereal_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix @@ -93,7 +93,7 @@ case "$with_cereal" in # cereal/cereal.hpp -> remove /cereal/cereal.hpp -> get include dir -> get parent dir cereal_include_dir="$(dirname "$(dirname "$cereal_header_path")")" pkg_install_dir="$(dirname "$cereal_include_dir")" - echo "Found cereal at: $pkg_install_dir" + echo "Found cereal at: ${pkg_install_dir}" CEREAL_CFLAGS="-I'${cereal_include_dir}'" else report_error "Cannot find cereal/cereal.hpp in system paths" @@ -112,19 +112,13 @@ esac if [ "$with_cereal" != "__DONTUSE__" ]; then if [ "$with_cereal" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_cereal" -prepend_path CPATH "$pkg_install_dir/include" -prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/include" -export CPATH="${pkg_install_dir}/include":\${CPATH} -export CMAKE_PREFIX_PATH="${pkg_install_dir}/include":\${CMAKE_PREFIX_PATH} -export CEREAL_ROOT="$pkg_install_dir" -EOF - else - cat << EOF > "${BUILDDIR}/setup_cereal" -export CEREAL_ROOT="$pkg_install_dir" +prepend_path CPATH "${pkg_install_dir}/include" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi cat "${BUILDDIR}/setup_cereal" >> $SETUPFILE cat << EOF >> "${BUILDDIR}/setup_cereal" +export CEREAL_ROOT="${pkg_install_dir}" export CEREAL_CFLAGS="${CEREAL_CFLAGS}" export CP_DFLAGS="\${CP_DFLAGS} -D__CEREAL" export CP_CFLAGS="\${CP_CFLAGS} ${CEREAL_CFLAGS}" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index ba779b88bed..16ea4c58906 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -41,7 +41,6 @@ source "${INSTALLDIR}"/toolchain.env [ -f "${BUILDDIR}/setup_libcomm" ] && rm "${BUILDDIR}/setup_libcomm" -libcomm_CFLAGS="" ! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}" cd "${BUILDDIR}" @@ -50,7 +49,7 @@ case "$with_libcomm" in echo "==================== Installing LIBCOMM ====================" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libcomm/${libcomm_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" # url="https://github.com/abacusmodeling/LibComm/archive/refs/tags/v${libcomm_ver}.tar.gz" # url construction rules: # - Branch names (master, main, develop) without v prefix @@ -96,7 +95,7 @@ case "$with_libcomm" in # Comm/Comm_Tools.h -> remove /Comm/Comm_Tools.h -> get include dir -> get parent dir libcomm_include_dir="$(dirname "$(dirname "$libcomm_header_path")")" pkg_install_dir="$(dirname "$libcomm_include_dir")" - echo "Found libcomm at: $pkg_install_dir" + echo "Found libcomm at: ${pkg_install_dir}" LIBCOMM_CFLAGS="-I'${libcomm_include_dir}'" else report_error "Cannot find Comm/Comm_Tools.h in system paths" @@ -115,14 +114,13 @@ esac if [ "$with_libcomm" != "__DONTUSE__" ]; then if [ "$with_libcomm" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_libcomm" -prepend_path CPATH "$pkg_install_dir/include" -export CPATH="${pkg_install_dir}/include":\${CPATH} +prepend_path CPATH "${pkg_install_dir}/include" EOF cat "${BUILDDIR}/setup_libcomm" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libcomm" -export LIBCOMM_CFLAGS="${libcomm_CFLAGS}" -export LIBCOMM_ROOT="$pkg_install_dir" +export LIBCOMM_CFLAGS="${LIBCOMM_CFLAGS}" +export LIBCOMM_ROOT="${pkg_install_dir}" EOF fi diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index aa2f59df323..7b59f621388 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -49,7 +49,7 @@ case "$with_libnpy" in echo "==================== Installing LIBNPY ====================" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libnpy/${libnpy_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" url="https://codeload.github.com/llohse/libnpy/tar.gz/v${libnpy_ver}" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -87,7 +87,7 @@ case "$with_libnpy" in # npy.hpp -> get include dir -> get parent dir libnpy_include_dir="$(dirname "$libnpy_header_path")" pkg_install_dir="$(dirname "$libnpy_include_dir")" - echo "Found libnpy at: $pkg_install_dir" + echo "Found libnpy at: ${pkg_install_dir}" LIBNPY_CFLAGS="-I'${libnpy_include_dir}'" else report_error "Cannot find npy.hpp in system paths" @@ -106,14 +106,13 @@ esac if [ "$with_libnpy" != "__DONTUSE__" ]; then if [ "$with_libnpy" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_libnpy" -prepend_path CPATH "$pkg_install_dir/include" -export CPATH="${pkg_install_dir}/include":\${CPATH} +prepend_path CPATH "${pkg_install_dir}/include" EOF cat "${BUILDDIR}/setup_libnpy" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libnpy" export LIBNPY_CFLAGS="${LIBNPY_CFLAGS}" -export LIBNPY_ROOT="$pkg_install_dir" +export LIBNPY_ROOT="${pkg_install_dir}" EOF fi diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 186a7572eaa..2ab392708f1 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -39,7 +39,6 @@ source "${INSTALLDIR}"/toolchain.env [ -f "${BUILDDIR}/setup_libri" ] && rm "${BUILDDIR}/setup_libri" -libri_CFLAGS="" ! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}" cd "${BUILDDIR}" @@ -49,7 +48,7 @@ case "$with_libri" in dirname="LibRI-${libri_ver}" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libri/${libri_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix @@ -95,7 +94,7 @@ case "$with_libri" in # RI/version.h -> remove /RI/version.h -> get include dir -> get parent dir libri_include_dir="$(dirname "$(dirname "$libri_header_path")")" pkg_install_dir="$(dirname "$libri_include_dir")" - echo "Found libri at: $pkg_install_dir" + echo "Found libri at: ${pkg_install_dir}" LIBRI_CFLAGS="-I'${libri_include_dir}'" else report_error "Cannot find RI/version.h in system paths" @@ -114,14 +113,13 @@ esac if [ "$with_libri" != "__DONTUSE__" ]; then if [ "$with_libri" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_libri" -prepend_path CPATH "$pkg_install_dir/include" -export CPATH="${pkg_install_dir}/include":\${CPATH} +prepend_path CPATH "${pkg_install_dir}/include" EOF cat "${BUILDDIR}/setup_libri" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libri" -export LIBRI_CFLAGS="${libri_CFLAGS}" -export LIBRI_ROOT="$pkg_install_dir" +export LIBRI_CFLAGS="${LIBRI_CFLAGS}" +export LIBRI_ROOT="${pkg_install_dir}" EOF fi diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 480f8d61775..e6b6472d804 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -47,7 +47,7 @@ case "$with_rapidjson" in dirname="rapidjson-${rapidjson_ver}" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}" - install_lock_file="$pkg_install_dir/install_successful" + install_lock_file="${pkg_install_dir}/install_successful" # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix @@ -100,7 +100,7 @@ EOF # rapidjson/rapidjson.h -> remove /rapidjson/rapidjson.h -> get include dir -> get parent dir rapidjson_include_dir="$(dirname "$(dirname "$rapidjson_header_path")")" pkg_install_dir="$(dirname "$rapidjson_include_dir")" - echo "Found rapidjson at: $pkg_install_dir" + echo "Found rapidjson at: ${pkg_install_dir}" RAPIDJSON_CFLAGS="-I'${rapidjson_include_dir}'" else report_error "Cannot find rapidjson/rapidjson.h in system paths" @@ -119,19 +119,13 @@ esac if [ "$with_rapidjson" != "__DONTUSE__" ]; then if [ "$with_rapidjson" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_rapidjson" -prepend_path CPATH "$pkg_install_dir/include" -prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" -export CPATH="$pkg_install_dir/include":\${CPATH} -export CMAKE_PREFIX_PATH="$pkg_install_dir":\${CMAKE_PREFIX_PATH} -export RAPIDJSON_ROOT="$pkg_install_dir" -EOF - else - cat << EOF > "${BUILDDIR}/setup_rapidjson" -export RAPIDJSON_ROOT="$pkg_install_dir" +prepend_path CPATH "${pkg_install_dir}/include" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi cat "${BUILDDIR}/setup_rapidjson" >> $SETUPFILE cat << EOF >> "${BUILDDIR}/setup_rapidjson" +export RAPIDJSON_ROOT="${pkg_install_dir}" export RAPIDJSON_CFLAGS="${RAPIDJSON_CFLAGS}" export CP_DFLAGS="\${CP_DFLAGS} -D__RAPIDJSON" export CP_CFLAGS="\${CP_CFLAGS} ${RAPIDJSON_CFLAGS}" diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 8c288ec2722..ad86f8404c8 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -743,7 +743,7 @@ remove_path() { __path=${__path//:$__directory:/:} __path=${__path#$__directory:} __path=${__path%:$__directory} - __path=$(echo "$__path" | sed "s:^$__directory\$::g") + __path=$(echo "$__path" | sed "s#^$__directory\$##g") eval $__path_name=\"$__path\" export $__path_name } From 824ce09e00ad92501e2b6d292430adfa8fda8135 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:33 +0800 Subject: [PATCH 08/26] Backport: refactor: find scalapack automatically (#7235) Partial cherry-pick from 60ea82d1a. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- cmake/FindScaLAPACK.cmake | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/cmake/FindScaLAPACK.cmake b/cmake/FindScaLAPACK.cmake index 09310df8766..febecd2de41 100644 --- a/cmake/FindScaLAPACK.cmake +++ b/cmake/FindScaLAPACK.cmake @@ -5,16 +5,33 @@ # ScaLAPACK_FOUND - True if ScaLAPACK is found. # +# Accept common root hints from cache vars and environment. +set(_scalapack_hints + ${SCALAPACK_DIR} + ${SCALAPACK_ROOT} + $ENV{SCALAPACK_DIR} + $ENV{SCALAPACK_ROOT} +) + find_library(ScaLAPACK_LIBRARY - NAMES scalapack scalapack-openmpi - HINTS ${SCALAPACK_DIR} - PATH_SUFFIXES "lib" + NAMES + scalapack + scalapack-openmpi + scalapack-mpi + scalapack-mpich + HINTS ${_scalapack_hints} + PATH_SUFFIXES lib lib64 ) +unset(_scalapack_hints) + # Handle the QUIET and REQUIRED arguments and # set ScaLAPACK_FOUND to TRUE if all variables are non-zero. include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ScaLAPACK DEFAULT_MSG ScaLAPACK_LIBRARY) +find_package_handle_standard_args( + ScaLAPACK + REQUIRED_VARS ScaLAPACK_LIBRARY +) # Copy the results to the output variables and target. if(ScaLAPACK_FOUND) @@ -23,7 +40,6 @@ if(ScaLAPACK_FOUND) if(NOT TARGET ScaLAPACK::ScaLAPACK) add_library(ScaLAPACK::ScaLAPACK UNKNOWN IMPORTED) set_target_properties(ScaLAPACK::ScaLAPACK PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "${ScaLAPACK_LIBRARY}") endif() endif() From 407eb6a4c12b992debffbfd41dce1671cc07d798 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:34 +0800 Subject: [PATCH 09/26] Backport: Add CI/CD workflow for Toolchain (#7244) Partial cherry-pick from c2b3b2424. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- .github/workflows/toolchain_full.yaml | 146 ++++++++++++++++++++++ .github/workflows/toolchain_quick.yaml | 82 ++++++++++++ toolchain/scripts/lib/config_validator.sh | 4 +- 3 files changed, 230 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/toolchain_full.yaml create mode 100644 .github/workflows/toolchain_quick.yaml diff --git a/.github/workflows/toolchain_full.yaml b/.github/workflows/toolchain_full.yaml new file mode 100644 index 00000000000..4fdac1557ab --- /dev/null +++ b/.github/workflows/toolchain_full.yaml @@ -0,0 +1,146 @@ +name: Toolchain Full Build Test +on: + schedule: + - cron: "0 0 * * 0" + workflow_dispatch: + inputs: + variants: + description: "Comma-separated variants: gnu,intel,cuda" + required: false + default: "gnu,intel,cuda" +jobs: + full-build-gnu: + if: contains(inputs.variants || 'gnu,intel,cuda', 'gnu') + runs-on: X64 + container: + image: ghcr.io/deepmodeling/abacus-gnu + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install requirements + run: | + set -euo pipefail + cd toolchain/root_requirements + sudo ./install_requirements_ubuntu.sh + - name: Build toolchain + run: | + set -euo pipefail + cd toolchain + ./toolchain_gnu.sh + - name: Build ABACUS + run: | + set -euo pipefail + cd toolchain + ./build_abacus_gnu.sh + cd .. + ./bin/abacus --version || true + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: toolchain-full-gnu + path: | + toolchain/compile.log + toolchain/compile.err + toolchain/install/setup + toolchain/build/**/make.log + toolchain/build/**/configure.log + toolchain/build/**/cmake.log + if-no-files-found: ignore + + full-build-intel: + if: contains(inputs.variants || 'gnu,intel,cuda', 'intel') + runs-on: X64 + container: + image: ghcr.io/deepmodeling/abacus-intel + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install requirements + run: | + set -euo pipefail + cd toolchain/root_requirements + sudo ./install_requirements_ubuntu.sh + - name: Build toolchain + run: | + set -euo pipefail + cd toolchain + ./toolchain_intel.sh + - name: Build ABACUS + run: | + set -euo pipefail + cd toolchain + ./build_abacus_intel.sh + cd .. + ./bin/abacus --version || true + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: toolchain-full-intel + path: | + toolchain/compile.log + toolchain/compile.err + toolchain/install/setup + toolchain/build/**/make.log + toolchain/build/**/configure.log + toolchain/build/**/cmake.log + if-no-files-found: ignore + + full-build-cuda: + if: contains(inputs.variants || 'gnu,intel,cuda', 'cuda') + runs-on: nvidia + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install requirements + run: | + set -euo pipefail + if [ -f /etc/os-release ]; then . /etc/os-release; fi + if [ "${ID:-}" = "ubuntu" ] || [ "${ID_LIKE:-}" = "debian" ]; then + sudo ./toolchain/root_requirements/install_requirements_ubuntu.sh + elif [ "${ID:-}" = "fedora" ] || [ "${ID_LIKE:-}" = "rhel fedora" ]; then + sudo ./toolchain/root_requirements/install_requirements_fedora.sh + else + exit 1 + fi + - name: Prepare CUDA and NVHPC + run: | + set -euo pipefail + if command -v nvidia-smi >/dev/null 2>&1; then + nvidia-smi + cap="$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -n 1 | tr -d '.' | xargs || true)" + fi + if [ -z "${cap:-}" ]; then cap="70"; fi + echo "GPU_CAP=${cap}" >> "$GITHUB_ENV" + if command -v module >/dev/null 2>&1; then + module use /opt/nvidia/hpc_sdk/modulefiles || true + module load nvhpc/26.1 || module load nvhpc-hpcx-cuda12/25.3 + else + exit 1 + fi + if [ -d /usr/local/cuda ]; then + echo "CUDA_PATH=/usr/local/cuda" >> "$GITHUB_ENV" + fi + - name: Build toolchain + run: | + set -euo pipefail + cd toolchain + ./toolchain_gnu.sh --enable-cuda --gpu-ver "${GPU_CAP}" + - name: Build ABACUS + run: | + set -euo pipefail + cd toolchain + ./build_abacus_gnu.sh + cd .. + ./bin/abacus --version || true + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: toolchain-full-cuda + path: | + toolchain/compile.log + toolchain/compile.err + toolchain/install/setup + if-no-files-found: ignore diff --git a/.github/workflows/toolchain_quick.yaml b/.github/workflows/toolchain_quick.yaml new file mode 100644 index 00000000000..e941be3f8a0 --- /dev/null +++ b/.github/workflows/toolchain_quick.yaml @@ -0,0 +1,82 @@ +name: Toolchain Quick Test +on: + pull_request: + paths: + - toolchain/** + - .github/workflows/toolchain_quick.yml + push: + branches: + - develop + paths: + - toolchain/** + - .github/workflows/toolchain_quick.yml + workflow_dispatch: +jobs: + lint-and-sanity: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install tools + run: | + sudo apt-get update + sudo apt-get install -y dos2unix shellcheck + - name: Shell syntax + run: | + set -euo pipefail + while IFS= read -r -d '' f; do + bash -n "$f" + done < <(find toolchain -type f -name '*.sh' -print0) + - name: Python syntax + run: | + python3 -m compileall toolchain + - name: CRLF check + run: | + set -euo pipefail + if grep -RIl $'\r' toolchain | head -n 1 | grep -q .; then + grep -RIl $'\r' toolchain | head -n 50 + exit 1 + fi + - name: Shellcheck + run: | + set -euo pipefail + shellcheck --version + find toolchain -type f -name '*.sh' -print0 | xargs -0 -n1 shellcheck -x || true + + dry-run-matrix: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + variant: [gnu, intel, cuda] + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install tools + run: | + sudo apt-get update + sudo apt-get install -y dos2unix + - name: Dry run + run: | + set -euo pipefail + cd toolchain + rm -rf build install + find . -type f -name '*.sh' -exec chmod +x {} + + if [ "${{ matrix.variant }}" = "gnu" ]; then + ./toolchain_gnu.sh --dry-run --skip-system-checks + elif [ "${{ matrix.variant }}" = "intel" ]; then + ./toolchain_intel.sh --dry-run --skip-system-checks + elif [ "${{ matrix.variant }}" = "cuda" ]; then + ./toolchain_gnu.sh --dry-run --skip-system-checks --enable-cuda --gpu-ver 70 + fi + - name: Upload setup + if: always() + uses: actions/upload-artifact@v4 + with: + name: toolchain-${{ matrix.variant }}-dryrun + path: | + toolchain/install/setup + toolchain/compile.log + toolchain/compile.err + if-no-files-found: ignore + diff --git a/toolchain/scripts/lib/config_validator.sh b/toolchain/scripts/lib/config_validator.sh index 648a6ffbe9f..9af8736d3a2 100644 --- a/toolchain/scripts/lib/config_validator.sh +++ b/toolchain/scripts/lib/config_validator.sh @@ -523,8 +523,8 @@ validate_configuration() { # Check if validation should be skipped # Usage: should_skip_validation should_skip_validation() { - if [[ "${CONFIG_CACHE[SKIP_SYSTEM_CHECKS]}" == "true" ]]; then - echo "Skipping configuration validation (SKIP_SYSTEM_CHECKS=true)" + if [[ "${CONFIG_CACHE[skip_system_checks]}" == "__TRUE__" ]]; then + echo "Skipping configuration validation (--skip-system-checks)" return 0 fi return 1 From 4fac355455fccff21453233f985168e05f068648 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:35 +0800 Subject: [PATCH 10/26] Backport: Toolchain: Enable float FFTW linking for building with MKL (#7245) Partial cherry-pick from e6a377d41. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- toolchain/build_abacus_gcc-mkl.sh | 80 +++++++++++++++++++++++++++++++ toolchain/build_abacus_intel.sh | 1 + 2 files changed, 81 insertions(+) create mode 100755 toolchain/build_abacus_gcc-mkl.sh diff --git a/toolchain/build_abacus_gcc-mkl.sh b/toolchain/build_abacus_gcc-mkl.sh new file mode 100755 index 00000000000..21f1fa05b4e --- /dev/null +++ b/toolchain/build_abacus_gcc-mkl.sh @@ -0,0 +1,80 @@ +#!/bin/bash -e +#SBATCH -J build_abacus_aocl +#SBATCH -N 1 +#SBATCH -n 16 +#SBATCH -o install.log +#SBATCH -e install.err + +# Build ABACUS by gcc-mkl toolchain + +# load system env modules at first +# module load mkl compiler mpi +# source path/to/setvars.sh + +ABACUS_DIR=.. +TOOL=$(pwd) +INSTALL_DIR=$TOOL/install +source $INSTALL_DIR/setup +cd $ABACUS_DIR +ABACUS_DIR=$(pwd) + +BUILD_DIR=build_abacus_gcc_mkl +rm -rf $BUILD_DIR + +PREFIX=$ABACUS_DIR +ELPA=$INSTALL_DIR/elpa-2025.06.001/cpu +# ELPA=$INSTALL_DIR/elpa-2025.06.001/nvidia # for elpa-gpu +CEREAL=$INSTALL_DIR/cereal-master/include/cereal +LIBXC=$INSTALL_DIR/libxc-7.0.0 +RAPIDJSON=$INSTALL_DIR/rapidjson-master +LIBRI=$INSTALL_DIR/LibRI-master +LIBCOMM=$INSTALL_DIR/LibComm-master +USE_CUDA=OFF # set ON to enable gpu-abacus +# NEP_DIR=$INSTALL_DIR/NEP_CPU-main +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch +# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include +# DEEPMD=$HOME/apps/anaconda3/envs/deepmd + +cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_CXX_COMPILER=g++ \ + -DMPI_CXX_COMPILER=mpicxx \ + -DMKLROOT=$MKLROOT \ + -DENABLE_FLOAT_FFTW=ON \ + -DELPA_DIR=$ELPA \ + -DCEREAL_INCLUDE_DIR=$CEREAL \ + -DLibxc_DIR=$LIBXC \ + -DENABLE_LCAO=ON \ + -DENABLE_LIBXC=ON \ + -DUSE_OPENMP=ON \ + -DUSE_ELPA=ON \ + -DENABLE_RAPIDJSON=ON \ + -DRapidJSON_DIR=$RAPIDJSON \ + -DENABLE_LIBRI=ON \ + -DLIBRI_DIR=$LIBRI \ + -DLIBCOMM_DIR=$LIBCOMM \ + -DUSE_CUDA=$USE_CUDA \ +# -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ +# -DNEP_DIR=$NEP_DIR \ +# -DENABLE_MLALGO=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DDeePMD_DIR=$DEEPMD \ +# -DENABLE_CUSOLVERMP=ON \ + +cmake --build $BUILD_DIR -j `nproc` +cmake --install $BUILD_DIR 2>/dev/null + +# generate abacus_env.sh +cat << EOF > "${TOOL}/abacus_env.sh" +#!/bin/bash +source $INSTALL_DIR/setup +export PATH="${PREFIX}/bin":\${PATH} +EOF + +# generate information +cat << EOF +========================== usage ========================= +Done! +To use the installed ABACUS version +You need to source ${TOOL}/abacus_env.sh first ! +EOF diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index c347b623a1b..33e3f9327bd 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -40,6 +40,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=icpx \ -DMPI_CXX_COMPILER=mpiicpx \ -DMKLROOT=$MKLROOT \ + -DENABLE_FLOAT_FFTW=ON \ -DELPA_DIR=$ELPA \ -DCEREAL_INCLUDE_DIR=$CEREAL \ -DLibxc_DIR=$LIBXC \ From 5d6c96a869ab851cb74799816eaf43110e540bf7 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:37 +0800 Subject: [PATCH 11/26] Backport: Toolchain: Packages updating (#7285) Partial cherry-pick from 0f9d7d97e. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- toolchain/scripts/lib/config_manager.sh | 4 +-- toolchain/scripts/package_versions.sh | 42 +++++++++++------------ toolchain/scripts/stage1/install_mpich.sh | 6 ---- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/toolchain/scripts/lib/config_manager.sh b/toolchain/scripts/lib/config_manager.sh index 6d67bf02617..71ec05780ad 100644 --- a/toolchain/scripts/lib/config_manager.sh +++ b/toolchain/scripts/lib/config_manager.sh @@ -374,7 +374,7 @@ config_set_defaults() { # Default enable options (following original script logic) CONFIG_CACHE["dry_run"]="__FALSE__" - CONFIG_CACHE["enable_tsan"]="__FALSE__" + CONFIG_CACHE["ENABLE_TSAN"]="__FALSE__" CONFIG_CACHE["enable_opencl"]="__FALSE__" CONFIG_CACHE["enable_cuda"]="__FALSE__" CONFIG_CACHE["enable_hip"]="__FALSE__" @@ -1242,4 +1242,4 @@ config_apply_modes() { ;; esac fi -} \ No newline at end of file +} diff --git a/toolchain/scripts/package_versions.sh b/toolchain/scripts/package_versions.sh index c6e5769c2fe..713751037fd 100644 --- a/toolchain/scripts/package_versions.sh +++ b/toolchain/scripts/package_versions.sh @@ -30,41 +30,41 @@ cmake_alt_sha256_macos="3d603e507c7579b13518ef752b4ffcf3ed479fba80ee171d7d85da81 # STAGE 1: MPI Implementations # ============================================================================= -# OpenMPI (supports dual versions) - main=5.0.8, alt=4.1.6 -openmpi_main_ver="5.0.8" -openmpi_main_sha256="53131e1a57e7270f645707f8b0b65ba56048f5b5ac3f68faabed3eb0d710e449" -openmpi_alt_ver="4.1.6" -openmpi_alt_sha256="f740994485516deb63b5311af122c265179f5328a0d857a567b85db00b11e415" +# OpenMPI (supports dual versions) - main=5.0.10, alt=4.1.8 +openmpi_main_ver="5.0.10" +openmpi_main_sha256="0acecc4fc218e5debdbcb8a41d182c6b0f1d29393015ed763b2a91d5d7374cc6" +openmpi_alt_ver="4.1.8" +openmpi_alt_sha256="466f68e3132a1dc02710cc2011fafced8336d98359fa2dae4dddcfd5719f12a9" -# MPICH (supports dual versions) - main=4.3.1, alt=4.1.0 -mpich_main_ver="4.3.1" -mpich_main_sha256="acc11cb2bdc69678dc8bba747c24a28233c58596f81f03785bf2b7bb7a0ef7dc" -mpich_alt_ver="4.1.0" -mpich_alt_sha256="8b1ec63bc44c7caa2afbb457bc5b3cd4a70dbe46baba700123d67c48dc5ab6a0" +# MPICH (supports dual versions) - main=5.0.1, alt=4.3.2 +mpich_main_ver="5.0.1" +mpich_main_sha256="8c1832a13ddacf071685069f5fadfd1f2877a29e1a628652892c65211b1f3327" +mpich_alt_ver="4.3.2" +mpich_alt_sha256="47d774587a7156a53752218c811c852e70ac44db9c502dc3f399b4cb817e3818" # ============================================================================= # STAGE 2: Math Libraries # ============================================================================= -# OpenBLAS (supports dual versions) - main=0.3.30, alt=0.3.27 -openblas_main_ver="0.3.30" -openblas_main_sha256="27342cff518646afb4c2b976d809102e368957974c250a25ccc965e53063c95d" -openblas_alt_ver="0.3.27" -openblas_alt_sha256="aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897" +# OpenBLAS (supports dual versions) - main=0.3.33, alt=0.3.30 +openblas_main_ver="0.3.33" +openblas_main_sha256="6761af1d9f5d353ab4f0b7497be2643313b36c8f31caec0144bfef198e71e6ab" +openblas_alt_ver="0.3.30" +openblas_alt_sha256="27342cff518646afb4c2b976d809102e368957974c250a25ccc965e53063c95d" # ============================================================================= # STAGE 3: Scientific Computing Libraries # ============================================================================= -# ELPA (supports dual versions) - main=2025.06.001, alt=2024.05.001 -elpa_main_ver="2025.06.001" -elpa_main_sha256="feeb1fea1ab4a8670b8d3240765ef0ada828062ef7ec9b735eecba2848515c94" +# ELPA (supports dual versions) - main=2026.02.001, alt=2024.05.001 +elpa_main_ver="2026.02.001" +elpa_main_sha256="a379f27f4dbd27b2ee45017afec656d064301e97150c874649bdfd64957b75ed" elpa_alt_ver="2024.05.001" elpa_alt_sha256="9caf41a3e600e2f6f4ce1931bd54185179dade9c171556d0c9b41bbc6940f2f6" -# FFTW (supports dual versions) - Special case: both main and alt are 3.3.10 -fftw_main_ver="3.3.10" -fftw_main_sha256="56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467" +# FFTW (supports dual versions) - main=3.3.11, alt=3.3.10 +fftw_main_ver="3.3.11" +fftw_main_sha256="5630c24cdeb33b131612f7eb4b1a9934234754f9f388ff8617458d0be6f239a1" fftw_alt_ver="3.3.10" fftw_alt_sha256="56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467" diff --git a/toolchain/scripts/stage1/install_mpich.sh b/toolchain/scripts/stage1/install_mpich.sh index 82993c2505c..b171ac1a746 100755 --- a/toolchain/scripts/stage1/install_mpich.sh +++ b/toolchain/scripts/stage1/install_mpich.sh @@ -37,9 +37,6 @@ source "${INSTALLDIR}"/toolchain.env [ ${MPI_MODE} != "mpich" ] && exit 0 [ -f "${BUILDDIR}/setup_mpich" ] && rm "${BUILDDIR}/setup_mpich" -MPICH_CFLAGS="" -MPICH_LDFLAGS="" -MPICH_LIBS="" ! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}" cd "${BUILDDIR}" @@ -78,11 +75,8 @@ case "${with_mpich}" in ./configure \ --prefix="${pkg_install_dir}" \ --libdir="${pkg_install_dir}/lib" \ - MPICC="" \ FFLAGS="${FCFLAGS} ${compat_flag}" \ FCFLAGS="${FCFLAGS} ${compat_flag}" \ - --without-x \ - --enable-gl=no \ --with-device=${MPICH_DEVICE} \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log From 1cfe8015256e94412d14e4c1b90c6e1df001f07d Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:38 +0800 Subject: [PATCH 12/26] Backport: Toolchain: Remove notice of downloading master branch (#7303) Partial cherry-pick from e2bd83092. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- toolchain/scripts/stage4/install_cereal.sh | 1 - toolchain/scripts/stage4/install_libcomm.sh | 1 - toolchain/scripts/stage4/install_libnpy.sh | 1 - toolchain/scripts/stage4/install_libri.sh | 1 - toolchain/scripts/stage4/install_rapidjson.sh | 1 - 5 files changed, 5 deletions(-) diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 6ec7c593c65..f087aff9da2 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -62,7 +62,6 @@ case "$with_cereal" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of CEREAL is downloaded in GitHub master repository <===" download_pkg_from_url "${cereal_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 16ea4c58906..37c4ce69ab9 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -66,7 +66,6 @@ case "$with_libcomm" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of LibComm is downloaded in GitHub master repository <===" download_pkg_from_url "${libcomm_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index 7b59f621388..5b5bacc2b05 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -58,7 +58,6 @@ case "$with_libnpy" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of Libnpy is downloaded in GitHub Release <===" download_pkg_from_url "${libnpy_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 2ab392708f1..0efea870ff3 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -65,7 +65,6 @@ case "$with_libri" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of LibRI is downloaded in GitHub Release <===" download_pkg_from_url "${libri_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index e6b6472d804..1529911e6f1 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -64,7 +64,6 @@ case "$with_rapidjson" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of RapidJSON is downloaded in GitHub master repository <===" download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then From 6cc4f0a07794dbb77c1829f517f7c98514878df6 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:40 +0800 Subject: [PATCH 13/26] Backport: Toolchain 202601 (#7310) Partial cherry-pick from 61734d86b. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- .github/workflows/toolchain_quick.yaml | 17 +- toolchain/README.md | 59 +- toolchain/build_abacus_aocc-aocl.sh | 15 +- toolchain/build_abacus_gcc-aocl.sh | 15 +- toolchain/build_abacus_gcc-mkl.sh | 13 +- toolchain/build_abacus_gnu.sh | 19 +- toolchain/build_abacus_intel.sh | 13 +- toolchain/install_abacus_toolchain.sh | 899 ------------------ toolchain/install_abacus_toolchain_new.sh | 1 - toolchain/scripts/VERSION | 2 +- toolchain/scripts/lib/config_manager.sh | 10 +- toolchain/scripts/lib/config_validator.sh | 16 + toolchain/scripts/lib/user_interface.sh | 21 +- toolchain/scripts/stage3/install_elpa.sh | 2 +- toolchain/scripts/stage4/install_cereal.sh | 13 +- toolchain/scripts/stage4/install_libcomm.sh | 13 +- toolchain/scripts/stage4/install_libnpy.sh | 4 +- toolchain/scripts/stage4/install_libri.sh | 13 +- toolchain/scripts/stage4/install_rapidjson.sh | 9 +- toolchain/scripts/tool_kit.sh | 1 + toolchain/toolchain_aocc-aocl.sh | 4 +- toolchain/toolchain_gcc-aocl.sh | 4 +- toolchain/toolchain_gcc-mkl.sh | 114 +++ toolchain/toolchain_gnu.sh | 10 +- toolchain/toolchain_intel.sh | 2 +- 25 files changed, 277 insertions(+), 1012 deletions(-) delete mode 100755 toolchain/install_abacus_toolchain.sh create mode 100755 toolchain/toolchain_gcc-mkl.sh diff --git a/.github/workflows/toolchain_quick.yaml b/.github/workflows/toolchain_quick.yaml index e941be3f8a0..33c6a92d067 100644 --- a/.github/workflows/toolchain_quick.yaml +++ b/.github/workflows/toolchain_quick.yaml @@ -3,13 +3,13 @@ on: pull_request: paths: - toolchain/** - - .github/workflows/toolchain_quick.yml + - .github/workflows/toolchain_quick.yaml push: branches: - develop paths: - toolchain/** - - .github/workflows/toolchain_quick.yml + - .github/workflows/toolchain_quick.yaml workflow_dispatch: jobs: lint-and-sanity: @@ -43,7 +43,7 @@ jobs: shellcheck --version find toolchain -type f -name '*.sh' -print0 | xargs -0 -n1 shellcheck -x || true - dry-run-matrix: + pack-run-matrix: runs-on: ubuntu-latest strategy: fail-fast: false @@ -56,27 +56,26 @@ jobs: run: | sudo apt-get update sudo apt-get install -y dos2unix - - name: Dry run + - name: Pack run run: | set -euo pipefail cd toolchain rm -rf build install find . -type f -name '*.sh' -exec chmod +x {} + if [ "${{ matrix.variant }}" = "gnu" ]; then - ./toolchain_gnu.sh --dry-run --skip-system-checks + ./toolchain_gnu.sh --pack-run --skip-system-checks elif [ "${{ matrix.variant }}" = "intel" ]; then - ./toolchain_intel.sh --dry-run --skip-system-checks + ./toolchain_intel.sh --pack-run --skip-system-checks elif [ "${{ matrix.variant }}" = "cuda" ]; then - ./toolchain_gnu.sh --dry-run --skip-system-checks --enable-cuda --gpu-ver 70 + ./toolchain_gnu.sh --pack-run --skip-system-checks --enable-cuda --gpu-ver 70 fi - name: Upload setup if: always() uses: actions/upload-artifact@v4 with: - name: toolchain-${{ matrix.variant }}-dryrun + name: toolchain-${{ matrix.variant }}-packrun path: | toolchain/install/setup toolchain/compile.log toolchain/compile.err if-no-files-found: ignore - diff --git a/toolchain/README.md b/toolchain/README.md index 8727e7f35d6..ca9203f2506 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -1,6 +1,6 @@ # ABACUS Toolchain -[![Version](https://img.shields.io/badge/version-2025.3-blue.svg)](https://github.com/deepmodeling/abacus-develop/tree/develop/toolchain) +[![Version](https://img.shields.io/badge/version-2026.1-blue.svg)](https://github.com/deepmodeling/abacus-develop/tree/develop/toolchain) [![License](https://img.shields.io/badge/license-GPL--compatible-green.svg)](#license) [![Platform](https://img.shields.io/badge/platform-Linux-lightgrey.svg)]() @@ -138,12 +138,23 @@ For air-gapped systems or unreliable internet: # 1. Create build directory and download packages mkdir build # Download required packages to build/ directory with proper naming -# e.g., fftw-3.3.10.tar.gz, openmpi-5.0.8.tar.bz2 +# e.g., fftw-3.3.11.tar.gz, openmpi-5.0.10.tar.bz2 # 2. Run toolchain (will detect local packages) ./toolchain_gnu.sh ``` +The downloading process can be facilitated via `./toolchain_gnu.sh --pack-run`. + +Also, for users in China, we provide a Gitee mirror repository with pre-downloaded packages: +```bash +# Clone the Gitee repository in toolchain directory +git clone https://gitee.com/jamesmisaka/abacus_toolchain_build.git +# Move packages to build directory +mv abacus_toolchain_build/* build/ +# Then run toolchain normally +``` + ### Hybrid Installation Mix online and offline packages as needed - the toolchain automatically detects locally available packages and downloads missing ones. @@ -177,20 +188,20 @@ Mix online and offline packages as needed - the toolchain automatically detects | CMake | 3.31.7 / 3.30.5 | Build system | BSD-3-Clause | Install | | GCC | 13.2.0 / 11.4.0 | C/C++ compiler | GPL-3.0-or-later WITH GCC-exception-3.1 | Install | | **MPI Libraries** ||||| -| OpenMPI | 5.0.8 / 4.1.6 | MPI implementation | BSD-3-Clause-Open-MPI | Install | -| MPICH | 4.3.1 / 4.1.0 | Alternative MPI | mpich2 (BSD-like) | Alternative | +| OpenMPI | 5.0.10 / 4.1.8 | MPI implementation | BSD-3-Clause-Open-MPI | Install | +| MPICH | 5.0.1 / 4.3.2 | Alternative MPI | mpich2 (BSD-like) | Alternative | | **Math Libraries** ||||| -| OpenBLAS | 0.3.30 / 0.3.27 | Linear algebra | BSD-3-Clause | Install | -| ScaLAPACK | 2.2.2 / 2.2.1 | Parallel linear algebra | BSD-3-Clause | Install | +| OpenBLAS | 0.3.33 / 0.3.30 | Linear algebra | BSD-3-Clause | Install | +| ScaLAPACK | 2.2.3 / 2.2.1 | Parallel linear algebra | BSD-3-Clause | Install | | **Scientific Libraries** ||||| -| FFTW | 3.3.10 / 3.3.10 | Fast Fourier Transform | GPL-2.0-or-later | Install | +| FFTW | 3.3.11 / 3.3.10 | Fast Fourier Transform | GPL-2.0-or-later | Install | | LibXC | 7.0.0 / 6.2.2 | Exchange-correlation | MPL-2.0 | Install | -| ELPA | 2025.06.001 / 2024.05.001 | Eigenvalue solver | LGPL-3.0-only | Install | +| ELPA | 2026.02.001 / 2024.05.001 | Eigenvalue solver | LGPL-3.0-only | Install | | **Advanced Features** ||||| -| Cereal | master | C++ Serialization | BSD | Install | -| RapidJSON | master | JSON parsing | MIT | Install | -| LibRI | master | EXX calculations | GPL-3.0 | Install | -| LibComm | master | EXX calculations | GPL-3.0 | Install | +| Cereal | pinned commit | C++ Serialization | BSD | Install | +| RapidJSON | pinned commit | JSON parsing | MIT | Install | +| LibRI | pinned commit | EXX calculations | GPL-3.0 | Install | +| LibComm | pinned commit | EXX calculations | GPL-3.0 | Install | | LibTorch | 2.1.2 / 1.12.1 | MLALGO support | BSD-3-Clause | Optional | | LibNPY | 1.0.1 / 1.0.1 | NumPy I/O | MIT | Optional | | NEP | main | Neuroevolution potential | MIT | Optional | @@ -225,11 +236,11 @@ One can also manually edit the `toolchain_gnu.sh` for selecting specific version # Refer to scripts/package_versions.sh for specific version numbers CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 -OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 -OPENBLAS_VERSION="main" # main=0.3.30, alt=0.3.27 -ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 +OPENMPI_VERSION="main" # main=5.0.10, alt=4.1.8 +OPENBLAS_VERSION="main" # main=0.3.33, alt=0.3.30 +ELPA_VERSION="main" # main=2026.02.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 -SCALAPACK_VERSION="main" # main=2.2.2, alt=2.2.1 +SCALAPACK_VERSION="main" # main=2.2.3, alt=2.2.1 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) ``` @@ -472,19 +483,6 @@ NPROCS_OVERWRITE=4 ./toolchain_gnu.sh --with-gcc --with-openmpi - **CI/CD environments**: Match container resource limits - **Debugging**: Use single-core compilation for clearer error messages -### Legacy Script Options - -The deprecated `install_abacus_toolchain.sh` supports additional options: - -| Option | Description | Availability | -|--------|-------------|--------------| -| `--dry-run` | Test configuration without installation | ✅ New & Legacy | -| `--pack-run` | Download packages without building | ✅ New & Legacy | -| `--no-check-certificate` | Skip SSL certificate verification | ⚠️ Legacy only (use `DOWNLOAD_CERT_POLICY=skip`) | -| `-j N` | Limit parallel compilation processes | ⚠️ Legacy only (use `NPROCS_OVERWRITE=N`) | - -> **Migration Note**: The new toolchain system (`toolchain_*.sh` scripts) is recommended over the legacy `install_abacus_toolchain.sh`. Legacy options like `--no-check-certificate` and `-j N` are replaced by environment variables `DOWNLOAD_CERT_POLICY` and `NPROCS_OVERWRITE` respectively. - ### Environment Management The toolchain generates several setup files: @@ -514,7 +512,6 @@ scripts/ | File | Purpose | |------|---------| | `install_abacus_toolchain_new.sh` | Main orchestration script (new version) | -| `install_abacus_toolchain.sh` | Legacy main script (deprecated) | | `toolchain_*.sh` | Frontend scripts for specific toolchains | | `scripts/lib/config_manager.sh` | Configuration management | | `scripts/lib/package_manager.sh` | Package installation logic | @@ -522,7 +519,7 @@ scripts/ | `scripts/common_vars.sh` | Shared variables and defaults | | `scripts/tool_kit.sh` | Utility functions and macros | | `scripts/parse_if.py` | Parser for IF_XYZ constructs | -| `checksums.sha256` | Pre-calculated SHA256 checksums for packages | +| `install//install_successful` | Per-package install lock/checksum file generated by `write_checksums` | ### Script Structure Details diff --git a/toolchain/build_abacus_aocc-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh index a586442421b..b2249137655 100755 --- a/toolchain/build_abacus_aocc-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -22,16 +22,15 @@ BUILD_DIR=build_abacus_aocc_aocl rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2025.06.001/cpu -# ELPA=$INSTALL_DIR/elpa-2025.06.001/nvidia # for elpa-gpu -CEREAL=$INSTALL_DIR/cereal-master/include/cereal -LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-master +ELPA=${ELPA_ROOT} +CEREAL=${CEREAL_ROOT}/include +LIBXC=${LIBXC_ROOT} +RAPIDJSON=${RAPIDJSON_ROOT} LAPACK=$AOCLhome/lib SCALAPACK=$AOCLhome/lib FFTW3=$AOCLhome -LIBRI=$INSTALL_DIR/LibRI-master -LIBCOMM=$INSTALL_DIR/LibComm-master +LIBRI=${LIBRI_ROOT} +LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus # NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch @@ -84,4 +83,4 @@ cat << EOF Done! To use the installed ABACUS version You need to source ${TOOL}/abacus_env.sh first ! -EOF \ No newline at end of file +EOF diff --git a/toolchain/build_abacus_gcc-aocl.sh b/toolchain/build_abacus_gcc-aocl.sh index 65e2491ee90..949f7d43ef6 100755 --- a/toolchain/build_abacus_gcc-aocl.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -22,16 +22,15 @@ BUILD_DIR=build_abacus_gcc_aocl rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2025.06.001/cpu -# ELPA=$INSTALL_DIR/elpa-2025.06.001/nvidia # for elpa-gpu -CEREAL=$INSTALL_DIR/cereal-master/include/cereal -LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-master +ELPA=${ELPA_ROOT} +CEREAL=${CEREAL_ROOT}/include +LIBXC=${LIBXC_ROOT} +RAPIDJSON=${RAPIDJSON_ROOT} LAPACK=$AOCLhome/lib SCALAPACK=$AOCLhome/lib FFTW3=$AOCLhome -LIBRI=$INSTALL_DIR/LibRI-master -LIBCOMM=$INSTALL_DIR/LibComm-master +LIBRI=${LIBRI_ROOT} +LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus # NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch @@ -82,4 +81,4 @@ cat << EOF Done! To use the installed ABACUS version You need to source ${TOOL}/abacus_env.sh first ! -EOF \ No newline at end of file +EOF diff --git a/toolchain/build_abacus_gcc-mkl.sh b/toolchain/build_abacus_gcc-mkl.sh index 21f1fa05b4e..e35f2be558f 100755 --- a/toolchain/build_abacus_gcc-mkl.sh +++ b/toolchain/build_abacus_gcc-mkl.sh @@ -22,13 +22,12 @@ BUILD_DIR=build_abacus_gcc_mkl rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2025.06.001/cpu -# ELPA=$INSTALL_DIR/elpa-2025.06.001/nvidia # for elpa-gpu -CEREAL=$INSTALL_DIR/cereal-master/include/cereal -LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-master -LIBRI=$INSTALL_DIR/LibRI-master -LIBCOMM=$INSTALL_DIR/LibComm-master +ELPA=${ELPA_ROOT} +CEREAL=${CEREAL_ROOT}/include +LIBXC=${LIBXC_ROOT} +RAPIDJSON=${RAPIDJSON_ROOT} +LIBRI=${LIBRI_ROOT} +LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus # NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 37f5603f6ea..749cd967a46 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -20,16 +20,15 @@ BUILD_DIR=build_abacus_gnu rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -LAPACK=$INSTALL_DIR/openblas-0.3.30/lib -SCALAPACK=$INSTALL_DIR/scalapack-2.2.2/lib -ELPA=$INSTALL_DIR/elpa-2025.06.001/cpu -# ELPA=$INSTALL_DIR/elpa-2025.06.001/nvidia # for elpa-gpu -FFTW3=$INSTALL_DIR/fftw-3.3.10 -CEREAL=$INSTALL_DIR/cereal-master/include/cereal -LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-master/ -LIBRI=$INSTALL_DIR/LibRI-master -LIBCOMM=$INSTALL_DIR/LibComm-master +LAPACK=${OPENBLAS_ROOT}/lib +SCALAPACK=${SCALAPACK_ROOT}/lib +ELPA=${ELPA_ROOT} +FFTW3=${FFTW_ROOT} +CEREAL=${CEREAL_ROOT}/include +LIBXC=${LIBXC_ROOT} +RAPIDJSON=${RAPIDJSON_ROOT} +LIBRI=${LIBRI_ROOT} +LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus # NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 33e3f9327bd..34bc5a4db2e 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -22,13 +22,12 @@ BUILD_DIR=build_abacus_intel rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2024.05.001/cpu -# ELPA=$INSTALL_DIR/elpa-2024.05.001/nvidia # for gpu-lcao -CEREAL=$INSTALL_DIR/cereal-master/include -LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-master -LIBRI=$INSTALL_DIR/LibRI-master -LIBCOMM=$INSTALL_DIR/LibComm-master +ELPA=${ELPA_ROOT} +CEREAL=${CEREAL_ROOT}/include +LIBXC=${LIBXC_ROOT} +RAPIDJSON=${RAPIDJSON_ROOT} +LIBRI=${LIBRI_ROOT} +LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus # NEP_DIR=$INSTALL_DIR/NEP_CPU-main # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh deleted file mode 100755 index 19fe2328aba..00000000000 --- a/toolchain/install_abacus_toolchain.sh +++ /dev/null @@ -1,899 +0,0 @@ -#!/bin/bash -e - -# TODO: Remove this deprecated script in the future. -# shellcheck disable=all - -[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 -SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)" - -# ------------------------------------------------------------------------ -# Work directories and used files -# ------------------------------------------------------------------------ -export ROOTDIR="${PWD}" -export SCRIPTDIR="${ROOTDIR}/scripts" -export BUILDDIR="${ROOTDIR}/build" -export INSTALLDIR="${ROOTDIR}/install" -export SETUPFILE="${INSTALLDIR}/setup" -export SHA256_CHECKSUM="${SCRIPTDIR}/checksums.sha256" - -# ------------------------------------------------------------------------ -# Make a copy of all options for $SETUPFILE -# ------------------------------------------------------------------------ -TOOLCHAIN_OPTIONS="$@" - -# ------------------------------------------------------------------------ -# DEPRECATED WARNING -# ------------------------------------------------------------------------ -echo "" -echo -e "\033[1;31m╔══════════════════════════════════════════════════════════════════════════════╗\033[0m" -echo -e "\033[1;31m║ [DEPRECATED] ║\033[0m" -echo -e "\033[1;31m║ ║\033[0m" -echo -e "\033[1;33m║ This script (install_abacus_toolchain.sh) will be deprecated soon. ║\033[0m" -echo -e "\033[1;33m║ ║\033[0m" -echo -e "\033[1;32m║ Please migrate to the refactored version: ║\033[0m" -echo -e "\033[1;32m║ → install_abacus_toolchain_new.sh ║\033[0m" -echo -e "\033[1;32m║ ║\033[0m" -echo -e "\033[1;36m║ Migration Guide: ║\033[0m" -echo -e "\033[1;36m║ • Use toolchain_*.sh frontend scripts for easier configuration ║\033[0m" -echo -e "\033[1;36m║ • New version supports main/alt package version switch ║\033[0m" -echo -e "\033[1;36m║ • Improved parameter handling and error reporting ║\033[0m" -echo -e "\033[1;31m║ ║\033[0m" -echo -e "\033[1;31m╚══════════════════════════════════════════════════════════════════════════════╝\033[0m" -echo "" -echo -e "\033[1;33mContinuing with legacy script in 3 seconds...\033[0m" -sleep 3 -echo "" - -# ------------------------------------------------------------------------ -# Load common variables and tools -# ------------------------------------------------------------------------ -source "${SCRIPTDIR}"/common_vars.sh -source "${SCRIPTDIR}"/tool_kit.sh - -# ------------------------------------------------------------------------ -# Documentation -# ------------------------------------------------------------------------ -show_help() { - cat << EOF -This script will help you compile and install, -or link libraries ABACUS depends on, -and give setup files that you can use to compile ABACUS. - -USAGE: - -$(basename $SCRIPT_NAME) [options] - -A MORE RECOMMENDED way is to use it by pre-setting workflow scripts: -> gcc-openmpi-openblas environments: toolchain_gnu.sh -> intel-mkl-mpi environments: toolchain_intel.sh -> intel-mpich environments: toolchain_intel_mpich.sh -> AMD environments: toolchain_amd.sh [in development] - -OPTIONS: - --h, --help Show this message. --j Number of processors to use for compilation, if - this option is not present, then the script - automatically tries to determine the number of - processors you have and try to use all of the - processors. ---no-check-certificate If you encounter "certificate verification" errors - from wget or ones saying that "common name doesn't - match requested host name" while at tarball downloading - stage, then the recommended solution is to install - the newest wget release. Alternatively, you can use - this option to bypass the verification and proceed with - the download. Security wise this should still be okay - as the installation script will check file checksums - after every tarball download. Nevertheless use this - option at your own risk. ---install-all This option will set value of all --with-PKG - options to "install". You can selectively set - --with-PKG to another value again by having the - --with-PKG option placed AFTER this option on the - command line. ---mpi-mode Selects which MPI flavour to use. Available options - are: mpich, openmpi, intelmpi, and no. By selecting "no", - MPI is not supported and disabled. By default the script - will try to determine the flavour based on the MPI library - currently available in your system path. For CRAY (CLE) - systems, the default flavour is mpich. Note that explicitly - setting --with-mpich, --with-openmpi or --with-intelmpi - options to values other than no will also switch --mpi-mode - to the respective mode. ---math-mode Selects which core math library to use. Available options - are: cray, mkl, and openblas. The option "cray" - corresponds to cray libsci, and is the default for CRAY - (CLE) systems. For non-CRAY systems, if env variable MKLROOT - exists then mkl will be default, otherwise openblas is the - default option. Explicitly setting --with-mkl, - or --with-openblas options will switch --math-mode to the - respective modes. ---gpu-ver Selects the GPU architecture for which to compile. Available - options: CUDA architecture number (7.5 / 75, 8.0 / 80, etc) or no - This setting determines the value of nvcc's '-arch' flag. - Default = no. ---log-lines Number of log file lines dumped in case of a non-zero exit code. - Default = 200 ---target-cpu Compile for the specified target CPU (e.g. haswell or generic), i.e. - do not optimize for the actual host system which is the default (native) ---dry-run Write only config files, but don't actually build packages. ---pack-run Only check and install required packages without actually unpack and build packages - -The --enable-FEATURE options follow the rules: - --enable-FEATURE=yes Enable this particular feature - --enable-FEATURE=no Disable this particular feature - --enable-FEATURE The option keyword alone is equivalent to - --enable-FEATURE=yes - ===== NOTICE: THESE GPU FEATURE IS ON TESTING ===== - --enable-cuda Turn on GPU (CUDA) support (can be combined - with --enable-opencl). - Default = no - --enable-hip Turn on GPU (HIP) support. - Default = no - --enable-opencl Turn on OpenCL (GPU) support. Requires the OpenCL - development packages and runtime. If combined with - --enable-cuda, OpenCL alongside of CUDA is used. - Default = no - --enable-cray Turn on or off support for CRAY Linux Environment - (CLE) manually. By default the script will automatically - detect if your system is CLE, and provide support - accordingly. - -The --with-PKG options follow the rules: - --with-PKG=install Will download the package in \$PWD/build and - install the library package in \$PWD/install. - --with-PKG=system The script will then try to find the required - libraries of the package from the system path - variables such as PATH, LD_LIBRARY_PATH and - CPATH etc. - --with-PKG=no Do not use the package. - --with-PKG= The package will be assumed to be installed in - the given , and be linked accordingly. - --with-PKG The option keyword alone will be equivalent to - --with-PKG=install - - --with-gcc Use the GNU compiler to use to build ABACUS. - Default = system - --with-intel Use the Intel compiler to build ABACUS. - Default = system - --with-intel-classic Use the classic Intel compiler (icc, icpc, ifort) to compile ABACUS. - Default = no - --with-ifx Use the new Intel Fortran compiler ifx instead of ifort to compile dependence of ABACUS, along with mpiifx (if --with-intel-classic=no) - Default = yes - --with-amd Use the AMD compiler to build ABACUS. - Default = system - --with-flang Use flang in AMD compiler, which may lead to problem and efficiency loss in ELPA - Default = no - --with-cmake Cmake utilities - Default = install - --with-openmpi OpenMPI, important if you want a parallel version of ABACUS. - Default = system - --with-mpich MPICH, MPI library like OpenMPI. one should - use only one of OpenMPI, MPICH or Intel MPI. - Default = system - --with-mpich-device Select the MPICH device, implies the use of MPICH as MPI library - Default = ch4 - --with-intelmpi Intel MPI, MPI library like OpenMPI. one should - use only one of OpenMPI, MPICH or Intel MPI. - Default = system - --with-intel-mpi-clas Use the classic Intelmpi compiler (mpiicc, mpiicpc and mpiifort) - Default = no - --with-libxc libxc, exchange-correlation library. Needed for - QuickStep DFT and hybrid calculations. - Default = install - --with-fftw FFTW3, library for fast fourier transform - Default = install - --with-mkl Intel Math Kernel Library, which provides LAPACK, and BLAS. - If MKL's FFTW3 interface is suitable (no FFTW-MPI support), - it replaces the FFTW library. If the ScaLAPACK component is - found, it replaces the one specified by --with-scalapack. - Default = system - --with-aocl AMD Optimizing CPU Libraries, which provides LAPACK, BLAS, FFTW, ScaLAPACK - the ScaLAPACK and FFTW can directly use which in AOCL by setting --with-scalapack=system and --with-fftw=system if AOCL in system environment. - related scripts are in development to incorporate scalapack and fftw once for all. - Default = system - --with-openblas OpenBLAS is a free high performance LAPACK and BLAS library, - the successor to GotoBLAS. - Default = install - --with-scalapack Parallel linear algebra library, needed for parallel - calculations. - Default = install - --with-elpa Eigenvalue SoLvers for Petaflop-Applications library. - Fast library for large parallel jobs, Especially for ABACUS LCAO - Default = install - --with-cereal Enable cereal for ABACUS LCAO - Default = install - --with-rapidjson Enable rapidjson for ABACUS to read/write json files - Default = install - --with-libtorch Enable libtorch the machine learning framework needed for DeePKS - Default = no - --with-libnpy Enable libnpy the machine learning framework needed for DeePKS - Default = no - --with-libri Enable LibRI for higher-level methods like hybrid functionals, RPA or GW - Default = no - --with-libcomm Enable LibComm for higher-level methods like hybrid functionals, RPA or GW - Default = no - --with-nep Enable NEP (CPU version) for machine learning potentials - Default = no - -FURTHER INSTRUCTIONS - -All packages to be installed locally will be downloaded and built inside -./build, and then installed into package specific directories inside -./install. - -Both ./build and ./install are safe to delete, as they contain -only the files and directories that are generated by this script. However, -once all the packages are installed, and you compile ABACUS using the setup -files provided by this script, then you must keep ./install in exactly -the same location as it was first created, as it contains tools and libraries -your version of ABACUS binary will depend on. - -It should be safe to terminate running of this script in the middle of a -build process. The script will know if a package has been successfully -installed, and will just carry on and recompile and install the last -package it is working on. This is true even if you lose the content of -the entire ./build directory. - - +----------------------------------------------------------------+ - | YOU SHOULD ALWAYS SOURCE ./install/setup or ./abacus_env.sh | - | BEFORE YOU RUN ABACUS COMPILED WITH THIS TOOLCHAIN | - +----------------------------------------------------------------+ - -EOF -} - -# ------------------------------------------------------------------------ -# PACKAGE LIST: register all new dependent tools and libs here. Order -# is important, the first in the list gets installed first -# ------------------------------------------------------------------------ -tool_list="gcc intel amd cmake" -mpi_list="mpich openmpi intelmpi" -math_list="mkl aocl openblas" -lib_list="fftw libxc scalapack elpa cereal rapidjson libtorch libnpy libri libcomm nep" -package_list="${tool_list} ${mpi_list} ${math_list} ${lib_list}" -# ------------------------------------------------------------------------ - -# first set everything to __DONTUSE__ -for ii in ${package_list}; do - eval with_${ii}="__DONTUSE__" -done - -# ------------------------------------------------------------------------ -# Work out default settings -# ------------------------------------------------------------------------ - -# tools to turn on by default: -with_gcc="__SYSTEM__" - -# libs to turn on by default, the math and mpi libraries are chosen by there respective modes: -with_fftw="__INSTALL__" -with_libxc="__INSTALL__" -with_scalapack="__INSTALL__" -# default math library setting: openblas -export MATH_MODE="openblas" -with_openblas="__INSTALL__" -with_elpa="__INSTALL__" -with_cereal="__INSTALL__" -with_rapidjson="__INSTALL__" -# with_libtorch="__DONTUSE__" # default -# with_libnpy="__DONTUSE__" -# with_libri="__DONTUSE__" -# with_libcomm="__DONTUSE__" -# for MPI, we try to detect system MPI variant -if (command -v mpiexec > /dev/null 2>&1); then - # check if we are dealing with openmpi, mpich or intelmpi - if (mpiexec --version 2>&1 | grep -s -q "HYDRA"); then - echo "MPI is detected and it appears to be MPICH" - export MPI_MODE="mpich" - with_mpich="__SYSTEM__" - elif (mpiexec --version 2>&1 | grep -s -q "OpenRTE"); then - echo "MPI is detected and it appears to be OpenMPI" - export MPI_MODE="openmpi" - with_openmpi="__SYSTEM__" - elif (mpiexec --version 2>&1 | grep -s -q "Intel"); then - echo "MPI is detected and it appears to be Intel MPI" - with_gcc="__DONTUSE__" - with_amd="__DONTUSE__" - with_aocl="__DONTUSE__" - with_intel="__SYSTEM__" - with_intelmpi="__SYSTEM__" - export MPI_MODE="intelmpi" - else # default to mpich - echo "MPI is detected and defaults to MPICH" - export MPI_MODE="mpich" - with_mpich="__SYSTEM__" - fi -else - report_warning $LINENO "No MPI installation detected (ignore this message in Cray Linux Environment or when MPI installation was requested)." - export MPI_MODE="no" -fi - -# default enable options -dry_run="__FALSE__" -enable_tsan="__FALSE__" -enable_opencl="__FALSE__" -enable_cuda="__FALSE__" -enable_hip="__FALSE__" -export intel_classic="no" -# no, then icc->icx, icpc->icpx -# which cannot compile elpa in AMD server -# due to some so-called cross-compile problem -# and will lead to problem in force calculation -# but icx is recommended by intel compiler -# option: --with-intel-classic can change it to yes/no -# QuantumMisaka by 2023.08 -export PACK_RUN="__FALSE__" -export INTELMPI_CLASSIC="no" -export WITH_IFX="yes" # whether ifx is used in oneapi -export WITH_FLANG="no" # whether flang is used in aocc -export OPENMPI_4TH="no" # whether openmpi downgrade -export GPUVER="no" -export MPICH_DEVICE="ch4" -export TARGET_CPU="native" - -# default for log file dump size -export LOG_LINES="200" - -# defaults for CRAY Linux Environment -if [ "${CRAY_LD_LIBRARY_PATH}" ]; then - enable_cray="__TRUE__" - export MATH_MODE="cray" - # Default MPI used by CLE is assumed to be MPICH, in any case - # do not use the installers for the MPI libraries - with_mpich="__DONTUSE__" - with_openmpi="__DONTUSE__" - with_intelmpi="__DONTUSE__" - export MPI_MODE="mpich" - # set default value for some installers appropriate for CLE - with_gcc="__DONTUSE__" - with_amd="__DONTUSE__" - with_aocl="__DONTUSE__" - with_intel="__DONTUSE__" - with_fftw="__SYSTEM__" - with_scalapack="__DONTUSE__" -else - enable_cray="__FALSE__" -fi - -# ------------------------------------------------------------------------ -# parse user options -# ------------------------------------------------------------------------ -while [ $# -ge 1 ]; do - case ${1} in - -j) - case "${2}" in - -*) - export NPROCS_OVERWRITE="$(get_nprocs)" - ;; - [0-9]*) - shift - export NPROCS_OVERWRITE="${1}" - ;; - *) - report_error ${LINENO} \ - "The -j flag can only be followed by an integer number, found ${2}." - exit 1 - ;; - esac - ;; - -j[0-9]*) - export NPROCS_OVERWRITE="${1#-j}" - ;; - --no-check-certificate) - export DOWNLOADER_FLAGS="--no-check-certificate" - ;; - --install-all) - # set all package to the default installation status - for ii in ${package_list}; do - if [ "${ii}" != "intel" ] && - [ "${ii}" != "intelmpi" ] && - [ "${ii}" != "amd" ]; then - eval with_${ii}="__INSTALL__" - fi - done - # I'd like to use OpenMPI as default -- QuantumMisaka in 2023.09.17 - export MPI_MODE="openmpi" - ;; - --mpi-mode=*) - user_input="${1#*=}" - case "$user_input" in - mpich) - export MPI_MODE="mpich" - ;; - openmpi) - export MPI_MODE="openmpi" - ;; - intelmpi) - export MPI_MODE="intelmpi" - ;; - no) - export MPI_MODE="no" - ;; - *) - report_error ${LINENO} \ - "--mpi-mode currently only supports openmpi, mpich, intelmpi and no as options" - exit 1 - ;; - esac - ;; - --math-mode=*) - user_input="${1#*=}" - case "$user_input" in - cray) - export MATH_MODE="cray" - ;; - aocl) - export MATH_MODE="aocl" - with_aocl="__SYSTEM__" - with_fftw="__SYSTEM__" - with_scalapack="__SYSTEM__" - ;; - mkl) - export MATH_MODE="mkl" - ;; - openblas) - export MATH_MODE="openblas" - ;; - *) - report_error ${LINENO} \ - "--math-mode currently only supports mkl, aocl, openblas and cray as options" - ;; - esac - ;; - --gpu-ver=*) - user_input="${1#*=}" - export GPUVER="${user_input}" - ;; - --target-cpu=*) - user_input="${1#*=}" - export TARGET_CPU="${user_input}" - ;; - --log-lines=*) - user_input="${1#*=}" - export LOG_LINES="${user_input}" - ;; - --dry-run) - dry_run="__TRUE__" - ;; - --pack-run) - PACK_RUN="__TRUE__" - ;; - --enable-tsan*) - enable_tsan=$(read_enable $1) - if [ "${enable_tsan}" = "__INVALID__" ]; then - report_error "invalid value for --enable-tsan, please use yes or no" - exit 1 - fi - ;; - --enable-cuda*) - enable_cuda=$(read_enable $1) - if [ $enable_cuda = "__INVALID__" ]; then - report_error "invalid value for --enable-cuda, please use yes or no" - exit 1 - fi - ;; - --enable-hip*) - enable_hip=$(read_enable $1) - if [ "${enable_hip}" = "__INVALID__" ]; then - report_error "invalid value for --enable-hip, please use yes or no" - exit 1 - fi - ;; - --enable-opencl*) - enable_opencl=$(read_enable $1) - if [ $enable_opencl = "__INVALID__" ]; then - report_error "invalid value for --enable-opencl, please use yes or no" - exit 1 - fi - ;; - --enable-cray*) - enable_cray=$(read_enable $1) - if [ "${enable_cray}" = "__INVALID__" ]; then - report_error "invalid value for --enable-cray, please use yes or no" - exit 1 - fi - ;; - --with-gcc*) - with_gcc=$(read_with "${1}") - ;; - --with-cmake*) - with_cmake=$(read_with "${1}") - ;; - --with-mpich-device=*) - user_input="${1#*=}" - export MPICH_DEVICE="${user_input}" - export MPI_MODE=mpich - ;; - --with-mpich*) - with_mpich=$(read_with "${1}") - if [ "${with_mpich}" != "__DONTUSE__" ]; then - export MPI_MODE=mpich - fi - ;; - --with-4th-openmpi*) - OPENMPI_4TH=$(read_with "${1}" "no") # default new openmpi - ;; - --with-openmpi*) - with_openmpi=$(read_with "${1}") - if [ "${with_openmpi}" != "__DONTUSE__" ]; then - export MPI_MODE=openmpi - fi - ;; - --with-intelmpi*) - with_intelmpi=$(read_with "${1}" "__SYSTEM__") - if [ "${with_intelmpi}" != "__DONTUSE__" ]; then - export MPI_MODE=intelmpi - fi - ;; - --with-intel-classic*) - intel_classic=$(read_with "${1}" "no") # default new intel compiler - ;; - --with-intel-mpi-clas*) - INTELMPI_CLASSIC=$(read_with "${1}" "no") # default new intel mpi compiler - ;; - --with-intel*) # must be read after items above - with_intel=$(read_with "${1}" "__SYSTEM__") - ;; - --with-ifx*) - WITH_IFX=$(read_with "${1}" "yes") # default yes - ;; - --with-amd*) - with_amd=$(read_with "${1}" "__SYSTEM__") - ;; - --with-flang*) - WITH_FLANG=$(read_with "${1}" "no") - ;; - --with-aocl*) - with_aocl=$(read_with "${1}" "__SYSTEM__") - ;; - --with-libxc*) - with_libxc=$(read_with "${1}") - ;; - --with-fftw*) - with_fftw=$(read_with "${1}") - ;; - --with-mkl*) - with_mkl=$(read_with "${1}" "__SYSTEM__") - if [ "${with_mkl}" != "__DONTUSE__" ]; then - export MATH_MODE="mkl" - fi - ;; - --with-openblas*) - with_openblas=$(read_with "${1}") - if [ "${with_openblas}" != "__DONTUSE__" ]; then - export MATH_MODE="openblas" - fi - ;; - --with-scalapack*) - with_scalapack=$(read_with "${1}") - ;; - --with-elpa*) - with_elpa=$(read_with "${1}") - ;; - --with-libtorch*) - with_libtorch=$(read_with "${1}") - ;; - --with-cereal*) - with_cereal=$(read_with "${1}") - ;; - --with-rapidjson*) - with_rapidjson=$(read_with "${1}") - ;; - --with-libnpy*) - with_libnpy=$(read_with "${1}") - ;; - --with-libri*) - with_libri=$(read_with "${1}") - ;; - --with-libcomm*) - with_libcomm=$(read_with "${1}") - ;; - --with-nep*) - with_nep=$(read_with "${1}") - ;; - --help*) - show_help - exit 0 - ;; - -h*) - show_help - exit 0 - ;; - *) - report_error "Unknown flag: $1" - exit 1 - ;; - esac - shift -done - -# consolidate settings after user input -export ENABLE_TSAN="${enable_tsan}" -export ENABLE_CUDA="${enable_cuda}" -export ENABLE_HIP="${enable_hip}" -export ENABLE_OPENCL="${enable_opencl}" -export ENABLE_CRAY="${enable_cray}" - -# ------------------------------------------------------------------------ -# Check and solve known conflicts before installations proceed -# ------------------------------------------------------------------------ -# Check GCC version: -# Quantum Misaka in 2025-05-05 -if [ "${with_gcc}" != "__INSTALL__" ] -then - export GCC_MIN_VERSION=5 - echo "Checking system GCC version for gcc, intel and amd toolchain" - echo "Your System gcc/g++/gfortran version should be consistent" - echo "Minimum required version: ${GCC_MIN_VERSION}" - gcc_version=$(gcc --version | head -n 1 | awk '{print $NF}') - gxx_version=$(g++ --version | head -n 1 | awk '{print $NF}') - gfc_version=$(gfortran --version | head -n 1 | awk '{print $NF}') - echo "Your gcc version: ${gcc_version}" - echo "Your g++ version: ${gxx_version}" - echo "Your gfortran version: ${gfc_version}" - - if [ "${gcc_version}" != "${gxx_version}" ] || [ "${gcc_version}" != "${gfc_version}" ]; then - echo "Your gcc/g++/gfortran version are not consistent !!!" - exit 1 - fi - - extract_major() { - echo $1 | awk -F. '{print $1}' - } - - gcc_major=$(extract_major "${gcc_version}") - if [ "${gcc_major}" -lt "${GCC_MIN_VERSION}" ] - then - echo "Your GCC version do not be larger than ${GCC_MIN_VERSION} !!!" - exit 1 - fi - echo "Your GCC version seems to be enough for ABACUS installation." -fi - -# Compiler conflicts -if [ "${with_intel}" != "__DONTUSE__" ] && [ "${with_gcc}" = "__INSTALL__" ]; then - echo "You have chosen to use the Intel compiler, therefore the installation of the GNU compiler will be skipped." - with_gcc="__SYSTEM__" -fi -if [ "${with_amd}" != "__DONTUSE__" ] && [ "${with_gcc}" = "__INSTALL__" ]; then - echo "You have chosen to use the AMD compiler, therefore the installation of the GNU compiler will be skipped." - with_gcc="__SYSTEM__" -fi -if [ "${with_amd}" != "__DONTUSE__" ] && [ "${with_intel}" != "__DONTUSE__" ]; then - report_error "You have chosen to use the AMD and the Intel compiler to compile dependent packages. Select only one compiler." - exit 1 -fi - -# MPI library conflicts -if [ "${MPI_MODE}" = "no" ]; then - if [ "${with_scalapack}" != "__DONTUSE__" ]; then - echo "Not using MPI, so scalapack is disabled." - with_scalapack="__DONTUSE__" - fi - if [ "${with_elpa}" != "__DONTUSE__" ]; then - echo "Not using MPI, so ELPA is disabled." - with_elpa="__DONTUSE__" - fi -else - # if gcc is installed, then mpi needs to be installed too - if [ "${with_gcc}" = "__INSTALL__" ]; then - echo "You have chosen to install the GNU compiler, therefore MPI libraries have to be installed too" - case ${MPI_MODE} in - mpich) - with_mpich="__INSTALL__" - with_openmpi="__DONTUSE__" - ;; - openmpi) - with_mpich="__DONTUSE__" - with_openmpi="__INSTALL__" - ;; - esac - echo "and the use of the Intel compiler and Intel MPI will be disabled." - with_intel="__DONTUSE__" - with_intelmpi="__DONTUSE__" - fi - # Enable only one MPI implementation - case ${MPI_MODE} in - mpich) - with_openmpi="__DONTUSE__" - with_intelmpi="__DONTUSE__" - ;; - openmpi) - with_mpich="__DONTUSE__" - with_intelmpi="__DONTUSE__" - ;; - intelmpi) - with_mpich="__DONTUSE__" - with_openmpi="__DONTUSE__" - ;; - esac -fi -# If MATH_MODE is mkl ,then openblas, scalapack and fftw is not needed -# QuantumMisaka in 2023-09-17 -if [ "${MATH_MODE}" = "mkl" ]; then - if [ "${with_openblas}" != "__DONTUSE__" ]; then - echo "Using MKL, so openblas is disabled." - with_openblas="__DONTUSE__" - fi - if [ "${with_scalapack}" != "__DONTUSE__" ]; then - echo "Using MKL, so scalapack is disabled." - with_scalapack="__DONTUSE__" - fi - if [ "${with_fftw}" != "__DONTUSE__" ]; then - echo "Using MKL, so fftw is disabled." - with_fftw="__DONTUSE__" - fi -fi - -# Select the correct compute number based on the GPU architecture -# QuantumMisaka in 2025-03-19 -export ARCH_NUM="${GPUVER//.}" - -# If CUDA or HIP are enabled, make sure the GPU version has been defined. -if [ "${ENABLE_CUDA}" = "__TRUE__" ] || [ "${ENABLE_HIP}" = "__TRUE__" ]; then - if [ "${GPUVER}" = "no" ]; then - report_error "Please choose GPU architecture to compile for with --gpu-ver" - exit 1 - fi - if [[ "$ARCH_NUM" =~ ^[1-9][0-9]*$ ]] || [ $ARCH_NUM = "no" ]; then - echo "Notice: GPU compilation is enabled, and GPU compatibility is set via --gpu-ver to sm_${ARCH_NUM}." - else - report_error ${LINENO} \ - "When GPU compilation is enabled, the --gpu-ver variable should be properly set regarding to GPU compatibility. For check your GPU compatibility, visit https://developer.nvidia.com/cuda-gpus. For example: A100 -> 8.0 (or 80), V100 -> 7.0 (or 70), 4090 -> 8.9 (or 89)" - exit 1 - fi -fi - -# ABACUS itself and some dependencies require cmake. -if [ "${with_cmake}" = "__DONTUSE__" ]; then - report_error "CMake is required for ABACUS and some dependencies. Please enable it." - exit 1 -fi - - -# ------------------------------------------------------------------------ -# Preliminaries -# ------------------------------------------------------------------------ - -mkdir -p ${INSTALLDIR} - -# ------------------------------------------------------------------------ -# Start writing setup file -# ------------------------------------------------------------------------ -cat << EOF > "$SETUPFILE" -#!/bin/bash -source "${SCRIPTDIR}/tool_kit.sh" -export ABACUS_TOOLCHAIN_OPTIONS="${TOOLCHAIN_OPTIONS}" -EOF - -# ------------------------------------------------------------------------ -# Special settings for CRAY Linux Environment (CLE) -# TODO: CLE should be handle like gcc or Intel using a with_cray flag and -# this section should be moved to a separate file install_cray. -# ------------------------------------------------------------------------ -if [ "${ENABLE_CRAY}" = "__TRUE__" ]; then - echo "------------------------------------------------------------------------" - echo "CRAY Linux Environment (CLE) is detected" - echo "------------------------------------------------------------------------" - # add cray paths to system search path - export LIB_PATHS="CRAY_LD_LIBRARY_PATH ${LIB_PATHS}" - # set compilers to CLE wrappers - check_command cc - check_command ftn - check_command CC - export CC="cc" - export CXX="CC" - export FC="ftn" - export F90="${FC}" - export F77="${FC}" - export MPICC="${CC}" - export MPICXX="${CXX}" - export MPIFC="${FC}" - export MPIFORT="${MPIFC}" - export MPIF77="${MPIFC}" - # CRAY libsci should contains core math libraries, scalapack - # doesn't need LDFLAGS or CFLAGS, nor do the one need to - # explicitly link the math and scalapack libraries, as all is - # taken care of by the cray compiler wrappers. - if [ "$with_scalapack" = "__DONTUSE__" ]; then - export CP_DFLAGS="${CP_DFLAGS} IF_MPI(-D__SCALAPACK|)" - fi - case $MPI_MODE in - mpich) - if [ "$MPICH_DIR" ]; then - cray_mpich_include_path="$MPICH_DIR/include" - cray_mpich_lib_path="$MPICH_DIR/lib" - export INCLUDE_PATHS="$INCLUDE_PATHS cray_mpich_include_path" - export LIB_PATHS="$LIB_PATHS cray_mpich_lib_path" - fi - if [ "$with_mpich" = "__DONTUSE__" ]; then - add_include_from_paths MPI_CFLAGS "mpi.h" $INCLUDE_PATHS - add_include_from_paths MPI_LDFLAGS "libmpi.*" $LIB_PATHS - export MPI_CFLAGS - export MPI_LDFLAGS - export MPI_LIBS=" " - export CP_DFLAGS="${CP_DFLAGS} IF_MPI(-D__parallel|)" - fi - ;; - openmpi) - if [ "$with_openmpi" = "__DONTUSE__" ]; then - add_include_from_paths MPI_CFLAGS "mpi.h" $INCLUDE_PATHS - add_include_from_paths MPI_LDFLAGS "libmpi.*" $LIB_PATHS - export MPI_CFLAGS - export MPI_LDFLAGS - export MPI_LIBS="-lmpi -lmpi_cxx" - export CP_DFLAGS="${CP_DFLAGS} IF_MPI(-D__parallel|)" - fi - ;; - intelmpi) - if [ "$with_intelmpi" = "__DONTUSE__" ]; then - with_gcc="__DONTUSE__" - with_intel="__SYSTEM__" - add_include_from_paths MPI_CFLAGS "mpi.h" $INCLUDE_PATHS - add_include_from_paths MPI_LDFLAGS "libmpi.*" $LIB_PATHS - export MPI_CFLAGS - export MPI_LDFLAGS - export MPI_LIBS="-lmpi -lmpi_cxx" - export CP_DFLAGS="${CP_DFLAGS} IF_MPI(-D__parallel|)" - fi - ;; - esac - check_lib -lz - check_lib -ldl - export CRAY_EXTRA_LIBS="-lz -ldl" - # the space is intentional, so that the variable is non-empty and - # can pass require_env checks - export SCALAPACK_LDFLAGS=" " - export SCALAPACK_LIBS=" " -fi - -# ------------------------------------------------------------------------ -# Installing tools required for building ABACUS and associated libraries -# ------------------------------------------------------------------------ - -echo "Compiling with $(get_nprocs) processes for target ${TARGET_CPU}." - -write_toolchain_env ${INSTALLDIR} - -# write toolchain config -echo "tool_list=\"${tool_list}\"" > ${INSTALLDIR}/toolchain.conf -for ii in ${package_list}; do - install_mode="$(eval echo \${with_${ii}})" - echo "with_${ii}=\"${install_mode}\"" >> ${INSTALLDIR}/toolchain.conf -done - -# ------------------------------------------------------------------------ -# Build packages unless dry-run or pack-run mode is enabled. -# ------------------------------------------------------------------------ -if [ "${dry_run}" = "__TRUE__" ]; then - echo "Wrote only configuration files (--dry-run)." -else - echo "# Leak suppressions" > ${INSTALLDIR}/lsan.supp - ./scripts/stage0/install_stage0.sh - ./scripts/stage1/install_stage1.sh - ./scripts/stage2/install_stage2.sh - ./scripts/stage3/install_stage3.sh - ./scripts/stage4/install_stage4.sh - -cat << EOF -========================== usage ========================= -Done! -To use the installed tools and libraries and ABACUS version -compiled with it you will first need to execute at the prompt: - source ${SETUPFILE} -To build ABACUS by gnu-toolchain, just use: - ./build_abacus_gnu.sh -To build ABACUS by intel-toolchain, just use: - ./build_abacus_intel.sh -To build ABACUS by amd-toolchain in gcc-aocl, just use: - ./build_abacus_gcc-aocl.sh -To build ABACUS by amd-toolchain in aocc-aocl, just use: - ./build_abacus_aocc-aocl.sh -or you can modify the builder scripts to suit your needs. -EOF - -fi - -#EOF diff --git a/toolchain/install_abacus_toolchain_new.sh b/toolchain/install_abacus_toolchain_new.sh index c16aaf30e86..888b436a9b1 100755 --- a/toolchain/install_abacus_toolchain_new.sh +++ b/toolchain/install_abacus_toolchain_new.sh @@ -20,7 +20,6 @@ export SCRIPTDIR="${ROOTDIR}/scripts" export BUILDDIR="${ROOTDIR}/build" export INSTALLDIR="${ROOTDIR}/install" export SETUPFILE="${INSTALLDIR}/setup" -export SHA256_CHECKSUM="${SCRIPTDIR}/checksums.sha256" # Make a copy of all options for $SETUPFILE TOOLCHAIN_OPTIONS="$@" diff --git a/toolchain/scripts/VERSION b/toolchain/scripts/VERSION index 6f4471799a0..4a7fd7bbc33 100644 --- a/toolchain/scripts/VERSION +++ b/toolchain/scripts/VERSION @@ -1,2 +1,2 @@ # version file to force a rebuild of the entire toolchain -VERSION="2025.3" \ No newline at end of file +VERSION="2026.1" diff --git a/toolchain/scripts/lib/config_manager.sh b/toolchain/scripts/lib/config_manager.sh index 71ec05780ad..ea95ac3869d 100644 --- a/toolchain/scripts/lib/config_manager.sh +++ b/toolchain/scripts/lib/config_manager.sh @@ -609,12 +609,16 @@ config_export_to_env() { # Export all configuration values as environment variables for key in "${!CONFIG_CACHE[@]}"; do - export "$key"="${CONFIG_CACHE[$key]}" + case "$key" in + enable_*) ;; + *) export "$key"="${CONFIG_CACHE[$key]}" ;; + esac done - # Backward compatibility for stage scripts expecting uppercase GPU flags - # Installers (e.g., stage3/install_elpa.sh) read ENABLE_CUDA, not enable_cuda export ENABLE_CUDA="${CONFIG_CACHE[enable_cuda]}" + export ENABLE_HIP="${CONFIG_CACHE[enable_hip]}" + export ENABLE_OPENCL="${CONFIG_CACHE[enable_opencl]}" + export ENABLE_CRAY="${CONFIG_CACHE[enable_cray]:-"__FALSE__"}" # Export package list variables export tool_list diff --git a/toolchain/scripts/lib/config_validator.sh b/toolchain/scripts/lib/config_validator.sh index 9af8736d3a2..5064637f2b3 100644 --- a/toolchain/scripts/lib/config_validator.sh +++ b/toolchain/scripts/lib/config_validator.sh @@ -404,6 +404,22 @@ validate_system_requirements() { "This will install GCC ${gcc_ver:-13.2.0} (>= $gcc_min_version.x) with full C++17/C++20 support." return fi + + local cuda_major="" + if command -v nvidia-smi &> /dev/null; then + local nvidia_banner=$(nvidia-smi 2>/dev/null | head -n 3 | tr '\n' ' ') + local cuda_version=$(echo "$nvidia_banner" | sed -n 's/.*CUDA Version:[[:space:]]*\([0-9.]*\).*/\1/p') + cuda_major=$(echo "$cuda_version" | awk -F. '{print $1}') + fi + if [[ "$gcc_major" -ge 14 ]] && [[ -n "$cuda_major" ]] && [[ "$cuda_major" =~ ^[0-9]+$ ]] && [[ "$cuda_major" -lt 13 ]]; then + add_validation_warning_group "gcc_cuda_compat_risk" \ + "Potential GCC/CUDA incompatibility risk detected:" \ + " gcc: $gcc_version (>= 14)" \ + " cuda: $cuda_major.x (< 13, from nvidia-smi)" \ + "" \ + "This combination may cause CUDA-related compilation failures." \ + "Consider upgrading CUDA (>= 13) or using a compatible GCC toolchain." + fi # Success - add informational message add_validation_info "System GCC toolchain validated: version $gcc_version (>= $gcc_min_version.x required)" diff --git a/toolchain/scripts/lib/user_interface.sh b/toolchain/scripts/lib/user_interface.sh index 2c18d7bf3f2..08a75f40450 100644 --- a/toolchain/scripts/lib/user_interface.sh +++ b/toolchain/scripts/lib/user_interface.sh @@ -777,7 +777,24 @@ ui_show_summary() { fi fi - echo " └─ GPU: $gpu_info" + local nvidia_driver="unavailable" + local cuda_version="unavailable" + if command -v nvidia-smi &> /dev/null; then + nvidia_driver=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader 2>/dev/null | head -n1 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') + if [[ -z "$nvidia_driver" ]]; then + nvidia_driver="unavailable" + fi + local nvidia_banner=$(nvidia-smi 2>/dev/null | head -n 3 | tr '\n' ' ') + cuda_version=$(echo "$nvidia_banner" | sed -n 's/.*CUDA Version:[[:space:]]*\([0-9.]*\).*/\1/p') + cuda_version=$(echo "$cuda_version" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') + if [[ -z "$cuda_version" ]]; then + cuda_version="unavailable" + fi + fi + + echo " ├─ GPU: $gpu_info" + echo " ├─ NVIDIA Driver: $nvidia_driver" + echo " └─ CUDA Version: $cuda_version" echo "" # Configuration box with aligned formatting @@ -1176,4 +1193,4 @@ ui_check_system_requirements() { ui_success "All required system tools are available" return 0 fi -} \ No newline at end of file +} diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index a3d981fa690..ab343c1a793 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -115,7 +115,7 @@ case "$with_elpa" in fi for TARGET in "cpu" "nvidia"; do # Accept both uppercase and lowercase GPU enable flags for compatibility - gpu_enabled="${ENABLE_CUDA:-${enable_cuda}}" + gpu_enabled="${ENABLE_CUDA}" [ "$TARGET" = "nvidia" ] && [ "$gpu_enabled" != "__TRUE__" ] && continue # disable cpu if cuda is enabled, only install one [ "$TARGET" != "nvidia" ] && [ "$gpu_enabled" = "__TRUE__" ] && continue diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index f087aff9da2..b03861d4c19 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -30,8 +30,13 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "cereal" "$version_suffix" -dirname="cereal-${cereal_ver}" -filename="cereal-${cereal_ver}.tar.gz" +if [[ "${cereal_ver}" =~ ^[0-9a-f]{40}$ ]]; then + short_ver="${cereal_ver:0:7}" +else + short_ver="${cereal_ver}" +fi +dirname="cereal-${short_ver}" +filename="cereal-${short_ver}.tar.gz" source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -77,7 +82,7 @@ case "$with_cereal" in cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi - CEREAL_CFLAGS="-I'${pkg_install_dir}'" + CEREAL_CFLAGS="-I'${pkg_install_dir}/include'" ;; __SYSTEM__) echo "==================== Finding CEREAL from system paths ====================" @@ -105,7 +110,7 @@ case "$with_cereal" in echo "==================== Linking CEREAL to user paths ====================" pkg_install_dir="${with_cereal}" check_dir "${pkg_install_dir}" - CEREAL_CFLAGS="-I'${pkg_install_dir}'" + CEREAL_CFLAGS="-I'${pkg_install_dir}/include'" ;; esac if [ "$with_cereal" != "__DONTUSE__" ]; then diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 37c4ce69ab9..c7b14f075e6 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -34,8 +34,13 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "libcomm" "$version_suffix" -dirname="LibComm-${libcomm_ver}" -filename="LibComm-${libcomm_ver}.tar.gz" +if [[ "${libcomm_ver}" =~ ^[0-9a-f]{40}$ ]]; then + short_ver="${libcomm_ver:0:7}" +else + short_ver="${libcomm_ver}" +fi +dirname="LibComm-${short_ver}" +filename="LibComm-${short_ver}.tar.gz" source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -79,7 +84,7 @@ case "$with_libcomm" in cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi - LIBCOMM_CFLAGS="-I'${pkg_install_dir}'" + LIBCOMM_CFLAGS="-I'${pkg_install_dir}/include'" ;; __SYSTEM__) echo "==================== Finding LIBCOMM from system paths ====================" @@ -107,7 +112,7 @@ case "$with_libcomm" in echo "==================== Linking LIBCOMM to user paths ====================" pkg_install_dir="${with_libcomm}" check_dir "${pkg_install_dir}" - LIBCOMM_CFLAGS="-I'${pkg_install_dir}'" + LIBCOMM_CFLAGS="-I'${pkg_install_dir}/include'" ;; esac if [ "$with_libcomm" != "__DONTUSE__" ]; then diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index 5b5bacc2b05..bdd7c2b3959 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -71,7 +71,7 @@ case "$with_libnpy" in cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi - LIBNPY_CFLAGS="-I'${pkg_install_dir}'" + LIBNPY_CFLAGS="-I'${pkg_install_dir}/include'" ;; __SYSTEM__) echo "==================== Finding LIBNPY from system paths ====================" @@ -99,7 +99,7 @@ case "$with_libnpy" in echo "==================== Linking LIBNPY to user paths ====================" pkg_install_dir="${with_libnpy}" check_dir "${pkg_install_dir}" - LIBNPY_CFLAGS="-I'${pkg_install_dir}'" + LIBNPY_CFLAGS="-I'${pkg_install_dir}/include'" ;; esac if [ "$with_libnpy" != "__DONTUSE__" ]; then diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 0efea870ff3..a3dd10422d6 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -34,6 +34,11 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "libri" "$version_suffix" +if [[ "${libri_ver}" =~ ^[0-9a-f]{40}$ ]]; then + short_ver="${libri_ver:0:7}" +else + short_ver="${libri_ver}" +fi source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -45,7 +50,7 @@ cd "${BUILDDIR}" case "$with_libri" in __INSTALL__) echo "==================== Installing LIBRI ====================" - dirname="LibRI-${libri_ver}" + dirname="LibRI-${short_ver}" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libri/${libri_ver}" install_lock_file="${pkg_install_dir}/install_successful" @@ -57,7 +62,7 @@ case "$with_libri" in else url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/v${libri_ver}" fi - filename="LibRI-${libri_ver}.tar.gz" + filename="LibRI-${short_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -78,7 +83,7 @@ case "$with_libri" in cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi - LIBRI_CFLAGS="-I'${pkg_install_dir}'" + LIBRI_CFLAGS="-I'${pkg_install_dir}/include'" ;; __SYSTEM__) echo "==================== Finding LIBRI from system paths ====================" @@ -106,7 +111,7 @@ case "$with_libri" in echo "==================== Linking LIBRI to user paths ====================" pkg_install_dir="${with_libri}" check_dir "${pkg_install_dir}" - LIBRI_CFLAGS="-I'${pkg_install_dir}'" + LIBRI_CFLAGS="-I'${pkg_install_dir}/include'" ;; esac if [ "$with_libri" != "__DONTUSE__" ]; then diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 1529911e6f1..6cb560af429 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -32,6 +32,11 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "rapidjson" "$version_suffix" +if [[ "${rapidjson_ver}" =~ ^[0-9a-f]{40}$ ]]; then + short_ver="${rapidjson_ver:0:7}" +else + short_ver="${rapidjson_ver}" +fi source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -44,7 +49,7 @@ cd "${BUILDDIR}" case "$with_rapidjson" in __INSTALL__) echo "==================== Installing RapidJSON ====================" - dirname="rapidjson-${rapidjson_ver}" + dirname="rapidjson-${short_ver}" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}" install_lock_file="${pkg_install_dir}/install_successful" @@ -56,7 +61,7 @@ case "$with_rapidjson" in else url="https://codeload.github.com/Tencent/rapidjson/tar.gz/v${rapidjson_ver}" fi - filename="rapidjson-${rapidjson_ver}.tar.gz" + filename="rapidjson-${short_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index ad86f8404c8..b7d377cef9d 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -128,6 +128,7 @@ You can manually install requirements packages via: 1. Download from www.cp2k.org/static/downloads (for OpenBLAS, OpenMPI and Others) 2. Download from github.com (especially for CEREAL, RapidJSON, libnpy, LibRI and other stage4 packages) 3. for Intel-oneAPI and AMD AOCC/AOCL, please contact your server manager or visit their official website +4. For users in China, you can try Gitee mirror: git clone https://gitee.com/jamesmisaka/abacus_toolchain_build.git EOF } diff --git a/toolchain/toolchain_aocc-aocl.sh b/toolchain/toolchain_aocc-aocl.sh index edfe1f20ae8..bfc4b4bc1a2 100755 --- a/toolchain/toolchain_aocc-aocl.sh +++ b/toolchain/toolchain_aocc-aocl.sh @@ -68,8 +68,8 @@ PACK_RUN_MODE="no" # Set to "yes" to enable pack-run mode # Refer to scripts/package_versions.sh for specific version numbers CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 -OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 -ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 +OPENMPI_VERSION="main" # main=5.0.10, alt=4.1.8 +ELPA_VERSION="main" # main=2026.02.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) diff --git a/toolchain/toolchain_gcc-aocl.sh b/toolchain/toolchain_gcc-aocl.sh index 7a21670ab9f..f77b533989c 100755 --- a/toolchain/toolchain_gcc-aocl.sh +++ b/toolchain/toolchain_gcc-aocl.sh @@ -65,8 +65,8 @@ PACK_RUN_MODE="no" # Set to "yes" to enable pack-run mode # Refer to scripts/package_versions.sh for specific version numbers CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 -OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 -ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 +OPENMPI_VERSION="main" # main=5.0.10, alt=4.1.8 +ELPA_VERSION="main" # main=2026.02.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) diff --git a/toolchain/toolchain_gcc-mkl.sh b/toolchain/toolchain_gcc-mkl.sh new file mode 100755 index 00000000000..7f7b9da8e17 --- /dev/null +++ b/toolchain/toolchain_gcc-mkl.sh @@ -0,0 +1,114 @@ +#!/bin/bash +#SBATCH -J install +#SBATCH -N 1 +#SBATCH -n 16 +#SBATCH -o compile.log +#SBATCH -e compile.err + +# Users can easily modify these parameters to customize the build +# Before running this script, ensure you have loaded your system packages + +# Compiler Configuration +TOOLCHAIN_COMPILER="gcc-mkl" +WITH_GCC="system" +WITH_AMD="no" +WITH_INTEL="no" + +# Math Libraries (Intel MKL recommended) +MATH_MODE="mkl" +WITH_MKL="system" + +# MPI Implementation (OpenMPI recommended) +MPI_MODE="openmpi" +WITH_OPENMPI="install" +WITH_4TH_OPENMPI="no" # Set to "yes" for OpenMPI v4, deprecated +WITH_MPICH="no" + +# Core Dependencies +WITH_CMAKE="install" +WITH_SCALAPACK="system" # MKL provides ScaLAPACK +WITH_FFTW="system" # MKL provides FFTW +WITH_LIBXC="install" +WITH_ELPA="install" + +# Utility Libraries +WITH_CEREAL="install" +WITH_RAPIDJSON="install" + +# Advanced Features (EXX calculations) +WITH_LIBRI="install" +WITH_LIBCOMM="install" + +# Optional Features (MLALGO support) +WITH_LIBTORCH="no" +WITH_LIBNPY="no" +WITH_NEP="no" + +# ELPA-GPU Support (uncomment and modify as needed) +# ENABLE_CUDA="yes" +# GPU_VERSION="75" # Check your GPU compute capability +# export CUDA_PATH="/usr/local/cuda" + +# ============================================================================ +# Execution Mode Control +# ============================================================================ +# Dry-run mode: Show what would be done without actually executing +DRY_RUN_MODE="no" # Set to "yes" to enable dry-run mode + +# Pack-run mode: Only check and install required packages +PACK_RUN_MODE="no" # Set to "yes" to enable pack-run mode + +# ============================================================================ +# Package Version Selection (main/alt versions) +# ============================================================================ +# Choose between main (latest stable) and alt (alternative/legacy) versions +# Refer to scripts/package_versions.sh for specific version numbers + +CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 +OPENMPI_VERSION="main" # main=5.0.10, alt=4.1.8 +ELPA_VERSION="main" # main=2026.02.001, alt=2024.05.001 +LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 +# Optional Libraries +LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) +# Note: main(2.1.2) version of LibTorch need glibc > 2.27 +# Note: alt(1.12.1) version of LibTorch cannot support DeePMD-Torch for DPA + +# Note: GCC-MKL toolchain uses MKL for math libraries (FFTW, ScaLAPACK) +# so OpenBLAS and ScaLAPACK version selections are not applicable + +# ============================================================================ +# Execute Installation (DO NOT MODIFY BELOW THIS LINE) +# ============================================================================ + +# Call the main installation script with configured parameters +exec ./install_abacus_toolchain_new.sh \ + --with-gcc="$WITH_GCC" \ + --math-mode="$MATH_MODE" \ + --mpi-mode="$MPI_MODE" \ + --with-mkl="$WITH_MKL" \ + --with-openmpi="$WITH_OPENMPI" \ + --with-mpich="$WITH_MPICH" \ + --with-cmake="$WITH_CMAKE" \ + --with-scalapack="$WITH_SCALAPACK" \ + --with-libxc="$WITH_LIBXC" \ + --with-fftw="$WITH_FFTW" \ + --with-elpa="$WITH_ELPA" \ + --with-cereal="$WITH_CEREAL" \ + --with-rapidjson="$WITH_RAPIDJSON" \ + --with-libtorch="$WITH_LIBTORCH" \ + --with-nep="$WITH_NEP" \ + --with-libnpy="$WITH_LIBNPY" \ + --with-libri="$WITH_LIBRI" \ + --with-libcomm="$WITH_LIBCOMM" \ + --with-4th-openmpi="$WITH_4TH_OPENMPI" \ + --package-version cmake:"$CMAKE_VERSION" \ + --package-version openmpi:"$OPENMPI_VERSION" \ + --package-version elpa:"$ELPA_VERSION" \ + --package-version libxc:"$LIBXC_VERSION" \ + --package-version libtorch:"$LIBTORCH_VERSION" \ + ${DRY_RUN_MODE:+$([ "$DRY_RUN_MODE" = "yes" ] && echo "--dry-run")} \ + ${PACK_RUN_MODE:+$([ "$PACK_RUN_MODE" = "yes" ] && echo "--pack-run")} \ + ${ENABLE_CUDA:+--enable-cuda} \ + ${GPU_VERSION:+--gpu-ver="$GPU_VERSION"} \ + "$@" \ + | tee compile.log diff --git a/toolchain/toolchain_gnu.sh b/toolchain/toolchain_gnu.sh index 23176722b4e..456d81dacc5 100755 --- a/toolchain/toolchain_gnu.sh +++ b/toolchain/toolchain_gnu.sh @@ -65,11 +65,12 @@ PACK_RUN_MODE="no" # Set to "yes" to enable pack-run mode # Refer to scripts/package_versions.sh for specific version numbers CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 -OPENMPI_VERSION="main" # main=5.0.8, alt=4.1.6 -OPENBLAS_VERSION="main" # main=0.3.30, alt=0.3.27 -ELPA_VERSION="main" # main=2025.06.001, alt=2024.05.001 +OPENMPI_VERSION="main" # main=5.0.10, alt=4.1.8 +MPICH_VERSION="main" # main=5.0.1, alt=4.3.2 +OPENBLAS_VERSION="main" # main=0.3.33, alt=0.3.30 +ELPA_VERSION="main" # main=2026.02.001, alt=2024.05.001 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 -SCALAPACK_VERSION="main" # main=2.2.2, alt=2.2.1 +SCALAPACK_VERSION="main" # main=2.2.3, alt=2.2.1 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) # Note: main(2.1.2) version of LibTorch need glibc > 2.27 @@ -104,6 +105,7 @@ exec ./install_abacus_toolchain_new.sh \ --with-4th-openmpi="$WITH_4TH_OPENMPI" \ --package-version cmake:"$CMAKE_VERSION" \ --package-version openmpi:"$OPENMPI_VERSION" \ + --package-version mpich:"$MPICH_VERSION" \ --package-version openblas:"$OPENBLAS_VERSION" \ --package-version elpa:"$ELPA_VERSION" \ --package-version libxc:"$LIBXC_VERSION" \ diff --git a/toolchain/toolchain_intel.sh b/toolchain/toolchain_intel.sh index 29138b6e5a3..1f4dedbc215 100755 --- a/toolchain/toolchain_intel.sh +++ b/toolchain/toolchain_intel.sh @@ -85,7 +85,7 @@ INTELMPI_CLASSIC="no" # Set to "yes" to use classic Intel MPI wrappers (mpiicc # Refer to scripts/package_versions.sh for specific version numbers CMAKE_VERSION="main" # main=3.31.7, alt=3.30.5 -ELPA_VERSION="alt" # main=2025.06.001, alt=2024.05.001 for intel oneapi<2024.2 +ELPA_VERSION="alt" # main=2026.02.001, alt=2024.05.001 for intel oneapi<2024.2 LIBXC_VERSION="main" # main=7.0.0, alt=6.2.2 # Optional Libraries LIBTORCH_VERSION="main" # main=2.1.2, alt=1.12.1 (use alt for older GLIBC) From aea45ee924218358d97804207817a6d16c2e5b7b Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:22:42 +0800 Subject: [PATCH 14/26] Backport: Toolchain: Fix package installing issue (#7315) Partial cherry-pick from b9669d375. Scoped to .github, toolchain, and cmake; forbidden NEP/libtorch installer changes and out-of-scope paths are excluded. --- cmake/FindCereal.cmake | 2 +- cmake/FindLibComm.cmake | 2 +- cmake/FindLibRI.cmake | 2 +- toolchain/scripts/get_openblas_arch.sh | 9 +-- toolchain/scripts/package_versions.sh | 28 ++++---- toolchain/scripts/stage0/install_cmake.sh | 18 ++--- toolchain/scripts/stage0/install_gcc.sh | 9 +-- toolchain/scripts/stage1/install_mpich.sh | 7 +- toolchain/scripts/stage1/install_openmpi.sh | 6 +- toolchain/scripts/stage2/install_aocl.sh | 1 + toolchain/scripts/stage2/install_openblas.sh | 11 +-- toolchain/scripts/stage3/install_elpa.sh | 9 +-- toolchain/scripts/stage3/install_fftw.sh | 8 +-- toolchain/scripts/stage3/install_libxc.sh | 11 +-- toolchain/scripts/stage3/install_scalapack.sh | 11 +-- toolchain/scripts/stage4/install_cereal.sh | 20 ++---- toolchain/scripts/stage4/install_libcomm.sh | 20 ++---- toolchain/scripts/stage4/install_libnpy.sh | 9 +-- toolchain/scripts/stage4/install_libri.sh | 20 ++---- toolchain/scripts/stage4/install_rapidjson.sh | 20 ++---- toolchain/scripts/tool_kit.sh | 68 +++++++++---------- 21 files changed, 97 insertions(+), 194 deletions(-) diff --git a/cmake/FindCereal.cmake b/cmake/FindCereal.cmake index f6c5f398776..204a1233f24 100644 --- a/cmake/FindCereal.cmake +++ b/cmake/FindCereal.cmake @@ -15,7 +15,7 @@ if(NOT CEREAL_INCLUDE_DIR) include(FetchContent) FetchContent_Declare( cereal - URL https://codeload.github.com/USCiLab/cereal/tar.gz/22a1b369f39be918ca79206a83c4facd759f9105 + URL https://codeload.github.com/USCiLab/cereal/tar.gz/22a1b36 ) FetchContent_Populate(cereal) set(CEREAL_INCLUDE_DIR ${cereal_SOURCE_DIR}/include) diff --git a/cmake/FindLibComm.cmake b/cmake/FindLibComm.cmake index 28016bfaa7b..64b34333998 100644 --- a/cmake/FindLibComm.cmake +++ b/cmake/FindLibComm.cmake @@ -16,7 +16,7 @@ if(NOT LIBCOMM_DIR) include(FetchContent) FetchContent_Declare( LibComm - URL https://codeload.github.com/abacusmodeling/LibComm/tar.gz/965bf90713ce5598bae4fd957d417065f77ceb42 + URL https://codeload.github.com/abacusmodeling/LibComm/tar.gz/965bf90 ) FetchContent_Populate(LibComm) set(LIBCOMM_DIR ${libcomm_SOURCE_DIR}) diff --git a/cmake/FindLibRI.cmake b/cmake/FindLibRI.cmake index 3208a862190..23b5426fbdd 100644 --- a/cmake/FindLibRI.cmake +++ b/cmake/FindLibRI.cmake @@ -16,7 +16,7 @@ if(NOT LIBRI_DIR) include(FetchContent) FetchContent_Declare( LibRI - URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/e6d78e0504693d2a464c72b87d3240ce183fd881 + URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/e6d78e0 ) FetchContent_Populate(LibRI) set(LIBRI_DIR ${libri_SOURCE_DIR}) diff --git a/toolchain/scripts/get_openblas_arch.sh b/toolchain/scripts/get_openblas_arch.sh index 6f61db4612f..79f40805e97 100755 --- a/toolchain/scripts/get_openblas_arch.sh +++ b/toolchain/scripts/get_openblas_arch.sh @@ -49,13 +49,8 @@ source "${INSTALLDIR}"/toolchain.env cd "${BUILDDIR}" echo "==================== Getting proc arch info using OpenBLAS tools ====================" -if [ -f ${openblas_pkg} ]; then - echo "${openblas_pkg} is found" -else -# using codeload.github - url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}" - download_pkg_from_url "${openblas_sha256}" "${openblas_pkg}" "${url}" -fi +url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}" +retrieve_package "${openblas_sha256}" "${openblas_pkg}" "${url}" # if toolchain run in pack-run mode, do exit if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip arch detection" diff --git a/toolchain/scripts/package_versions.sh b/toolchain/scripts/package_versions.sh index 713751037fd..d758c8ea0f3 100644 --- a/toolchain/scripts/package_versions.sh +++ b/toolchain/scripts/package_versions.sh @@ -18,12 +18,12 @@ gcc_alt_sha256="af828619dd1970734dda3cfb792ea3f2cba61b5a00170ba8bce4910749d73c07 # CMake (supports dual versions) - main=3.31.7, alt=3.30.5 cmake_main_ver="3.31.7" -cmake_main_sha256_x86_64="b7a5c909cdafc36042c8c9bd5765e92ff1f2528cf01720aa6dc4df294ec7e1a0" -cmake_main_sha256_aarch64="ce8e32b2c1c497dd7f619124c043ac5c28a88677e390c58748dd62fe460c62a2" +cmake_main_sha256_x86_64="14e15d0b445dbeac686acc13fe13b3135e8307f69ccf4c5c91403996ce5aa2d4" +cmake_main_sha256_aarch64="e5b2dc2aefdca10afe09c8fa4ee2bbb4e732665943a94322f99c118781910c3c" cmake_main_sha256_macos="1cb11aa2edae8551bb0f22807c6f5246bd0eb60ae9fa1474781eb4095d299aca" cmake_alt_ver="3.30.5" -cmake_alt_sha256_x86_64="83de8839f3fb0d9caf982a0435da3fa8c4fbe2c817dfec99def310dc7e6a8404" -cmake_alt_sha256_aarch64="93c3b8920379585dece1314f113c6c9008eaedfe56023c78d856fc86dad5b8e2" +cmake_alt_sha256_x86_64="f747d9b23e1a252a8beafb4ed2bc2ddf78cff7f04a8e4de19f4ff88e9b51dc9d" +cmake_alt_sha256_aarch64="da7dead2c92c1747b40d506d7f7d68590f5bab175316d2e7af73e48a2e417e48" cmake_alt_sha256_macos="3d603e507c7579b13518ef752b4ffcf3ed479fba80ee171d7d85da8153e869d0" # ============================================================================= @@ -100,21 +100,21 @@ libnpy_alt_ver="1.0.1" libnpy_alt_sha256="43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0fba44" # Branch packages cut with specific commits -cereal_ver="22a1b369f39be918ca79206a83c4facd759f9105" -cereal_sha256="ca3d544456f93ea3176eab85e2e7892063af45b20467bb4ad9c1c51068e521c6" +cereal_ver="22a1b36" +cereal_sha256="a8171736e6b553dd6cd37919c13433b01f499d24d45af502975a9439728803e0" -libcomm_ver="965bf90713ce5598bae4fd957d417065f77ceb42" -libcomm_sha256="1d1626b833c51efa7ab844af140e022e063ea64389c9e47b168c24fcc05b7323" +libcomm_ver="965bf90" +libcomm_sha256="d7b991465d98d7b715b484d86880bf3525b9bf0cc62c3e5d38b0f6d140f6b9d4" -libri_ver="e6d78e0504693d2a464c72b87d3240ce183fd881" -libri_sha256="ead14f05b645f3d028e09f715abaa0e8fca3d1d6d61804239c4858b33397286a" +libri_ver="e6d78e0" +libri_sha256="619b49a14047d7a167515d1f1d0fa2d82fbebd63b8cbd3181e07df6ed993a22c" -rapidjson_ver="24b5e7a8b27f42fa16b96fc70aade9106cf7102f" -rapidjson_sha256="2d2601a82d2d3b7e143a3c8d43ef616671391034bc46891a9816b79cf2d3e7a8" +rapidjson_ver="24b5e7a" +rapidjson_sha256="dcb57b11036cb8fc6b2a57a6aded68d52e9cfe543811bf4fa8941087f84e72d0" # NEP (Neural Evolution Potential) - CPU version -nep_ver="629ec5dda3127e046fde3f8082aedfca8deb915e" -nep_sha256="57803d2e98ca5c8ced09e3e8d21ac1a0dbd61dda1977997864195f8c54b9b1f9" +nep_ver="629ec5d" +nep_sha256="4d4d3c64211a2a39e5d5c795b77befbba987cc809786e0cd6abfa46d0f3bf8cb" # ============================================================================= # Package Variable Loading Function diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index b3ef274c0e7..482c75d40af 100755 --- a/toolchain/scripts/stage0/install_cmake.sh +++ b/toolchain/scripts/stage0/install_cmake.sh @@ -71,11 +71,9 @@ cd "${BUILDDIR}" case "${with_cmake}" in __INSTALL__) echo "==================== Installing CMake ====================" - cmake_ext="sh" if [ "${OPENBLAS_ARCH}" = "arm64" ]; then if [ "$(uname -s)" = "Darwin" ]; then cmake_arch="macos-universal" - cmake_ext="tar.gz" elif [ "$(uname -s)" = "Linux" ]; then cmake_arch="linux-aarch64" else @@ -92,17 +90,12 @@ case "${with_cmake}" in pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}" #pkg_install_dir="${HOME}/apps/cmake/${cmake_ver}" install_lock_file="${pkg_install_dir}/install_successful" - cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}" + cmake_pkg="cmake-${cmake_ver}-${cmake_arch}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "cmake-${cmake_ver} is already installed, skipping it." else - if [ -f $cmake_pkg ]; then - echo "$cmake_pkg is found" - else - #download_pkg_from_ABACUS_org "${cmake_sha256}" "$cmake_pkg" - url="https://cmake.org/files/v${cmake_ver%.*}/${cmake_pkg}" - download_pkg_from_url "${cmake_sha256}" "${cmake_pkg}" "${url}" - fi + url="https://cmake.org/files/v${cmake_ver%.*}/${cmake_pkg}" + retrieve_package "${cmake_sha256}" "${cmake_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -110,10 +103,11 @@ case "${with_cmake}" in echo "Installing from scratch into ${pkg_install_dir}" mkdir -p ${pkg_install_dir} if [ "${cmake_arch}" = "macos-universal" ]; then - tar --strip-components=3 -xvf $cmake_pkg -C ${pkg_install_dir} > install.log 2>&1 || tail -n ${LOG_LINES} install.log + strip_components=3 else - /bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log + strip_components=1 fi + tar --strip-components=${strip_components} -xvf ${cmake_pkg} -C ${pkg_install_dir} > install.log 2>&1 || tail_excerpt install.log write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})" fi ;; diff --git a/toolchain/scripts/stage0/install_gcc.sh b/toolchain/scripts/stage0/install_gcc.sh index fe4b4c44ad5..6091b8c450e 100755 --- a/toolchain/scripts/stage0/install_gcc.sh +++ b/toolchain/scripts/stage0/install_gcc.sh @@ -59,13 +59,8 @@ case "${with_gcc}" in tar -xzf "${repack_filename}" echo "Successfully extracted ${repack_filename}" else - if [ -f gcc-${gcc_ver}.tar.gz ]; then - echo "gcc-${gcc_ver}.tar.gz is found" - else - #download_pkg_from_ABACUS_org "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz" - url=https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-${gcc_ver}/gcc-${gcc_ver}.tar.gz - download_pkg_from_url "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz" "${url}" - fi + url=https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-${gcc_ver}/gcc-${gcc_ver}.tar.gz + retrieve_package "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz" "${url}" fi [ -d gcc-${gcc_ver} ] && rm -rf gcc-${gcc_ver} tar -xzf gcc-${gcc_ver}.tar.gz diff --git a/toolchain/scripts/stage1/install_mpich.sh b/toolchain/scripts/stage1/install_mpich.sh index b171ac1a746..fc48b54080d 100755 --- a/toolchain/scripts/stage1/install_mpich.sh +++ b/toolchain/scripts/stage1/install_mpich.sh @@ -50,12 +50,7 @@ case "${with_mpich}" in if verify_checksums "${install_lock_file}"; then echo "mpich-${mpich_ver} is already installed, skipping it." else - if [ -f ${mpich_pkg} ]; then - echo "${mpich_pkg} is found" - else - #download_pkg_from_ABACUS_org "${mpich_sha256}" "${mpich_pkg}" - download_pkg_from_url "${mpich_sha256}" "${mpich_pkg}" "${url}" - fi + retrieve_package "${mpich_sha256}" "${mpich_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index d134358ffa8..1c24b01ef68 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -52,11 +52,7 @@ case "${with_openmpi}" in if verify_checksums "${install_lock_file}"; then echo "openmpi-${openmpi_ver} is already installed, skipping it." else - if [ -f ${openmpi_pkg} ]; then - echo "${openmpi_pkg} is found" - else - download_pkg_from_url "${openmpi_sha256}" "${openmpi_pkg}" "${url}" - fi + retrieve_package "${openmpi_sha256}" "${openmpi_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index a7f9b377915..01701171930 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -66,6 +66,7 @@ export MATH_CFLAGS="\${MATH_CFLAGS} ${AOCL_CFLAGS}" export MATH_LDFLAGS="\${MATH_LDFLAGS} ${AOCL_LDFLAGS}" export MATH_LIBS="\${MATH_LIBS} ${AOCL_LIBS}" EOF + cat "${BUILDDIR}/setup_aocl" >> $SETUPFILE fi load "${BUILDDIR}/setup_aocl" diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 3b5800f54f2..45d85e94939 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -50,13 +50,8 @@ case "${with_openblas}" in if verify_checksums "${install_lock_file}"; then echo "openblas-${openblas_ver} is already installed, skipping it." else - if [ -f ${openblas_pkg} ]; then - echo "${openblas_pkg} is found" - else - # using codeload.github - url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}" - download_pkg_from_url "${openblas_sha256}" "${openblas_pkg}" "${url}" - fi + url="https://codeload.github.com/OpenMathLib/OpenBLAS/tar.gz/v${openblas_ver}" + retrieve_package "${openblas_sha256}" "${openblas_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -177,7 +172,6 @@ prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path CPATH "${pkg_install_dir}/include" EOF - cat "${BUILDDIR}/setup_openblas" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_openblas" export OPENBLAS_ROOT="${pkg_install_dir}" @@ -190,6 +184,7 @@ export MATH_LIBS="\${MATH_LIBS} ${OPENBLAS_LIBS}" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF + cat "${BUILDDIR}/setup_openblas" >> $SETUPFILE fi load "${BUILDDIR}/setup_openblas" diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index ab343c1a793..7d72e33e58e 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -74,11 +74,7 @@ case "$with_elpa" in else require_env MATH_LIBS url="https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/${elpa_ver}/${elpa_pkg}" - if [ -f ${elpa_pkg} ]; then - echo "${elpa_pkg} is found" - else - download_pkg_from_url "${elpa_sha256}" "${elpa_pkg}" "${url}" - fi + retrieve_package "${elpa_sha256}" "${elpa_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -258,7 +254,6 @@ prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_elpa" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_elpa" export ELPA_ROOT="${pkg_install_dir}" @@ -271,7 +266,7 @@ export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${ELPA_LDFLAGS}|)" export CP_LIBS="IF_MPI(${ELPA_LIBS}|) \${CP_LIBS}" export ELPA_VERSION="${elpa_ver}" EOF - + cat "${BUILDDIR}/setup_elpa" >> $SETUPFILE fi load "${BUILDDIR}/setup_elpa" diff --git a/toolchain/scripts/stage3/install_fftw.sh b/toolchain/scripts/stage3/install_fftw.sh index 31396455d62..a40f514ca44 100755 --- a/toolchain/scripts/stage3/install_fftw.sh +++ b/toolchain/scripts/stage3/install_fftw.sh @@ -49,12 +49,8 @@ case "$with_fftw" in if verify_checksums "${install_lock_file}"; then echo "fftw-${fftw_ver} is already installed, skipping it." else - if [ -f ${fftw_pkg} ]; then - echo "${fftw_pkg} is found" - else - url="http://www.fftw.org/${fftw_pkg}" - download_pkg_from_url "${fftw_sha256}" "${fftw_pkg}" "${url}" - fi + url="http://www.fftw.org/${fftw_pkg}" + retrieve_package "${fftw_sha256}" "${fftw_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 diff --git a/toolchain/scripts/stage3/install_libxc.sh b/toolchain/scripts/stage3/install_libxc.sh index 3afb4b4fee2..e3efa166a67 100755 --- a/toolchain/scripts/stage3/install_libxc.sh +++ b/toolchain/scripts/stage3/install_libxc.sh @@ -51,13 +51,8 @@ case "$with_libxc" in if verify_checksums "${install_lock_file}"; then echo "libxc-${libxc_ver} is already installed, skipping it." else - if [ -f ${libxc_pkg} ]; then - echo "${libxc_pkg} is found" - else - #download_pkg_from_ABACUS_org "${libxc_sha256}" "${libxc_pkg}" - libxc_url="https://gitlab.com/libxc/libxc/-/archive/${libxc_ver}/${libxc_pkg}" - download_pkg_from_url "${libxc_sha256}" "${libxc_pkg}" "${libxc_url}" - fi + libxc_url="https://gitlab.com/libxc/libxc/-/archive/${libxc_ver}/${libxc_pkg}" + retrieve_package "${libxc_sha256}" "${libxc_pkg}" "${libxc_url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -121,7 +116,6 @@ prepend_path CPATH "${pkg_install_dir}/include" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_libxc" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libxc" export LIBXC_CFLAGS="${LIBXC_CFLAGS}" @@ -133,6 +127,7 @@ export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBXC_LDFLAGS}" export CP_LIBS="${LIBXC_LIBS} \${CP_LIBS}" export LIBXC_ROOT="${pkg_install_dir}" EOF + cat "${BUILDDIR}/setup_libxc" >> $SETUPFILE fi load "${BUILDDIR}/setup_libxc" diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index e03742efa2e..9151e7dfebe 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -49,13 +49,8 @@ case "${with_scalapack}" in echo "scalapack-${scalapack_ver} is already installed, skipping it." else require_env MATH_LIBS - if [ -f ${scalapack_pkg} ]; then - echo "${scalapack_pkg} is found" - else - url="https://codeload.github.com/Reference-ScaLAPACK/scalapack/tar.gz/v${scalapack_ver}" - download_pkg_from_url "${scalapack_sha256}" "${scalapack_pkg}" "${url}" - #download_pkg_from_ABACUS_org "${scalapack_sha256}" "${scalapack_pkg}" - fi + url="https://codeload.github.com/Reference-ScaLAPACK/scalapack/tar.gz/v${scalapack_ver}" + retrieve_package "${scalapack_sha256}" "${scalapack_pkg}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -120,7 +115,6 @@ prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_scalapack" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_scalapack" export SCALAPACK_ROOT="${pkg_install_dir}" @@ -130,6 +124,7 @@ export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__SCALAPACK|)" export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${SCALAPACK_LDFLAGS}|)" export CP_LIBS="IF_MPI(-lscalapack|) \${CP_LIBS}" EOF + cat "${BUILDDIR}/setup_scalapack" >> $SETUPFILE fi cd "${ROOTDIR}" diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index b03861d4c19..e442a2413d9 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -30,13 +30,8 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "cereal" "$version_suffix" -if [[ "${cereal_ver}" =~ ^[0-9a-f]{40}$ ]]; then - short_ver="${cereal_ver:0:7}" -else - short_ver="${cereal_ver}" -fi -dirname="cereal-${short_ver}" -filename="cereal-${short_ver}.tar.gz" +dirname="cereal-${cereal_ver}" +filename="cereal-${cereal_ver}.tar.gz" source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -55,7 +50,7 @@ case "$with_cereal" in # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${cereal_ver}" =~ ^[0-9a-f]{40}$ ]]; then + if [[ "${cereal_ver}" =~ ^([0-9a-f]{7}|[0-9a-f]{40})$ ]]; then url="https://codeload.github.com/USCiLab/cereal/tar.gz/${cereal_ver}" else url="https://codeload.github.com/USCiLab/cereal/tar.gz/v${cereal_ver}" @@ -63,12 +58,7 @@ case "$with_cereal" in if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else - if [ -f $filename ]; then - echo "$filename is found" - else - # download from github.com and checksum - download_pkg_from_url "${cereal_sha256}" "${filename}" "${url}" - fi + retrieve_package "${cereal_sha256}" "${filename}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -120,7 +110,6 @@ prepend_path CPATH "${pkg_install_dir}/include" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi - cat "${BUILDDIR}/setup_cereal" >> $SETUPFILE cat << EOF >> "${BUILDDIR}/setup_cereal" export CEREAL_ROOT="${pkg_install_dir}" export CEREAL_CFLAGS="${CEREAL_CFLAGS}" @@ -128,6 +117,7 @@ export CP_DFLAGS="\${CP_DFLAGS} -D__CEREAL" export CP_CFLAGS="\${CP_CFLAGS} ${CEREAL_CFLAGS}" export CEREAL_VERSION="${cereal_ver}" EOF + cat "${BUILDDIR}/setup_cereal" >> $SETUPFILE fi load "${BUILDDIR}/setup_cereal" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index c7b14f075e6..0d2c9ae24aa 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -34,13 +34,8 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "libcomm" "$version_suffix" -if [[ "${libcomm_ver}" =~ ^[0-9a-f]{40}$ ]]; then - short_ver="${libcomm_ver:0:7}" -else - short_ver="${libcomm_ver}" -fi -dirname="LibComm-${short_ver}" -filename="LibComm-${short_ver}.tar.gz" +dirname="LibComm-${libcomm_ver}" +filename="LibComm-${libcomm_ver}.tar.gz" source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -59,7 +54,7 @@ case "$with_libcomm" in # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${libcomm_ver}" =~ ^[0-9a-f]{40}$ ]]; then + if [[ "${libcomm_ver}" =~ ^([0-9a-f]{7}|[0-9a-f]{40})$ ]]; then url="https://codeload.github.com/abacusmodeling/LibComm/tar.gz/${libcomm_ver}" else url="https://codeload.github.com/abacusmodeling/LibComm/tar.gz/v${libcomm_ver}" @@ -67,12 +62,7 @@ case "$with_libcomm" in if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else - if [ -f $filename ]; then - echo "$filename is found" - else - # download from github.com and checksum - download_pkg_from_url "${libcomm_sha256}" "${filename}" "${url}" - fi + retrieve_package "${libcomm_sha256}" "${filename}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -120,12 +110,12 @@ if [ "$with_libcomm" != "__DONTUSE__" ]; then cat << EOF > "${BUILDDIR}/setup_libcomm" prepend_path CPATH "${pkg_install_dir}/include" EOF - cat "${BUILDDIR}/setup_libcomm" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libcomm" export LIBCOMM_CFLAGS="${LIBCOMM_CFLAGS}" export LIBCOMM_ROOT="${pkg_install_dir}" EOF + cat "${BUILDDIR}/setup_libcomm" >> $SETUPFILE fi load "${BUILDDIR}/setup_libcomm" diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index bdd7c2b3959..8a0a83b5053 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -54,12 +54,7 @@ case "$with_libnpy" in if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else - if [ -f $filename ]; then - echo "$filename is found" - else - # download from github.com and checksum - download_pkg_from_url "${libnpy_sha256}" "${filename}" "${url}" - fi + retrieve_package "${libnpy_sha256}" "${filename}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -107,12 +102,12 @@ if [ "$with_libnpy" != "__DONTUSE__" ]; then cat << EOF > "${BUILDDIR}/setup_libnpy" prepend_path CPATH "${pkg_install_dir}/include" EOF - cat "${BUILDDIR}/setup_libnpy" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libnpy" export LIBNPY_CFLAGS="${LIBNPY_CFLAGS}" export LIBNPY_ROOT="${pkg_install_dir}" EOF + cat "${BUILDDIR}/setup_libnpy" >> $SETUPFILE fi load "${BUILDDIR}/setup_libnpy" diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index a3dd10422d6..a0454e08e2e 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -34,11 +34,6 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "libri" "$version_suffix" -if [[ "${libri_ver}" =~ ^[0-9a-f]{40}$ ]]; then - short_ver="${libri_ver:0:7}" -else - short_ver="${libri_ver}" -fi source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -50,28 +45,23 @@ cd "${BUILDDIR}" case "$with_libri" in __INSTALL__) echo "==================== Installing LIBRI ====================" - dirname="LibRI-${short_ver}" + dirname="LibRI-${libri_ver}" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libri/${libri_ver}" install_lock_file="${pkg_install_dir}/install_successful" # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${libri_ver}" =~ ^[0-9a-f]{40}$ ]]; then + if [[ "${libri_ver}" =~ ^([0-9a-f]{7}|[0-9a-f]{40})$ ]]; then url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/${libri_ver}" else url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/v${libri_ver}" fi - filename="LibRI-${short_ver}.tar.gz" + filename="LibRI-${libri_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else - if [ -f $filename ]; then - echo "$filename is found" - else - # download from github.com and checksum - download_pkg_from_url "${libri_sha256}" "${filename}" "${url}" - fi + retrieve_package "${libri_sha256}" "${filename}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -119,12 +109,12 @@ if [ "$with_libri" != "__DONTUSE__" ]; then cat << EOF > "${BUILDDIR}/setup_libri" prepend_path CPATH "${pkg_install_dir}/include" EOF - cat "${BUILDDIR}/setup_libri" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_libri" export LIBRI_CFLAGS="${LIBRI_CFLAGS}" export LIBRI_ROOT="${pkg_install_dir}" EOF + cat "${BUILDDIR}/setup_libri" >> $SETUPFILE fi load "${BUILDDIR}/setup_libri" diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 6cb560af429..a92d5602e92 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -32,11 +32,6 @@ if [[ -z "$version_suffix" && -n "${ABACUS_TOOLCHAIN_VERSION_SUFFIX}" ]]; then fi # Load package variables with appropriate version load_package_vars "rapidjson" "$version_suffix" -if [[ "${rapidjson_ver}" =~ ^[0-9a-f]{40}$ ]]; then - short_ver="${rapidjson_ver:0:7}" -else - short_ver="${rapidjson_ver}" -fi source "${INSTALLDIR}"/toolchain.conf source "${INSTALLDIR}"/toolchain.env @@ -49,28 +44,23 @@ cd "${BUILDDIR}" case "$with_rapidjson" in __INSTALL__) echo "==================== Installing RapidJSON ====================" - dirname="rapidjson-${short_ver}" + dirname="rapidjson-${rapidjson_ver}" pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}" install_lock_file="${pkg_install_dir}/install_successful" # url construction rules: # - Branch names (master, main, develop) without v prefix # - Version tags (e.g., 1.0.0) with v prefix - if [[ "${rapidjson_ver}" =~ ^[0-9a-f]{40}$ ]]; then + if [[ "${rapidjson_ver}" =~ ^([0-9a-f]{7}|[0-9a-f]{40})$ ]]; then url="https://codeload.github.com/Tencent/rapidjson/tar.gz/${rapidjson_ver}" else url="https://codeload.github.com/Tencent/rapidjson/tar.gz/v${rapidjson_ver}" fi - filename="rapidjson-${short_ver}.tar.gz" + filename="rapidjson-${rapidjson_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else - if [ -f $filename ]; then - echo "$filename is found" - else - # download from github.com and checksum - download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}" - fi + retrieve_package "${rapidjson_sha256}" "${filename}" "${url}" if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" exit 0 @@ -127,7 +117,6 @@ prepend_path CPATH "${pkg_install_dir}/include" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF fi - cat "${BUILDDIR}/setup_rapidjson" >> $SETUPFILE cat << EOF >> "${BUILDDIR}/setup_rapidjson" export RAPIDJSON_ROOT="${pkg_install_dir}" export RAPIDJSON_CFLAGS="${RAPIDJSON_CFLAGS}" @@ -135,6 +124,7 @@ export CP_DFLAGS="\${CP_DFLAGS} -D__RAPIDJSON" export CP_CFLAGS="\${CP_CFLAGS} ${RAPIDJSON_CFLAGS}" export RAPIDJSON_VERSION="${rapidjson_ver}" EOF + cat "${BUILDDIR}/setup_rapidjson" >> $SETUPFILE fi load "${BUILDDIR}/setup_rapidjson" diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index b7d377cef9d..7e415e80c17 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -871,13 +871,7 @@ checksum() { # sha256sum, but has an equivalent with shasum -a 256 command -v "$__shasum_command" > /dev/null 2>&1 || __shasum_command="shasum -a 256" - if echo "$__sha256 $__filename" | ${__shasum_command} --check; then - echo "Checksum of $__filename Ok" - else - rm -v ${__filename} - report_error "Checksum of $__filename could not be verified, abort." - return 1 - fi + echo "$__sha256 $__filename" | ${__shasum_command} --check } # Enhanced checksum verification with multiple hash algorithms @@ -923,29 +917,6 @@ verify_file_integrity() { fi } -# downloader for the package tars, includes checksum -# backup and deprecated -download_pkg_from_org() { - # usage: download_pkg_from_org sha256 filename - echo "use cp2k mirror to download $__filename" - local __sha256="$1" - local __filename="$2" - local __url="https://www.cp2k.org/static/downloads/$__filename" - # download - #echo "wget ${DOWNLOADER_FLAGS} --quiet $__url" - #if ! wget ${DOWNLOADER_FLAGS} --quiet $__url; then - echo "wget ${DOWNLOADER_FLAGS} $__url" - if ! wget ${DOWNLOADER_FLAGS} $__url; then - report_error "failed to download $__url" - recommend_offline_installation $__filename $__url - if [ "${PACK_RUN}" != "__TRUE__" ]; then - return 1 - fi - fi - # checksum - checksum "$__filename" "$__sha256" -} - download_pkg_from_url() { # usage: download_pkg_from_url sha256 filename url local __sha256="$1" # if set to "--no-checksum", do not check checksum @@ -956,7 +927,7 @@ download_pkg_from_url() { case "${DOWNLOAD_CERT_POLICY:-smart}" in "strict") echo "Downloading with strict certificate validation: $__url" - if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then + if ! wget --quiet --show-progress ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then rm -f "$__filename" report_error "failed to download $__url (strict certificate validation)" recommend_offline_installation "$__filename" "$__url" @@ -967,7 +938,7 @@ download_pkg_from_url() { ;; "skip") echo "Downloading with certificate validation disabled: $__url" - if ! wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then + if ! wget --quiet --show-progress ${DOWNLOADER_FLAGS} "$__url" -O "$__filename" --no-check-certificate; then rm -f "$__filename" report_error "failed to download $__url" recommend_offline_installation "$__filename" "$__url" @@ -979,7 +950,7 @@ download_pkg_from_url() { "smart"|*) # Smart fallback: try with certificate validation first, then without echo "Attempting secure download: $__url" - if wget ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then + if wget --quiet --show-progress ${DOWNLOADER_FLAGS} "$__url" -O "$__filename"; then echo "Download successful with certificate validation" else echo "Certificate validation failed, retrying without certificate check..." @@ -997,9 +968,34 @@ download_pkg_from_url() { ;; esac - # checksum validation (unchanged) - if [ "$__sha256" != "--no-checksum" ]; then - checksum "$__filename" "$__sha256" + # checksum + if checksum "$__filename" "$__sha256"; then + echo "Checksum of $__filename OK" + else + rm -vf "${__filename}" + report_error "Checksum of $__filename could not be verified, abort." + return 1 + fi +} + +# retrieve package under current directory with filename and checksum verification +# if file exists and checksum is correct, print the success message +# if file exists but checksum is incorrect, delete and re-download +# if file does not exist, download from corresponding websites +retrieve_package() { + local __sha256="$1" + local __filename="$2" + local __url="$3" + if ! [ -f "${__filename}" ]; then + download_pkg_from_url "${__sha256}" "${__filename}" "${__url}" + else + if ! checksum "$__filename" "$__sha256"; then + echo "$__filename is found but checksum is wrong; delete and re-download" + rm -vf "${__filename}" + download_pkg_from_url "${__sha256}" "${__filename}" "${__url}" + else + echo "$__filename is found and checksum is right" + fi fi } From d9678e5e1c859722a1ea0f1b3bddbd4598b10d33 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:24:10 +0800 Subject: [PATCH 15/26] Backport: align toolchain CMake modules and workflows Aligns FindMKL/FindFFTW3 and Toolchain workflow files with real-develop final state for the 202503 to 202601 backport. Source commits include 443f89e42, f671ce128, 577ae5f81, 302ab2193, and 61734d86b. --- .github/workflows/toolchain_full.yaml | 6 +- .github/workflows/toolchain_quick.yaml | 2 +- cmake/FindFFTW3.cmake | 8 +++ cmake/FindMKL.cmake | 88 ++++++++++++++++++-------- 4 files changed, 73 insertions(+), 31 deletions(-) diff --git a/.github/workflows/toolchain_full.yaml b/.github/workflows/toolchain_full.yaml index 4fdac1557ab..3793b22eafb 100644 --- a/.github/workflows/toolchain_full.yaml +++ b/.github/workflows/toolchain_full.yaml @@ -36,7 +36,7 @@ jobs: ./bin/abacus --version || true - name: Upload logs if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: toolchain-full-gnu path: | @@ -75,7 +75,7 @@ jobs: ./bin/abacus --version || true - name: Upload logs if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: toolchain-full-intel path: | @@ -136,7 +136,7 @@ jobs: ./bin/abacus --version || true - name: Upload logs if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: toolchain-full-cuda path: | diff --git a/.github/workflows/toolchain_quick.yaml b/.github/workflows/toolchain_quick.yaml index 33c6a92d067..3c2b58a8106 100644 --- a/.github/workflows/toolchain_quick.yaml +++ b/.github/workflows/toolchain_quick.yaml @@ -71,7 +71,7 @@ jobs: fi - name: Upload setup if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: toolchain-${{ matrix.variant }}-packrun path: | diff --git a/cmake/FindFFTW3.cmake b/cmake/FindFFTW3.cmake index 7ae0b7a2abd..b79f97013ca 100644 --- a/cmake/FindFFTW3.cmake +++ b/cmake/FindFFTW3.cmake @@ -49,6 +49,14 @@ if(FFTW3_FOUND) set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) + # Try to extract FFTW version from header + if(FFTW3_INCLUDE_DIR AND EXISTS "${FFTW3_INCLUDE_DIR}/fftw3.h") + file(STRINGS "${FFTW3_INCLUDE_DIR}/fftw3.h" _fftw_ver_line REGEX "^#define[\t ]+FFTW_VERSION[\t ]+\"[^\"]+\"") + if(_fftw_ver_line) + string(REGEX REPLACE "^#define[\t ]+FFTW_VERSION[\t ]+\"([^\"]+)\"" "\\1" FFTW3_VERSION "${_fftw_ver_line}") + endif() + endif() + if(NOT TARGET FFTW3::FFTW3) add_library(FFTW3::FFTW3 UNKNOWN IMPORTED) set_target_properties(FFTW3::FFTW3 PROPERTIES diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index a0c389b5aee..5d8ccdcc9b4 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -4,17 +4,36 @@ # MKL_INCLUDE - where to find mkl.h, etc. # MKL_FOUND - True if mkl found. -find_package(MKL NO_MODULE) # try using official module first +# find_package(MKL NO_MODULE) # try using official module first if(NOT TARGET MKL::MKL) find_path(MKL_INCLUDE mkl_service.h HINTS ${MKLROOT}/include) -find_library(MKL_INTEL NAMES mkl_intel_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) -find_library(MKL_INTEL_THREAD NAMES mkl_intel_thread HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) find_library(MKL_CORE NAMES mkl_core HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) +if(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + find_library(MKL_INTERFACE_LIB NAMES mkl_intel_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) + find_library(MKL_THREAD NAMES mkl_intel_thread HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) + find_library(MKL_IOMP5 NAMES iomp5 + HINTS ENV CMPLR_ROOT + PATH_SUFFIXES lib lib/intel64 linux/compiler/lib/intel64_lin + ) +else() + find_library(MKL_INTERFACE_LIB NAMES mkl_gf_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) + find_library(MKL_THREAD NAMES mkl_gnu_thread HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) + # With GCC we use system-installed GNU OpenMP +endif() + if(ENABLE_MPI) + execute_process(COMMAND ${MPI_CXX_COMPILER} --showme:version + OUTPUT_VARIABLE MPI_VER_OUT + ERROR_VARIABLE MPI_VER_ERR) + if(MPI_VER_OUT MATCHES "Open MPI" OR MPI_VER_ERR MATCHES "Open MPI") + set(MKL_BLACS_LIB_NAME "mkl_blacs_openmpi_lp64") + else() + set(MKL_BLACS_LIB_NAME "mkl_blacs_intelmpi_lp64") + endif() find_library(MKL_SCALAPACK NAMES mkl_scalapack_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) - find_library(MKL_BLACS_INTELMPI NAMES mkl_blacs_intelmpi_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) + find_library(MKL_BLACS NAMES ${MKL_BLACS_LIB_NAME} HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) endif() include(FindPackageHandleStandardArgs) @@ -22,22 +41,22 @@ include(FindPackageHandleStandardArgs) # if all listed variables are TRUE if(ENABLE_MPI) - find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INTEL MKL_INTEL_THREAD MKL_CORE MKL_SCALAPACK MKL_BLACS_INTELMPI MKL_INCLUDE) + find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_SCALAPACK MKL_BLACS MKL_INCLUDE) else() - find_package_handle_standard_args(MKL MKL_INTEL MKL_INTEL_THREAD MKL_CORE MKL_INCLUDE) + find_package_handle_standard_args(MKL MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_INCLUDE) endif() if(MKL_FOUND) - if(NOT TARGET MKL::INTEL) - add_library(MKL::INTEL UNKNOWN IMPORTED) - set_target_properties(MKL::INTEL PROPERTIES - IMPORTED_LOCATION "${MKL_INTEL}" + if(NOT TARGET MKL::INTERFACE_LIB) + add_library(MKL::INTERFACE_LIB UNKNOWN IMPORTED) + set_target_properties(MKL::INTERFACE_LIB PROPERTIES + IMPORTED_LOCATION "${MKL_INTERFACE_LIB}" INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE}") endif() - if(NOT TARGET MKL::INTEL_THREAD) - add_library(MKL::INTEL_THREAD UNKNOWN IMPORTED) - set_target_properties(MKL::INTEL_THREAD PROPERTIES - IMPORTED_LOCATION "${MKL_INTEL_THREAD}" + if(NOT TARGET MKL::THREAD) + add_library(MKL::THREAD UNKNOWN IMPORTED) + set_target_properties(MKL::THREAD PROPERTIES + IMPORTED_LOCATION "${MKL_THREAD}" INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE}") endif() if(NOT TARGET MKL::CORE) @@ -52,44 +71,59 @@ if(MKL_FOUND) IMPORTED_LOCATION "${MKL_SCALAPACK}" INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE}") endif() - if(NOT TARGET MKL::BLACS_INTELMPI) - add_library(MKL::BLACS_INTELMPI UNKNOWN IMPORTED) - set_target_properties(MKL::BLACS_INTELMPI PROPERTIES - IMPORTED_LOCATION "${MKL_BLACS_INTELMPI}" + if(ENABLE_MPI AND NOT TARGET MKL::BLACS) + add_library(MKL::BLACS UNKNOWN IMPORTED) + set_target_properties(MKL::BLACS PROPERTIES + IMPORTED_LOCATION "${MKL_BLACS}" INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE}") endif() + if(MKL_IOMP5 AND NOT TARGET MKL::IOMP5) + add_library(MKL::IOMP5 UNKNOWN IMPORTED) + set_target_properties(MKL::IOMP5 PROPERTIES + IMPORTED_LOCATION "${MKL_IOMP5}") + endif() add_library(MKL::MKL INTERFACE IMPORTED) if (ENABLE_MPI) set_property(TARGET MKL::MKL PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--start-group" - MKL::INTEL MKL::INTEL_THREAD MKL::CORE MKL::MKL_SCALAPACK MKL::BLACS_INTELMPI + MKL::INTERFACE_LIB MKL::THREAD MKL::CORE MKL::MKL_SCALAPACK MKL::BLACS "-Wl,--end-group" ) else() set_property(TARGET MKL::MKL PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--start-group" - MKL::INTEL MKL::INTEL_THREAD MKL::CORE) + MKL::INTERFACE_LIB MKL::THREAD MKL::CORE + "-Wl,--end-group" + ) + endif() + if(TARGET MKL::IOMP5) + set_property(TARGET MKL::MKL APPEND PROPERTY + INTERFACE_LINK_LIBRARIES MKL::IOMP5) endif() endif() if(ENABLE_MPI) - mark_as_advanced(MKL_INCLUDE MKL_INTEL MKL_INTEL_THREAD MKL_CORE MKL_SCALAPACK MKL_BLACS_INTELMPI) + mark_as_advanced(MKL_INCLUDE MKL_INTERFACE_LIB MKL_THREAD MKL_CORE MKL_SCALAPACK MKL_BLACS) else() - mark_as_advanced(MKL_INCLUDE MKL_INTEL MKL_INTEL_THREAD MKL_CORE) + mark_as_advanced(MKL_INCLUDE MKL_INTERFACE_LIB MKL_THREAD MKL_CORE) endif() endif() # MKL::MKL -# For compatibility with legacy libpaw_interface CMakeLists.txt -if(TARGET MKL::MKL AND NOT TARGET IntelMKL::MKL) - add_library(IntelMKL::MKL ALIAS MKL::MKL) -endif() + # In oneAPI 2022, MKL_SCALAPACK might not be linked properly if(NOT TARGET MKL::MKL_SCALAPACK) find_library(MKL_SCALAPACK NAMES mkl_scalapack_lp64 HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) message(STATUS "Found MKL_SCALAPACK: ${MKL_SCALAPACK}") - add_library(MKL::MKL_SCALAPACK OBJECT IMPORTED MKL_SCALAPACK) + if(MKL_SCALAPACK) + # create an IMPORTED target that points to the discovered library file + add_library(MKL::MKL_SCALAPACK UNKNOWN IMPORTED) + set_target_properties(MKL::MKL_SCALAPACK PROPERTIES + IMPORTED_LOCATION "${MKL_SCALAPACK}" + INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE}" + ) + endif() endif() From de760f0433bd2eeed53d737c3fd2b539230b5cce Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:25:11 +0800 Subject: [PATCH 16/26] Backport: document GCC MKL toolchain entry Completes the 202601 toolchain README update while leaving cuSolverMP/NCCL documentation changes out of the LTS backport scope. --- toolchain/README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index ca9203f2506..d7d072b916b 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -57,8 +57,9 @@ For new users, start with one of these pre-configured toolchains: # GNU toolchain (GCC + OpenMPI + OpenBLAS) ./toolchain_gnu.sh -# Intel toolchain (Intel compilers + Intel MPI + MKL) -./toolchain_intel.sh +# Intel toolchain +./toolchain_gcc-mkl.sh # GCC + OpenMPI + MKL +./toolchain_intel.sh # Intel compilers + Intel MPI + MKL # AMD toolchain options ./toolchain_gcc-aocl.sh # GCC + AMD AOCL @@ -355,10 +356,6 @@ Related discussion here [#4976](https://github.com/deepmodeling/abacus-develop/i Notice: `icc` and `icpc` from Intel Classic Compiler of Intel-oneAPI are not supported for 2024.0 and newer version. And Intel-OneAPI 2023.2.0 can be found in QE website. You need to download Base-toolkit for MKL and HPC-toolkit for MPi and compiler for Intel-OneAPI 2023.2.0, while in Intel-OneAPI 2024.x, only the HPC-toolkit is needed. -#### Gcc-MKL Issues - -You cannot use gcc as compiler while using MKL as math library for compile ABACUS, there will be lots of error in the lask linking step. See [#3198](https://github.com/deepmodeling/abacus-develop/issues/3198) - #### AMD AOCC-AOCL problem Use AOCC-AOCL to compile dependencies is permitted and usually get boosting in ABACUS efficiency. But you need to get rid of `flang` while compiling ELPA. Toolchain itself helps you make this `flang` shade in default of `aocc-aocl` toolchain, and you can manually use `flang` by setting `--with-flang=yes` in `toolchain_aocc-aocl.sh` to have a try, while toolchain helps you to bypass the possible errors in compiling ELPA with AOCC-AOCL, but the computing efficiency will be relatively lower compared to `gnu` or `gcc-aocl` toolchain. There are some issues related to the numeric instability of ABACUS compiled by AOCC-AOCL toolchain, see [#6420](https://github.com/deepmodeling/abacus-develop/issues/6420) From 4a89da2a9ad989bd27968006f636c38cfd1d552a Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 17:26:58 +0800 Subject: [PATCH 17/26] Backport: remove toolchain UI trailing whitespace --- toolchain/scripts/lib/user_interface.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/scripts/lib/user_interface.sh b/toolchain/scripts/lib/user_interface.sh index 08a75f40450..01468a91352 100644 --- a/toolchain/scripts/lib/user_interface.sh +++ b/toolchain/scripts/lib/user_interface.sh @@ -791,7 +791,7 @@ ui_show_summary() { cuda_version="unavailable" fi fi - + echo " ├─ GPU: $gpu_info" echo " ├─ NVIDIA Driver: $nvidia_driver" echo " └─ CUDA Version: $cuda_version" From 16d11e03fde11419fbeffe6d727489511e6cb029 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 18:50:38 +0800 Subject: [PATCH 18/26] Toolchain: fix ELPA environment setup for ABACUS build Set elpa_include in the install path and ensure the include/elpa compatibility symlink is created even when an existing ELPA install is reused. This lets build_abacus_gnu.sh find ELPA after sourcing toolchain/install/setup. --- toolchain/scripts/stage3/install_elpa.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 7d72e33e58e..cb9f08db756 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -186,17 +186,17 @@ case "$with_elpa" in make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log cd .. - # link elpa - link=${pkg_install_dir}/include/elpa - if [[ ! -d $link ]]; then - ln -s ${pkg_install_dir}/include/elpa_openmp-${elpa_ver}/elpa $link - fi done cd .. write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage3/$(basename ${SCRIPT_NAME})" fi [ "$enable_openmp" != "yes" ] && elpa_dir_openmp="" + elpa_include="${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}" + link="${pkg_install_dir}/include/elpa" + if [[ -d "${elpa_include}/elpa" && ! -e "$link" && ! -L "$link" ]]; then + ln -s "${elpa_include}/elpa" "$link" + fi ELPA_CFLAGS="-I'${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}/modules' -I'${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}/elpa'" ELPA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'" ;; From 2d2635057c6025008ec050965ee32d6090a69297 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Thu, 7 May 2026 23:09:11 +0800 Subject: [PATCH 19/26] Backport: refine toolchain setup filtering Backports the setup filtering direction from deepmodeling/abacus-develop#7319 with an LTS-specific safer filter that preserves conditional blocks. Also keeps the ELPA CPU/NVIDIA install layout discoverable for ABACUS builds and brings in the minimal MPI CXX component change from #7139. --- CMakeLists.txt | 2 +- toolchain/scripts/stage0/install_amd.sh | 2 +- toolchain/scripts/stage0/install_cmake.sh | 2 +- toolchain/scripts/stage0/install_gcc.sh | 2 +- toolchain/scripts/stage0/install_intel.sh | 2 +- toolchain/scripts/stage1/install_intelmpi.sh | 2 +- toolchain/scripts/stage1/install_mpich.sh | 2 +- toolchain/scripts/stage1/install_openmpi.sh | 2 +- toolchain/scripts/stage2/install_aocl.sh | 2 +- toolchain/scripts/stage2/install_mkl.sh | 2 +- toolchain/scripts/stage2/install_openblas.sh | 2 +- toolchain/scripts/stage3/install_elpa.sh | 66 +++++++++++++------ toolchain/scripts/stage3/install_fftw.sh | 2 +- toolchain/scripts/stage3/install_libxc.sh | 2 +- toolchain/scripts/stage3/install_scalapack.sh | 2 +- toolchain/scripts/stage4/install_cereal.sh | 5 +- toolchain/scripts/stage4/install_libcomm.sh | 3 +- toolchain/scripts/stage4/install_libnpy.sh | 3 +- toolchain/scripts/stage4/install_libri.sh | 3 +- toolchain/scripts/stage4/install_libtorch.sh | 19 +++--- toolchain/scripts/stage4/install_nep.sh | 11 +--- toolchain/scripts/stage4/install_rapidjson.sh | 6 +- toolchain/scripts/tool_kit.sh | 17 +++++ 23 files changed, 92 insertions(+), 69 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2f5dec2bdb..37865d40067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,7 @@ if(DEBUG_INFO) endif() if(ENABLE_MPI) - find_package(MPI REQUIRED) + find_package(MPI COMPONENTS CXX REQUIRED) include_directories(${MPI_CXX_INCLUDE_PATH}) target_link_libraries(${ABACUS_BIN_NAME} MPI::MPI_CXX) add_compile_definitions(__MPI) diff --git a/toolchain/scripts/stage0/install_amd.sh b/toolchain/scripts/stage0/install_amd.sh index e0fda73712f..616697de192 100755 --- a/toolchain/scripts/stage0/install_amd.sh +++ b/toolchain/scripts/stage0/install_amd.sh @@ -90,7 +90,7 @@ export AMD_CFLAGS="${AMD_CFLAGS}" export AMD_LDFLAGS="${AMD_LDFLAGS}" export AMD_LIBS="${AMD_LIBS}" EOF - cat "${BUILDDIR}/setup_amd" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_amd" ${SETUPFILE} fi load "${BUILDDIR}/setup_amd" diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index 482c75d40af..1084e757f3e 100755 --- a/toolchain/scripts/stage0/install_cmake.sh +++ b/toolchain/scripts/stage0/install_cmake.sh @@ -133,7 +133,7 @@ if [ "${with_cmake}" != "__DONTUSE__" ]; then cat << EOF > "${BUILDDIR}/setup_cmake" prepend_path PATH "${pkg_install_dir}/bin" EOF - cat "${BUILDDIR}/setup_cmake" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_cmake" $SETUPFILE fi fi diff --git a/toolchain/scripts/stage0/install_gcc.sh b/toolchain/scripts/stage0/install_gcc.sh index 6091b8c450e..74855d404fe 100755 --- a/toolchain/scripts/stage0/install_gcc.sh +++ b/toolchain/scripts/stage0/install_gcc.sh @@ -231,7 +231,7 @@ export GCC_CFLAGS="${GCC_CFLAGS}" export GCC_LDFLAGS="${GCC_LDFLAGS}" export TSANFLAGS="${TSANFLAGS}" EOF - cat "${BUILDDIR}/setup_gcc" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_gcc" ${SETUPFILE} fi # ---------------------------------------------------------------------- diff --git a/toolchain/scripts/stage0/install_intel.sh b/toolchain/scripts/stage0/install_intel.sh index 246a2f01438..f8cc9fe8a6e 100755 --- a/toolchain/scripts/stage0/install_intel.sh +++ b/toolchain/scripts/stage0/install_intel.sh @@ -94,7 +94,7 @@ export INTEL_CFLAGS="${INTEL_CFLAGS}" export INTEL_LDFLAGS="${INTEL_LDFLAGS}" export INTEL_LIBS="${INTEL_LIBS}" EOF - cat "${BUILDDIR}/setup_intel" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_intel" ${SETUPFILE} fi load "${BUILDDIR}/setup_intel" diff --git a/toolchain/scripts/stage1/install_intelmpi.sh b/toolchain/scripts/stage1/install_intelmpi.sh index f844744e83b..bad4ba604a3 100755 --- a/toolchain/scripts/stage1/install_intelmpi.sh +++ b/toolchain/scripts/stage1/install_intelmpi.sh @@ -144,7 +144,7 @@ export CP_CFLAGS="\${CP_CFLAGS} IF_MPI(${INTELMPI_CFLAGS}|)" export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${INTELMPI_LDFLAGS}|)" export CP_LIBS="\${CP_LIBS} IF_MPI(${INTELMPI_LIBS}|)" EOF - cat "${BUILDDIR}/setup_intelmpi" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_intelmpi" ${SETUPFILE} fi load "${BUILDDIR}/setup_intelmpi" diff --git a/toolchain/scripts/stage1/install_mpich.sh b/toolchain/scripts/stage1/install_mpich.sh index fc48b54080d..66cdf1cfbfc 100755 --- a/toolchain/scripts/stage1/install_mpich.sh +++ b/toolchain/scripts/stage1/install_mpich.sh @@ -171,7 +171,7 @@ prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path CPATH "${pkg_install_dir}/include" EOF fi - cat "${BUILDDIR}/setup_mpich" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_mpich" ${SETUPFILE} fi # Update leak suppression file diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index 1c24b01ef68..9931b15ee58 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -202,7 +202,7 @@ prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path CPATH "${pkg_install_dir}/include" EOF fi - cat "${BUILDDIR}/setup_openmpi" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_openmpi" ${SETUPFILE} fi # ---------------------------------------------------------------------- diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index 01701171930..2145b647873 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -66,7 +66,7 @@ export MATH_CFLAGS="\${MATH_CFLAGS} ${AOCL_CFLAGS}" export MATH_LDFLAGS="\${MATH_LDFLAGS} ${AOCL_LDFLAGS}" export MATH_LIBS="\${MATH_LIBS} ${AOCL_LIBS}" EOF - cat "${BUILDDIR}/setup_aocl" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_aocl" $SETUPFILE fi load "${BUILDDIR}/setup_aocl" diff --git a/toolchain/scripts/stage2/install_mkl.sh b/toolchain/scripts/stage2/install_mkl.sh index 34248284e4a..d0ff9f99239 100755 --- a/toolchain/scripts/stage2/install_mkl.sh +++ b/toolchain/scripts/stage2/install_mkl.sh @@ -136,7 +136,7 @@ export FFTW_LDFLAGS="${MKL_LDFLAGS}" export FFTW_LIBS="${MKL_LIBS}" EOF fi - cat "${BUILDDIR}/setup_mkl" >> ${SETUPFILE} + filter_setup "${BUILDDIR}/setup_mkl" ${SETUPFILE} fi load "${BUILDDIR}/setup_mkl" diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 45d85e94939..6c6a8a40866 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -184,7 +184,7 @@ export MATH_LIBS="\${MATH_LIBS} ${OPENBLAS_LIBS}" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_openblas" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_openblas" $SETUPFILE fi load "${BUILDDIR}/setup_openblas" diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index cb9f08db756..b31e004e64e 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -115,19 +115,16 @@ case "$with_elpa" in [ "$TARGET" = "nvidia" ] && [ "$gpu_enabled" != "__TRUE__" ] && continue # disable cpu if cuda is enabled, only install one [ "$TARGET" != "nvidia" ] && [ "$gpu_enabled" = "__TRUE__" ] && continue - # extend the pkg_install_dir by TARGET - # this linking method is totally different from cp2k toolchain - # for cp2k, ref https://github.com/cp2k/cp2k/commit/6fe2fc105b8cded84256248f68c74139dd8fc2e9 - pkg_install_dir="${pkg_install_dir}/${TARGET}" + target_install_dir="${pkg_install_dir}/${TARGET}" - echo "Installing from scratch into ${pkg_install_dir}" + echo "Installing from scratch into ${target_install_dir}" mkdir -p "build_${TARGET}" cd "build_${TARGET}" if [ "${with_amd}" != "__DONTUSE__" ] && [ "${WITH_FLANG}" = "yes" ] ; then # special option for flang compiler echo "AMD fortran compiler detected, enable special option operation" - ../configure --prefix="${pkg_install_dir}" \ - --libdir="${pkg_install_dir}/lib" \ + ../configure --prefix="${target_install_dir}" \ + --libdir="${target_install_dir}/lib" \ --enable-openmp=${enable_openmp} \ --enable-static=no \ --enable-shared=yes \ @@ -158,8 +155,8 @@ case "$with_elpa" in -e 's/\\$wl\\$soname //g' else # normal installation - ../configure --prefix="${pkg_install_dir}/" \ - --libdir="${pkg_install_dir}/lib" \ + ../configure --prefix="${target_install_dir}" \ + --libdir="${target_install_dir}/lib" \ --enable-openmp=${enable_openmp} \ --enable-static=no \ --enable-shared=yes \ @@ -192,13 +189,17 @@ case "$with_elpa" in write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage3/$(basename ${SCRIPT_NAME})" fi [ "$enable_openmp" != "yes" ] && elpa_dir_openmp="" - elpa_include="${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}" - link="${pkg_install_dir}/include/elpa" - if [[ -d "${elpa_include}/elpa" && ! -e "$link" && ! -L "$link" ]]; then - ln -s "${elpa_include}/elpa" "$link" - fi - ELPA_CFLAGS="-I'${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}/modules' -I'${pkg_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}/elpa'" - ELPA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'" + for TARGET in "cpu" "nvidia"; do + target_install_dir="${pkg_install_dir}/${TARGET}" + elpa_include_target="${target_install_dir}/include/elpa${elpa_dir_openmp}-${elpa_ver}" + link="${target_install_dir}/include/elpa" + if [[ -d "${elpa_include_target}/elpa" && ! -e "$link" && ! -L "$link" ]]; then + ln -s "${elpa_include_target}/elpa" "$link" + fi + done + elpa_include="${pkg_install_dir}/IF_CUDA(nvidia|cpu)/include/elpa${elpa_dir_openmp}-${elpa_ver}" + ELPA_CFLAGS="-I'${elpa_include}/modules' -I'${elpa_include}/elpa'" + ELPA_LDFLAGS="-L'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/lib' -Wl,-rpath,'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/lib'" ;; __SYSTEM__) echo "==================== Finding ELPA from system paths ====================" @@ -241,11 +242,35 @@ case "$with_elpa" in esac if [ "$with_elpa" != "__DONTUSE__" ]; then ELPA_LIBS="-lelpa${elpa_dir_openmp}" - cat << EOF > "${BUILDDIR}/setup_elpa" + if [ "$with_elpa" = "__INSTALL__" ]; then + cat << EOF > "${BUILDDIR}/setup_elpa" +if [ -d "${pkg_install_dir}/cpu" ]; then + prepend_path PATH "${pkg_install_dir}/cpu/bin" + prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/cpu/lib" + prepend_path CPATH "${pkg_install_dir}/cpu/include/elpa${elpa_dir_openmp}-${elpa_ver}" + prepend_path CPATH "${pkg_install_dir}/cpu/include" + prepend_path LD_RUN_PATH "${pkg_install_dir}/cpu/lib" + prepend_path LIBRARY_PATH "${pkg_install_dir}/cpu/lib" + prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/cpu/lib/pkgconfig" + prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/cpu" +fi +if [ -d "${pkg_install_dir}/nvidia" ]; then + prepend_path PATH "${pkg_install_dir}/nvidia/bin" + prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/nvidia/lib" + prepend_path CPATH "${pkg_install_dir}/nvidia/include/elpa${elpa_dir_openmp}-${elpa_ver}" + prepend_path CPATH "${pkg_install_dir}/nvidia/include" + prepend_path LD_RUN_PATH "${pkg_install_dir}/nvidia/lib" + prepend_path LIBRARY_PATH "${pkg_install_dir}/nvidia/lib" + prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/nvidia/lib/pkgconfig" + prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/nvidia" +fi +EOF + else + cat << EOF > "${BUILDDIR}/setup_elpa" prepend_path CPATH "$elpa_include" EOF - if [ "$with_elpa" != "__SYSTEM__" ]; then - cat << EOF >> "${BUILDDIR}/setup_elpa" + if [ "$with_elpa" != "__SYSTEM__" ]; then + cat << EOF >> "${BUILDDIR}/setup_elpa" prepend_path PATH "${pkg_install_dir}/bin" prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path CPATH "${pkg_install_dir}/include" @@ -254,6 +279,7 @@ prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" EOF + fi fi cat << EOF >> "${BUILDDIR}/setup_elpa" export ELPA_ROOT="${pkg_install_dir}" @@ -266,7 +292,7 @@ export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${ELPA_LDFLAGS}|)" export CP_LIBS="IF_MPI(${ELPA_LIBS}|) \${CP_LIBS}" export ELPA_VERSION="${elpa_ver}" EOF - cat "${BUILDDIR}/setup_elpa" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_elpa" $SETUPFILE fi load "${BUILDDIR}/setup_elpa" diff --git a/toolchain/scripts/stage3/install_fftw.sh b/toolchain/scripts/stage3/install_fftw.sh index a40f514ca44..766e8badbe0 100755 --- a/toolchain/scripts/stage3/install_fftw.sh +++ b/toolchain/scripts/stage3/install_fftw.sh @@ -146,7 +146,7 @@ export CP_LIBS="${FFTW_LIBS} \${CP_LIBS}" export FFTW_ROOT=${FFTW_ROOT:-${pkg_install_dir}} export FFTW3_ROOT=${pkg_install_dir} EOF - cat "${BUILDDIR}/setup_fftw" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_fftw" $SETUPFILE fi cd "${ROOTDIR}" diff --git a/toolchain/scripts/stage3/install_libxc.sh b/toolchain/scripts/stage3/install_libxc.sh index e3efa166a67..b839e2bc01a 100755 --- a/toolchain/scripts/stage3/install_libxc.sh +++ b/toolchain/scripts/stage3/install_libxc.sh @@ -127,7 +127,7 @@ export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBXC_LDFLAGS}" export CP_LIBS="${LIBXC_LIBS} \${CP_LIBS}" export LIBXC_ROOT="${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_libxc" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_libxc" $SETUPFILE fi load "${BUILDDIR}/setup_libxc" diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index 9151e7dfebe..f5641eb047f 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -124,7 +124,7 @@ export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__SCALAPACK|)" export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${SCALAPACK_LDFLAGS}|)" export CP_LIBS="IF_MPI(-lscalapack|) \${CP_LIBS}" EOF - cat "${BUILDDIR}/setup_scalapack" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_scalapack" $SETUPFILE fi cd "${ROOTDIR}" diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index e442a2413d9..54ee3d6e8bc 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -112,12 +112,9 @@ EOF fi cat << EOF >> "${BUILDDIR}/setup_cereal" export CEREAL_ROOT="${pkg_install_dir}" -export CEREAL_CFLAGS="${CEREAL_CFLAGS}" -export CP_DFLAGS="\${CP_DFLAGS} -D__CEREAL" -export CP_CFLAGS="\${CP_CFLAGS} ${CEREAL_CFLAGS}" export CEREAL_VERSION="${cereal_ver}" EOF - cat "${BUILDDIR}/setup_cereal" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_cereal" $SETUPFILE fi load "${BUILDDIR}/setup_cereal" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 0d2c9ae24aa..2fe17f0610e 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -112,10 +112,9 @@ prepend_path CPATH "${pkg_install_dir}/include" EOF fi cat << EOF >> "${BUILDDIR}/setup_libcomm" -export LIBCOMM_CFLAGS="${LIBCOMM_CFLAGS}" export LIBCOMM_ROOT="${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_libcomm" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_libcomm" $SETUPFILE fi load "${BUILDDIR}/setup_libcomm" diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index 8a0a83b5053..4154fe76331 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -104,10 +104,9 @@ prepend_path CPATH "${pkg_install_dir}/include" EOF fi cat << EOF >> "${BUILDDIR}/setup_libnpy" -export LIBNPY_CFLAGS="${LIBNPY_CFLAGS}" export LIBNPY_ROOT="${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_libnpy" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_libnpy" $SETUPFILE fi load "${BUILDDIR}/setup_libnpy" diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index a0454e08e2e..fde55fb7549 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -111,10 +111,9 @@ prepend_path CPATH "${pkg_install_dir}/include" EOF fi cat << EOF >> "${BUILDDIR}/setup_libri" -export LIBRI_CFLAGS="${LIBRI_CFLAGS}" export LIBRI_ROOT="${pkg_install_dir}" EOF - cat "${BUILDDIR}/setup_libri" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_libri" $SETUPFILE fi load "${BUILDDIR}/setup_libri" diff --git a/toolchain/scripts/stage4/install_libtorch.sh b/toolchain/scripts/stage4/install_libtorch.sh index ed05c178330..340292028fe 100755 --- a/toolchain/scripts/stage4/install_libtorch.sh +++ b/toolchain/scripts/stage4/install_libtorch.sh @@ -96,10 +96,7 @@ case "${with_libtorch}" in check_dir "${LIBTORCH_LIBDIR}" LIBTORCH_CXXFLAGS="-I${pkg_install_dir}/include" - if [ "$ENABLE_CUDA" = "__TRUE__" ]; then - LIBTORCH_LDFLAGS="-Wl,--no-as-needed,-L'${LIBTORCH_LIBDIR}' -Wl,--no-as-needed,-rpath='${LIBTORCH_LIBDIR}'" - LIBTORCH_LDFLAGS="-L'${LIBTORCH_LIBDIR}' -Wl,-rpath='${LIBTORCH_LIBDIR}'" - fi + LIBTORCH_LDFLAGS="-L'${LIBTORCH_LIBDIR}' -Wl,-rpath='${LIBTORCH_LIBDIR}'" ;; esac @@ -111,6 +108,7 @@ prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig" prepend_path CMAKE_PREFIX_PATH "$pkg_install_dir" +prepend_path CPATH "${pkg_install_dir}/include" export LD_LIBRARY_PATH="${pkg_install_dir}/lib":\${LD_LIBRARY_PATH} export LD_RUN_PATH="${pkg_install_dir}/lib":\${LD_RUN_PATH} export LIBRARY_PATH="${pkg_install_dir}/lib":\${LIBRARY_PATH} @@ -119,22 +117,21 @@ export PKG_CONFIG_PATH="${pkg_install_dir}/lib/pkgconfig":\${PKG_CONFIG_PATH} export CMAKE_PREFIX_PATH="${pkg_install_dir}":\${CMAKE_PREFIX_PATH} EOF fi - if [ "$ENABLE_CUDA" = "__TRUE__" ]; then - cat << EOF >> "${BUILDDIR}/setup_libtorch" + cat << EOF >> "${BUILDDIR}/setup_libtorch" export CP_DFLAGS="\${CP_DFLAGS} -D__LIBTORCH" export CXXFLAGS="\${CXXFLAGS} ${LIBTORCH_CXXFLAGS}" export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBTORCH_LDFLAGS}" +EOF + if [ "$ENABLE_CUDA" = "__TRUE__" ]; then + cat << EOF >> "${BUILDDIR}/setup_libtorch" export CP_LIBS="\${CP_LIBS} -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda -ltorch" EOF - cat "${BUILDDIR}/setup_libtorch" >> "${SETUPFILE}" + else cat << EOF >> "${BUILDDIR}/setup_libtorch" -export CP_DFLAGS="\${CP_DFLAGS} -D__LIBTORCH" -export CXXFLAGS="\${CXXFLAGS} ${LIBTORCH_CXXFLAGS}" -export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBTORCH_LDFLAGS}" export CP_LIBS="\${CP_LIBS} -lc10 -ltorch_cpu -ltorch" EOF - cat "${BUILDDIR}/setup_libtorch" >> "${SETUPFILE}" fi + filter_setup "${BUILDDIR}/setup_libtorch" "${SETUPFILE}" fi load "${BUILDDIR}/setup_libtorch" diff --git a/toolchain/scripts/stage4/install_nep.sh b/toolchain/scripts/stage4/install_nep.sh index 3a5ad8eb6fd..043c6baf72f 100755 --- a/toolchain/scripts/stage4/install_nep.sh +++ b/toolchain/scripts/stage4/install_nep.sh @@ -136,22 +136,15 @@ export LIBRARY_PATH="$pkg_install_dir/lib":\${LIBRARY_PATH} export CPATH="$pkg_install_dir/include":\${CPATH} export CMAKE_PREFIX_PATH="$pkg_install_dir":\${CMAKE_PREFIX_PATH} EOF - cat "${BUILDDIR}/setup_nep" >> $SETUPFILE fi cat << EOF >> "${BUILDDIR}/setup_nep" -export NEP_CFLAGS="${NEP_CFLAGS}" -export NEP_LDFLAGS="${NEP_LDFLAGS}" -export NEP_LIBS="${NEP_LIBS}" -export CP_DFLAGS="\${CP_DFLAGS} -D__NEP" -export CP_CFLAGS="\${CP_CFLAGS} \${NEP_CFLAGS}" -export CP_LDFLAGS="\${CP_LDFLAGS} \${NEP_LDFLAGS}" -export CP_LIBS="\${NEP_LIBS} \${CP_LIBS}" export NEP_ROOT="$pkg_install_dir" EOF + filter_setup "${BUILDDIR}/setup_nep" $SETUPFILE fi load "${BUILDDIR}/setup_nep" write_toolchain_env "${INSTALLDIR}" cd "${ROOTDIR}" -report_timing "nep" \ No newline at end of file +report_timing "nep" diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index a92d5602e92..2ee5eb0467e 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -119,12 +119,8 @@ EOF fi cat << EOF >> "${BUILDDIR}/setup_rapidjson" export RAPIDJSON_ROOT="${pkg_install_dir}" -export RAPIDJSON_CFLAGS="${RAPIDJSON_CFLAGS}" -export CP_DFLAGS="\${CP_DFLAGS} -D__RAPIDJSON" -export CP_CFLAGS="\${CP_CFLAGS} ${RAPIDJSON_CFLAGS}" -export RAPIDJSON_VERSION="${rapidjson_ver}" EOF - cat "${BUILDDIR}/setup_rapidjson" >> $SETUPFILE + filter_setup "${BUILDDIR}/setup_rapidjson" $SETUPFILE fi load "${BUILDDIR}/setup_rapidjson" diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 7e415e80c17..485e91d8142 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -1049,3 +1049,20 @@ write_toolchain_env() { export -p ) > "${__installdir}/toolchain.env" } + +# Append a setup fragment to the public setup file, keeping runtime search paths +# and package roots while dropping build-only flag variables. +filter_setup() { + local source_file="$1" + local target_file="$2" + + if [[ ! -f "$source_file" ]]; then + report_error "File '$source_file' does not exist." + return 1 + fi + + local filename + filename=$(basename "$source_file") + echo "# ==================== Setup for ${filename#*_} ==================== #" >> "$target_file" + grep -v -E '^[[:space:]]*(export[[:space:]]+)?([A-Za-z0-9_]+_)?(CFLAGS|CXXFLAGS|FCFLAGS|LDFLAGS|LIBS|INCLUDES)="|^[[:space:]]*export[[:space:]]+CP_(DFLAGS|CFLAGS|LDFLAGS|LIBS)="|^[[:space:]]*# (For|Other)' "$source_file" >> "$target_file" +} From cbd5c9ae77ec797897bc0028292c56f6b5632197 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 00:02:49 +0800 Subject: [PATCH 20/26] Fix toolchain setup filtering for empty conditionals filter_setup now drops conditional blocks whose contents are fully filtered, preventing generated install/setup files from containing empty if/fi blocks such as the OpenMPI mpi_f08 check. Conditional blocks with runtime path setup, such as ELPA CPU/NVIDIA paths, are preserved. --- toolchain/scripts/tool_kit.sh | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 485e91d8142..5db282ae8e2 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -1064,5 +1064,38 @@ filter_setup() { local filename filename=$(basename "$source_file") echo "# ==================== Setup for ${filename#*_} ==================== #" >> "$target_file" - grep -v -E '^[[:space:]]*(export[[:space:]]+)?([A-Za-z0-9_]+_)?(CFLAGS|CXXFLAGS|FCFLAGS|LDFLAGS|LIBS|INCLUDES)="|^[[:space:]]*export[[:space:]]+CP_(DFLAGS|CFLAGS|LDFLAGS|LIBS)="|^[[:space:]]*# (For|Other)' "$source_file" >> "$target_file" + awk ' + function skip(line) { + return line ~ /^[[:space:]]*(export[[:space:]]+)?([A-Za-z0-9_]+_)?(CFLAGS|CXXFLAGS|FCFLAGS|LDFLAGS|LIBS|INCLUDES)="/ || + line ~ /^[[:space:]]*export[[:space:]]+CP_(DFLAGS|CFLAGS|LDFLAGS|LIBS)="/ || + line ~ /^[[:space:]]*# (For|Other)/ + } + function reset_block() { + block_count = 0 + block_has_body = 0 + in_block = 0 + } + /^[[:space:]]*if[[:space:]].*;[[:space:]]*then[[:space:]]*$/ { + reset_block() + in_block = 1 + block[++block_count] = $0 + next + } + in_block { + if ($0 ~ /^[[:space:]]*fi[[:space:]]*$/) { + if (block_has_body) { + for (i = 1; i <= block_count; i++) print block[i] + print $0 + } + reset_block() + next + } + if (!skip($0)) { + block[++block_count] = $0 + block_has_body = 1 + } + next + } + !skip($0) { print } + ' "$source_file" >> "$target_file" } From 9cdd1a1c94a52d8e989d715413791c0e1c42f931 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 00:20:08 +0800 Subject: [PATCH 21/26] Add Toolchain smoke test workflow Adds a PR-triggered GNU smoke workflow that performs a real toolchain_gnu.sh installation, validates install/setup, builds ABACUS through build_abacus_gnu.sh, and uploads the relevant logs. --- .github/workflows/toolchain_smoke.yaml | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/toolchain_smoke.yaml diff --git a/.github/workflows/toolchain_smoke.yaml b/.github/workflows/toolchain_smoke.yaml new file mode 100644 index 00000000000..b57f0702e50 --- /dev/null +++ b/.github/workflows/toolchain_smoke.yaml @@ -0,0 +1,53 @@ +name: Toolchain Smoke Test +on: + pull_request: + paths: + - CMakeLists.txt + - cmake/** + - toolchain/** + - .github/workflows/toolchain_*.yaml + workflow_dispatch: +jobs: + smoke-build-gnu: + runs-on: X64 + container: + image: ghcr.io/deepmodeling/abacus-gnu + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Install requirements + run: | + set -euo pipefail + cd toolchain/root_requirements + sudo ./install_requirements_ubuntu.sh + - name: Build toolchain + run: | + set -euo pipefail + cd toolchain + ./toolchain_gnu.sh + - name: Check setup + run: | + set -euo pipefail + cd toolchain + bash -n install/setup + source install/setup + - name: Build ABACUS + run: | + set -euo pipefail + cd toolchain + ./build_abacus_gnu.sh + cd .. + ./bin/abacus --version || true + - name: Upload logs + if: always() + uses: actions/upload-artifact@v7 + with: + name: toolchain-smoke-gnu + path: | + toolchain/compile.log + toolchain/compile.err + toolchain/install/setup + toolchain/build/**/make.log + toolchain/build/**/configure.log + toolchain/build/**/cmake.log + if-no-files-found: ignore From 0c65c13ef0abe21797aab7a063b4bf1237d7f431 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 00:28:36 +0800 Subject: [PATCH 22/26] Clean LTS build helper examples Removes develop-only MLALGO, NEP, LibTorch, LibNPY, and DeePMD example options from the toolchain build_abacus helper scripts. These examples were introduced by develop-side changes around PR #7321 but are not supported by the LTS build surface. --- toolchain/build_abacus_aocc-aocl.sh | 9 --------- toolchain/build_abacus_gcc-aocl.sh | 9 --------- toolchain/build_abacus_gcc-mkl.sh | 9 --------- toolchain/build_abacus_gnu.sh | 9 --------- toolchain/build_abacus_intel.sh | 9 --------- 5 files changed, 45 deletions(-) diff --git a/toolchain/build_abacus_aocc-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh index b2249137655..6af923e7633 100755 --- a/toolchain/build_abacus_aocc-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -32,10 +32,6 @@ FFTW3=$AOCLhome LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR=$INSTALL_DIR/NEP_CPU-main -# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch -# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # if clang++ have problem, switch back to g++ @@ -59,11 +55,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DNEP_DIR=$NEP_DIR \ -# -DENABLE_MLALGO=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib diff --git a/toolchain/build_abacus_gcc-aocl.sh b/toolchain/build_abacus_gcc-aocl.sh index 949f7d43ef6..fdfb062a927 100755 --- a/toolchain/build_abacus_gcc-aocl.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -32,10 +32,6 @@ FFTW3=$AOCLhome LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR=$INSTALL_DIR/NEP_CPU-main -# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch -# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# DEEPMD=$HOME/apps/anaconda3/envs/deepmd cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ @@ -57,11 +53,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DNEP_DIR=$NEP_DIR \ -# -DENABLE_MLALGO=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib diff --git a/toolchain/build_abacus_gcc-mkl.sh b/toolchain/build_abacus_gcc-mkl.sh index e35f2be558f..0b9880f66c0 100755 --- a/toolchain/build_abacus_gcc-mkl.sh +++ b/toolchain/build_abacus_gcc-mkl.sh @@ -29,10 +29,6 @@ RAPIDJSON=${RAPIDJSON_ROOT} LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR=$INSTALL_DIR/NEP_CPU-main -# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch -# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# DEEPMD=$HOME/apps/anaconda3/envs/deepmd cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ @@ -53,11 +49,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DNEP_DIR=$NEP_DIR \ -# -DENABLE_MLALGO=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ cmake --build $BUILD_DIR -j `nproc` diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 749cd967a46..2392a05b946 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -30,10 +30,6 @@ RAPIDJSON=${RAPIDJSON_ROOT} LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR=$INSTALL_DIR/NEP_CPU-main -# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch -# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ @@ -55,11 +51,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DNEP_DIR=$NEP_DIR \ -# -DENABLE_MLALGO=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 34bc5a4db2e..d71b378c5d5 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -29,10 +29,6 @@ RAPIDJSON=${RAPIDJSON_ROOT} LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus -# NEP_DIR=$INSTALL_DIR/NEP_CPU-main -# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch -# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem # Notice: if you are compiling with AMD-CPU or GPU-version ABACUS, then `icpc` and `mpiicpc` compilers are needed cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ @@ -54,11 +50,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ -# -DNEP_DIR=$NEP_DIR \ -# -DENABLE_MLALGO=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib From 3940d3ff310125b125627a891a00728dbc34a12e Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 00:32:15 +0800 Subject: [PATCH 23/26] Restore LTS DeepKS build examples Restores the LTS build_abacus helper examples after the previous cleanup removed too much. The helpers now keep the LTS DeepKS/LibTorch/LibNPY/DeePMD commented examples while excluding the develop-side NEP and ENABLE_MLALGO examples from PR #7321. --- toolchain/build_abacus_aocc-aocl.sh | 7 +++++++ toolchain/build_abacus_gcc-aocl.sh | 7 +++++++ toolchain/build_abacus_gcc-mkl.sh | 7 +++++++ toolchain/build_abacus_gnu.sh | 7 +++++++ toolchain/build_abacus_intel.sh | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/toolchain/build_abacus_aocc-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh index 6af923e7633..a48d01628c1 100755 --- a/toolchain/build_abacus_aocc-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -32,6 +32,9 @@ FFTW3=$AOCLhome LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch +# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include +# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # if clang++ have problem, switch back to g++ @@ -55,6 +58,10 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib diff --git a/toolchain/build_abacus_gcc-aocl.sh b/toolchain/build_abacus_gcc-aocl.sh index fdfb062a927..6be7f1807d9 100755 --- a/toolchain/build_abacus_gcc-aocl.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -32,6 +32,9 @@ FFTW3=$AOCLhome LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch +# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include +# DEEPMD=$HOME/apps/anaconda3/envs/deepmd cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ @@ -53,6 +56,10 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib diff --git a/toolchain/build_abacus_gcc-mkl.sh b/toolchain/build_abacus_gcc-mkl.sh index 0b9880f66c0..8f06a9e874d 100755 --- a/toolchain/build_abacus_gcc-mkl.sh +++ b/toolchain/build_abacus_gcc-mkl.sh @@ -29,6 +29,9 @@ RAPIDJSON=${RAPIDJSON_ROOT} LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch +# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include +# DEEPMD=$HOME/apps/anaconda3/envs/deepmd cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ @@ -49,6 +52,10 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ cmake --build $BUILD_DIR -j `nproc` diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 2392a05b946..a6b6384c76c 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -30,6 +30,9 @@ RAPIDJSON=${RAPIDJSON_ROOT} LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch +# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include +# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ @@ -51,6 +54,10 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index d71b378c5d5..739b919d652 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -29,6 +29,9 @@ RAPIDJSON=${RAPIDJSON_ROOT} LIBRI=${LIBRI_ROOT} LIBCOMM=${LIBCOMM_ROOT} USE_CUDA=OFF # set ON to enable gpu-abacus +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch +# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include +# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem # Notice: if you are compiling with AMD-CPU or GPU-version ABACUS, then `icpc` and `mpiicpc` compilers are needed cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ @@ -50,6 +53,10 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DLIBCOMM_DIR=$LIBCOMM \ -DUSE_CUDA=$USE_CUDA \ # -DCMAKE_CUDA_COMPILER=/path/to/cuda/bin/nvcc \ +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DDeePMD_DIR=$DEEPMD \ # -DENABLE_CUSOLVERMP=ON \ # -D CAL_CUSOLVERMP_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/2x.xx/math_libs/1x.x/targets/x86_64-linux/lib From af688febe0e3bbcae45207af3c644634675fe777 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 00:34:25 +0800 Subject: [PATCH 24/26] Restore LTS README markers Restores LTS-specific README wording after the toolchain documentation backport: keep the README marked as for LTS and document NEP as not supported while preserving the 202601 version updates and GCC-MKL support documentation. --- toolchain/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index d7d072b916b..6f775d933d4 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -1,4 +1,4 @@ -# ABACUS Toolchain +# ABACUS Toolchain (for LTS) [![Version](https://img.shields.io/badge/version-2026.1-blue.svg)](https://github.com/deepmodeling/abacus-develop/tree/develop/toolchain) [![License](https://img.shields.io/badge/license-GPL--compatible-green.svg)](#license) @@ -125,7 +125,7 @@ Before running the toolchain, please make sure you have loaded the related envir - [LibNPY](https://github.com/llohse/libnpy) - NumPy I/O for C++ - [LibRI](https://github.com/abacusmodeling/LibRI) - Resolution of Identity library - [LibComm](https://github.com/abacusmodeling/LibComm) - Communication library - - [NEP](https://github.com/brucefan1983/NEP_CPU) - Neuroevolution Potential + - [NEP](https://github.com/brucefan1983/NEP_CPU) - Neuroevolution Potential (Not Supported) - [Cereal](https://github.com/USCiLab/cereal) - C++ serialization library - [RapidJSON](https://github.com/Tencent/rapidjson) - Fast JSON parser/generator - **Reference mirror:** [CP2K static downloads](https://www.cp2k.org/static/downloads) @@ -205,7 +205,7 @@ Mix online and offline packages as needed - the toolchain automatically detects | LibComm | pinned commit | EXX calculations | GPL-3.0 | Install | | LibTorch | 2.1.2 / 1.12.1 | MLALGO support | BSD-3-Clause | Optional | | LibNPY | 1.0.1 / 1.0.1 | NumPy I/O | MIT | Optional | -| NEP | main | Neuroevolution potential | MIT | Optional | +| NEP | main | Neuroevolution potential | MIT | Not Supported | Also, [Intel-oneAPI](https://www.intel.cn/content/www/cn/zh/developer/tools/oneapi/toolkits.html) and AMD [AOCC](https://www.amd.com/zh-cn/developer/aocc.html) and [AOCL](https://www.amd.com/zh-cn/developer/aocl.html) are supported in toolchain by setting them to system option, but one should install them manually by server administrator. From bcc682405aa1e58e1fe7b366321e63900203f7eb Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 00:42:37 +0800 Subject: [PATCH 25/26] Fix Toolchain smoke shell and ELPA setup Sets the Toolchain Smoke Test job shell to bash so pipefail is supported in the container. Also aligns ELPA setup generation with PR #7319 by avoiding if blocks in the generated setup file and appending NVIDIA paths only during setup generation when the nvidia install exists. --- .github/workflows/toolchain_smoke.yaml | 3 ++ toolchain/scripts/stage3/install_elpa.sh | 50 ++++++++---------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/.github/workflows/toolchain_smoke.yaml b/.github/workflows/toolchain_smoke.yaml index b57f0702e50..d46538f50f4 100644 --- a/.github/workflows/toolchain_smoke.yaml +++ b/.github/workflows/toolchain_smoke.yaml @@ -12,6 +12,9 @@ jobs: runs-on: X64 container: image: ghcr.io/deepmodeling/abacus-gnu + defaults: + run: + shell: bash steps: - name: Checkout uses: actions/checkout@v6 diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index b31e004e64e..07f30b9739e 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -242,42 +242,26 @@ case "$with_elpa" in esac if [ "$with_elpa" != "__DONTUSE__" ]; then ELPA_LIBS="-lelpa${elpa_dir_openmp}" - if [ "$with_elpa" = "__INSTALL__" ]; then - cat << EOF > "${BUILDDIR}/setup_elpa" -if [ -d "${pkg_install_dir}/cpu" ]; then - prepend_path PATH "${pkg_install_dir}/cpu/bin" - prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/cpu/lib" - prepend_path CPATH "${pkg_install_dir}/cpu/include/elpa${elpa_dir_openmp}-${elpa_ver}" - prepend_path CPATH "${pkg_install_dir}/cpu/include" - prepend_path LD_RUN_PATH "${pkg_install_dir}/cpu/lib" - prepend_path LIBRARY_PATH "${pkg_install_dir}/cpu/lib" - prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/cpu/lib/pkgconfig" - prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/cpu" -fi -if [ -d "${pkg_install_dir}/nvidia" ]; then - prepend_path PATH "${pkg_install_dir}/nvidia/bin" - prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/nvidia/lib" - prepend_path CPATH "${pkg_install_dir}/nvidia/include/elpa${elpa_dir_openmp}-${elpa_ver}" - prepend_path CPATH "${pkg_install_dir}/nvidia/include" - prepend_path LD_RUN_PATH "${pkg_install_dir}/nvidia/lib" - prepend_path LIBRARY_PATH "${pkg_install_dir}/nvidia/lib" - prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/nvidia/lib/pkgconfig" - prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/nvidia" -fi -EOF - else - cat << EOF > "${BUILDDIR}/setup_elpa" + cat << EOF > "${BUILDDIR}/setup_elpa" prepend_path CPATH "$elpa_include" EOF - if [ "$with_elpa" != "__SYSTEM__" ]; then + if [ "$with_elpa" != "__SYSTEM__" ]; then + cat << EOF >> "${BUILDDIR}/setup_elpa" +prepend_path PATH "${pkg_install_dir}/cpu/bin" +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/cpu/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/cpu/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/cpu/lib" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/cpu/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/cpu" +EOF + if [ -d "${pkg_install_dir}/nvidia" ]; then cat << EOF >> "${BUILDDIR}/setup_elpa" -prepend_path PATH "${pkg_install_dir}/bin" -prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path CPATH "${pkg_install_dir}/include" -prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" -prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" -prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" -prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" +prepend_path PATH "${pkg_install_dir}/nvidia/bin" +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/nvidia/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/nvidia/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/nvidia/lib" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/nvidia/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}/nvidia" EOF fi fi From c2a70f80f43d44b4bc1230e7a968b1ad20051aa4 Mon Sep 17 00:00:00 2001 From: James Misaka Date: Fri, 8 May 2026 10:21:38 +0800 Subject: [PATCH 26/26] update toolchain smoke test --- .github/workflows/toolchain_smoke.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/toolchain_smoke.yaml b/.github/workflows/toolchain_smoke.yaml index d46538f50f4..7bd2c9ca44a 100644 --- a/.github/workflows/toolchain_smoke.yaml +++ b/.github/workflows/toolchain_smoke.yaml @@ -40,7 +40,8 @@ jobs: cd toolchain ./build_abacus_gnu.sh cd .. - ./bin/abacus --version || true + . ./toolchain/abacus_env.sh + ./bin/abacus --version - name: Upload logs if: always() uses: actions/upload-artifact@v7