From 825fe7b064246f6dc97935888a03ad2c0d9a085f Mon Sep 17 00:00:00 2001 From: QuantumMisaka Date: Tue, 21 Oct 2025 21:32:38 +0800 Subject: [PATCH 1/4] fix(toolchain): fix elpa-gpu installation in legacy way --- toolchain/scripts/lib/config_manager.sh | 9 +++++++++ toolchain/scripts/stage3/install_elpa.sh | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/toolchain/scripts/lib/config_manager.sh b/toolchain/scripts/lib/config_manager.sh index 3ba967c5e4..6d67bf0261 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/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index c5ffc77063..50cd499452 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} \ From 5a14647a7e70cc0e36f4b080521544e71328c5dc Mon Sep 17 00:00:00 2001 From: QuantumMisaka Date: Tue, 21 Oct 2025 21:33:19 +0800 Subject: [PATCH 2/4] chore(toolchain) add -e for gnu/intel build --- toolchain/build_abacus_gnu.sh | 2 +- toolchain/build_abacus_intel.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index b373ca1a10..37f5603f6e 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 29575bf4e5..c347b623a1 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 From 5fb61be6c4ba4b090d3c36795deb58e9cdfd943c Mon Sep 17 00:00:00 2001 From: QuantumMisaka Date: Tue, 21 Oct 2025 21:59:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(openblas):=20=E4=BF=AE=E6=AD=A3openblas?= =?UTF-8?q?=E5=8C=85=E5=90=8D=E5=A4=A7=E5=B0=8F=E5=86=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- toolchain/scripts/stage2/install_openblas.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index f2a24b1be4..03da6205bc 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 From 89bd0faa4e7da89bea91581b100c65aa5315b474 Mon Sep 17 00:00:00 2001 From: QuantumMisaka Date: Tue, 21 Oct 2025 22:11:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(toolchain):=20=E4=BF=AE=E5=A4=8Dwget?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=97=B6=E9=94=99=E8=AF=AF=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E8=A2=AB=E9=87=8D=E5=AE=9A=E5=90=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- toolchain/scripts/tool_kit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 14eab2a7e2..8c288ec272 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..."