From 8a67263beaacd1d25403a4ee3073a33bf6f6ba71 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Thu, 1 May 2025 10:14:28 +0800 Subject: [PATCH 01/29] Update: - all downloading from github change to codeload method (main contributor: Kai Luo) - add contributor informations - modify download_url function in tool_kit.sh to support --no-check-certificate option and --no-checksum mode --- toolchain/scripts/stage3/install_elpa.sh | 1 + toolchain/scripts/stage4/install_cereal.sh | 15 +++++++++------ toolchain/scripts/stage4/install_libcomm.sh | 16 ++++++++++------ toolchain/scripts/stage4/install_libnpy.sh | 15 +++++++++------ toolchain/scripts/stage4/install_libri.sh | 16 +++++++++------- toolchain/scripts/stage4/install_rapidjson.sh | 19 +++++++++---------- toolchain/scripts/tool_kit.sh | 15 ++++++++------- 7 files changed, 55 insertions(+), 42 deletions(-) diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 780e5c6776..eae9e24d94 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -4,6 +4,7 @@ # shellcheck disable=all # Last Update in 2025-0308 +# other contributor: Benrui Tang [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 81ab61eccf..69ed265014 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -10,8 +10,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -cereal_ver="1.3.2" -cereal_sha256="16a7ad9b31ba5880dac55d62b5d6f243c3ebc8d46a3514149e56b5e7ea81f85f" +cereal_ver="master" # latest version, instead of "1.3.2" +cereal_sha256="--no-checksum" # latest version cannot maintain checksum source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -31,8 +31,10 @@ case "$with_cereal" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/cereal/${cereal_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/USCiLab/cereal/archive/refs/tags/v${cereal_ver}.tar.gz" - filename="cereal-${cereal_ver}.tar.gz" + # url="https://github.com/USCiLab/cereal/archive/refs/tags/v${cereal_ver}.tar.gz" + # filename="cereal-${cereal_ver}.tar.gz" + url="https://codeload.github.com/USCiLab/cereal/zip/refs/heads/${cereal_ver}" + filename="cereal-${cereal_ver}.zip" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -40,7 +42,7 @@ 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 Release, which will always be out-of-date version <===" + 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 @@ -48,7 +50,8 @@ case "$with_cereal" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - tar -xzf $filename + #tar -xzf $filename + unzip -q $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 1f3aa5d814..ba09ce78c5 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -7,12 +7,13 @@ # LibComm is under highly-active development, the git submodule installation is more recommended # Last Update in 2024-0815 +# other contributor: Peize Lin [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -libcomm_ver="0.1.1" -libcomm_sha256="9c47b6ea9573bffa4232c0bef63714d4c3af820c6b7539cfa6e294ca2b8ba4af" +libcomm_ver="master" +libcomm_sha256="--no-checksum" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -32,8 +33,10 @@ case "$with_libcomm" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libcomm/${libcomm_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/abacusmodeling/LibComm/archive/refs/tags/v${libcomm_ver}.tar.gz" - filename="LibComm-${libcomm_ver}.tar.gz" + # url="https://github.com/abacusmodeling/LibComm/archive/refs/tags/v${libcomm_ver}.tar.gz" + # filename="LibComm-${libcomm_ver}.tar.gz" + url="https://codeload.github.com/abacusmodeling/LibComm/zip/refs/heads/${libcomm_ver}" + filename="LibComm-${libcomm_ver}.zip" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -41,7 +44,7 @@ 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 Release, which will always be out-of-date version <===" + 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 @@ -49,7 +52,8 @@ case "$with_libcomm" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - tar -xzf $filename + #tar -xzf $filename + unzip -q $filename cp -r $dirname "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index f787a8bbc0..997a236f31 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -11,8 +11,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -libnpy_ver="1.0.1" -libnpy_sha256="43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0fba44" +libnpy_ver="master" +libnpy_sha256="--no-checksum" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -32,8 +32,10 @@ case "$with_libnpy" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libnpy/${libnpy_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/llohse/libnpy/archive/refs/tags/v${libnpy_ver}.tar.gz" - filename="libnpy-${libnpy_ver}.tar.gz" + #url="https://github.com/llohse/libnpy/archive/refs/tags/v${libnpy_ver}.tar.gz" + #filename="libnpy-${libnpy_ver}.tar.gz" + url="https://codeload.github.com/llohse/libnpy/zip/refs/heads/${libnpy_ver}" + filename="libnpy-${libnpy_ver}.zip" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -41,7 +43,7 @@ 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, which will always be out-of-date version <===" + echo "===> Notice: This version of Libnpy is downloaded in GitHub master repository <===" download_pkg_from_url "${libnpy_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then @@ -49,7 +51,8 @@ case "$with_libnpy" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - tar -xzf $filename + #tar -xzf $filename + unzip -q $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 2e3e657431..6a491c1fa1 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -7,12 +7,13 @@ # LibRI is under highly-active development, the git submodule installation is more recommended # Last Update in 2024-0815 +# other contributor: Peize Lin [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -# libri 0.2.0 need to be used in newer ABACUS -libri_ver="0.2.1.0" -libri_sha256="66a5540daba36effdad6ce2fe5e8368b96ddd4a7e148af90894ef21dc20ff29f" +# libri 0.2.0 and above need to be used in newer ABACUS +libri_ver="master" +libri_sha256="--no-checksum" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -32,8 +33,9 @@ case "$with_libri" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libri/${libri_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://github.com/abacusmodeling/LibRI/archive/refs/tags/v${libri_ver}.tar.gz" - filename="LibRI-${libri_ver}.tar.gz" + #url="https://github.com/abacusmodeling/LibRI/archive/refs/tags/v${libri_ver}.tar.gz" + url="https://codeload.github.com/abacusmodeling/LibRI/zip/refs/heads/${libri_ver}" + filename="LibRI-${libri_ver}.zip" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -41,7 +43,7 @@ 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, which will always be out-of-date version <===" + echo "===> Notice: This version of rapidjson is downloaded in GitHub master repository <===" download_pkg_from_url "${libri_sha256}" "${filename}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then @@ -49,7 +51,7 @@ case "$with_libri" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - tar -xzf $filename + unzip -q $filename cp -r $dirname "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 805ff74d2e..47f33a23f1 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -5,14 +5,14 @@ # RAPIDJSON is not need any complex setting # Only problem is the installation from github.com -# Last Update in 2024-0119 -# Last Update in 2025-04-28 by Kai Luo +# Last Update in 2025-05-01 +# other contributor: Kai Luo, XingLiang Peng [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" rapidjson_ver="master" # latest version, instead of "1.1.0" fixing issue of #5518 -rapidjson_sha256="bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e" +rapidjson_sha256="--no-checksum" # latest version cannot maintain checksum source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -33,8 +33,8 @@ case "$with_rapidjson" in #pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}" install_lock_file="$pkg_install_dir/install_successful" #url="https://github.com/Tencent/rapidjson/archive/refs/tags/v${rapidjson_ver}.tar.gz" # commented by Kai Luo in 2025/04/28 - url="https://codeload.github.com/Tencent/rapidjson/zip/refs/heads/master" - # filename="rapidjson-${rapidjson_ver}.tar.gz" + url="https://codeload.github.com/Tencent/rapidjson/zip/refs/heads/${rapidjson_ver}" + # changed by Kai Luo in 2025/04/28, modified by Zhaoqing Liu in 2025/05/01 filename="rapidjson-${rapidjson_ver}.zip" # changed by Kai Luo in 2025/04/28 if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -43,17 +43,16 @@ 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 Release, which will always be out-of-date version <===" - # download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}" - wget "${url}" -O "${filename}" --no-check-certificate # use wget directly instead of download_pkg_from_url + echo "===> Notice: This version of rapidjson is downloaded in GitHub master repository <===" + download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}" + # wget "${url}" -O "${filename}" --no-check-certificate # use wget directly instead of download_pkg_from_url fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - # tar -xzf $filename - unzip -q $filename # downloaded file is a zip file, so use unzip instead of tar, use -q to suppress output + unzip -q $filename # use -q to suppress output mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" # for CMake to find rapidjson diff --git a/toolchain/scripts/tool_kit.sh b/toolchain/scripts/tool_kit.sh index 909fe836a2..c7fa483ffa 100755 --- a/toolchain/scripts/tool_kit.sh +++ b/toolchain/scripts/tool_kit.sh @@ -57,9 +57,8 @@ And re-run toolchain installation script. 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 (for CEREAL, RapidJSON, libnpy, LibRI and others stage4 packages) -3. Use git submodule update --init --recursive (for LibRI) -4. wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps.zip -5. for Intel-oneAPI, please contact your server manager our visit Intel official website +3. wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps.zip (a mirror in Bohrium) +4. for Intel-oneAPI and AMD AOCC/AOCL, please contact your server manager our visit Intel official website EOF } @@ -665,14 +664,14 @@ download_pkg_from_ABACUS_org() { download_pkg_from_url() { # usage: download_pkg_from_url sha256 filename url - local __sha256="$1" + local __sha256="$1" # if set to "--no-checksum", do not check checksum local __filename="$2" local __url="$3" # download #echo "wget ${DOWNLOADER_FLAGS} --quiet $__url -O $__filename" #if ! wget ${DOWNLOADER_FLAGS} --quiet $__url -O $__filename; then - echo "wget ${DOWNLOADER_FLAGS} $__url -O $__filename" - if ! wget ${DOWNLOADER_FLAGS} $__url -O $__filename; then + echo "wget ${DOWNLOADER_FLAGS} $__url -O $__filename --no-check-certificate" + if ! wget ${DOWNLOADER_FLAGS} $__url -O $__filename --no-check-certificate; then report_error "failed to download $__url" recommend_offline_installation $__filename $__url if [ "${PACK_RUN}" != "__TRUE__" ]; then @@ -680,7 +679,9 @@ download_pkg_from_url() { fi fi # checksum - checksum "$__filename" "$__sha256" + if [ "$__sha256" != "--no-checksum" ]; then + checksum "$__filename" "$__sha256" + fi } # verify the checksums inside the given checksum file From 483ef26c3437b10ef83e643472122b849530a0a6 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Fri, 2 May 2025 10:19:04 +0800 Subject: [PATCH 02/29] update rapidjson cmake finding --- toolchain/scripts/stage4/install_rapidjson.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 47f33a23f1..5fa1f8bfdf 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -56,7 +56,12 @@ case "$with_rapidjson" in mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" # for CMake to find rapidjson - cp ${pkg_install_dir}/RapidJSONConfig.cmake.in ${pkg_install_dir}/RapidJSONConfig.cmake + #cp ${pkg_install_dir}/RapidJSONConfig.cmake.in ${pkg_install_dir}/RapidJSONConfig.cmake + cat << EOF > "${pkg_install_dir}/RapidJSONConfig.cmake" +get_filename_component(RAPIDJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(RAPIDJSON_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@") +message(STATUS "RapidJSON found. Headers: ${RAPIDJSON_INCLUDE_DIRS}") +EOF write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi fi From 43ffb9369e153f8ad6e3e641d5773c95f0c77669 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Fri, 2 May 2025 11:51:24 +0800 Subject: [PATCH 03/29] update openblas version & url --- toolchain/scripts/get_openblas_arch.sh | 9 ++++++--- toolchain/scripts/stage2/install_openblas.sh | 15 +++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/toolchain/scripts/get_openblas_arch.sh b/toolchain/scripts/get_openblas_arch.sh index 4104ff821c..f0fb8b1aa8 100755 --- a/toolchain/scripts/get_openblas_arch.sh +++ b/toolchain/scripts/get_openblas_arch.sh @@ -8,8 +8,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)" -openblas_ver="0.3.28" # Keep in sync with install_openblas.sh -openblas_sha256="f1003466ad074e9b0c8d421a204121100b0751c96fc6fcf3d1456bd12f8a00a1" +openblas_ver="0.3.29" # Keep in sync with install_openblas.sh +openblas_sha256="38240eee1b29e2bde47ebb5d61160207dc68668a54cac62c076bb5032013b1eb" openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh @@ -40,7 +40,10 @@ if ! [ "$openblas_dir" ]; then if [ -f ${openblas_pkg} ]; then echo "${openblas_pkg} is found" else - download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + #download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + # 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 tar -xzf ${openblas_pkg} openblas_dir="$(find_openblas_dir)" diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 2833501a48..fb4e0c563e 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -8,8 +8,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -openblas_ver="0.3.28" # Keep in sync with get_openblas_arch.sh -openblas_sha256="f1003466ad074e9b0c8d421a204121100b0751c96fc6fcf3d1456bd12f8a00a1" +openblas_ver="0.3.29" # Keep in sync with get_openblas_arch.sh +openblas_sha256="38240eee1b29e2bde47ebb5d61160207dc68668a54cac62c076bb5032013b1eb" openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh @@ -39,7 +39,10 @@ case "${with_openblas}" in if [ -f ${openblas_pkg} ]; then echo "${openblas_pkg} is found" else - download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + #download_pkg_from_ABACUS_org "${openblas_sha256}" "${openblas_pkg}" + # 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 if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" @@ -80,7 +83,7 @@ case "${with_openblas}" in make -j $(get_nprocs) \ MAKE_NB_JOBS=0 \ TARGET=${TARGET} \ - NUM_THREADS=128 \ + NUM_THREADS=64 \ USE_THREAD=1 \ USE_OPENMP=1 \ NO_AFFINITY=1 \ @@ -92,7 +95,7 @@ case "${with_openblas}" in make -j $(get_nprocs) \ MAKE_NB_JOBS=0 \ TARGET=NEHALEM \ - NUM_THREADS=128 \ + NUM_THREADS=64 \ USE_THREAD=1 \ USE_OPENMP=1 \ NO_AFFINITY=1 \ @@ -104,7 +107,7 @@ case "${with_openblas}" in make -j $(get_nprocs) \ MAKE_NB_JOBS=0 \ TARGET=${TARGET} \ - NUM_THREADS=128 \ + NUM_THREADS=64 \ USE_THREAD=1 \ USE_OPENMP=1 \ NO_AFFINITY=1 \ From b6b8a8f4451b0e4e6efb07a2c59f01df341e2c68 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Fri, 2 May 2025 22:14:57 +0800 Subject: [PATCH 04/29] updata codeload url/version and elpa flag --- toolchain/scripts/stage3/install_elpa.sh | 4 ++-- toolchain/scripts/stage3/install_scalapack.sh | 10 +++++++--- toolchain/scripts/stage4/install_cereal.sh | 10 ++++------ toolchain/scripts/stage4/install_libcomm.sh | 9 ++++----- toolchain/scripts/stage4/install_libnpy.sh | 7 +++---- toolchain/scripts/stage4/install_libri.sh | 16 +++++++++------- toolchain/scripts/stage4/install_rapidjson.sh | 7 ++++--- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index eae9e24d94..d826668c4a 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -115,7 +115,7 @@ case "$with_elpa" in ../configure --prefix="${pkg_install_dir}/${TARGET}/" \ --libdir="${pkg_install_dir}/${TARGET}/lib" \ --enable-openmp=${enable_openmp} \ - --enable-static=yes \ + --enable-static=no \ --enable-shared=yes \ --disable-c-tests \ --disable-cpp-tests \ @@ -143,7 +143,7 @@ case "$with_elpa" in ../configure --prefix="${pkg_install_dir}/${TARGET}/" \ --libdir="${pkg_install_dir}/${TARGET}/lib" \ --enable-openmp=${enable_openmp} \ - --enable-static=yes \ + --enable-static=no \ --enable-shared=yes \ --disable-c-tests \ --disable-cpp-tests \ diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index eb45dbd8e1..b5f150e8f7 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -8,8 +8,10 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -scalapack_ver="2.2.1" -scalapack_sha256="4aede775fdb28fa44b331875730bcd5bab130caaec225fadeccf424c8fcb55aa" +scalapack_ver="2.2.2" +scalapack_sha256="a2f0c9180a210bf7ffe126c9cb81099cf337da1a7120ddb4cbe4894eb7b7d022" +#scalapack_ver="2.2.1" +#scalapack_sha256="4aede775fdb28fa44b331875730bcd5bab130caaec225fadeccf424c8fcb55aa" scalapack_pkg="scalapack-${scalapack_ver}.tgz" source "${SCRIPT_DIR}"/common_vars.sh @@ -39,7 +41,9 @@ case "$with_scalapack" in if [ -f ${scalapack_pkg} ]; then echo "${scalapack_pkg} is found" else - download_pkg_from_ABACUS_org "${scalapack_sha256}" "${scalapack_pkg}" + 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 if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 69ed265014..ecca75645e 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -31,10 +31,8 @@ case "$with_cereal" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/cereal/${cereal_ver}" install_lock_file="$pkg_install_dir/install_successful" - # url="https://github.com/USCiLab/cereal/archive/refs/tags/v${cereal_ver}.tar.gz" - # filename="cereal-${cereal_ver}.tar.gz" - url="https://codeload.github.com/USCiLab/cereal/zip/refs/heads/${cereal_ver}" - filename="cereal-${cereal_ver}.zip" + url="https://codeload.github.com/USCiLab/cereal/tar.gz/${cereal_ver}.tar.gz" + filename="cereal-${cereal_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -50,8 +48,8 @@ case "$with_cereal" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - #tar -xzf $filename - unzip -q $filename + tar -xzf $filename + #unzip -q $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index ba09ce78c5..bdfb135b8e 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -34,9 +34,8 @@ case "$with_libcomm" in #pkg_install_dir="${HOME}/lib/libcomm/${libcomm_ver}" install_lock_file="$pkg_install_dir/install_successful" # url="https://github.com/abacusmodeling/LibComm/archive/refs/tags/v${libcomm_ver}.tar.gz" - # filename="LibComm-${libcomm_ver}.tar.gz" - url="https://codeload.github.com/abacusmodeling/LibComm/zip/refs/heads/${libcomm_ver}" - filename="LibComm-${libcomm_ver}.zip" + filename="LibComm-${libcomm_ver}.tar.gz" + url="https://codeload.github.com/abacusmodeling/LibComm/tar.gz/${libcomm_ver}" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -52,8 +51,8 @@ case "$with_libcomm" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - #tar -xzf $filename - unzip -q $filename + tar -xzf $filename + # unzip -q $filename cp -r $dirname "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index 997a236f31..d0b21467b1 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -34,8 +34,8 @@ case "$with_libnpy" in install_lock_file="$pkg_install_dir/install_successful" #url="https://github.com/llohse/libnpy/archive/refs/tags/v${libnpy_ver}.tar.gz" #filename="libnpy-${libnpy_ver}.tar.gz" - url="https://codeload.github.com/llohse/libnpy/zip/refs/heads/${libnpy_ver}" - filename="libnpy-${libnpy_ver}.zip" + url="https://codeload.github.com/llohse/libnpy/tar.gz/${libnpy_ver}" + filename="libnpy-${libnpy_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -51,8 +51,7 @@ case "$with_libnpy" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - #tar -xzf $filename - unzip -q $filename + tar -xzf $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 6a491c1fa1..2d4bd12679 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -12,8 +12,10 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" # libri 0.2.0 and above need to be used in newer ABACUS -libri_ver="master" -libri_sha256="--no-checksum" +# libri_ver="master" +# libri_sha256="--no-checksum" +libri_ver=0.2.1.0 +libri_sha256="66a5540daba36effdad6ce2fe5e8368b96ddd4a7e148af90894ef21dc20ff29f" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -33,9 +35,8 @@ case "$with_libri" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libri/${libri_ver}" install_lock_file="$pkg_install_dir/install_successful" - #url="https://github.com/abacusmodeling/LibRI/archive/refs/tags/v${libri_ver}.tar.gz" - url="https://codeload.github.com/abacusmodeling/LibRI/zip/refs/heads/${libri_ver}" - filename="LibRI-${libri_ver}.zip" + url="https://codeload.github.com/abacusmodeling/LibRI/tar.gz/v${libri_ver}" + filename="LibRI-${libri_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -43,7 +44,7 @@ case "$with_libri" in echo "$filename is found" else # download from github.com and checksum - echo "===> Notice: This version of rapidjson is downloaded in GitHub master repository <===" + 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 @@ -51,7 +52,8 @@ case "$with_libri" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - unzip -q $filename + #unzip -q $filename + tar -xzf $filename cp -r $dirname "${pkg_install_dir}/" write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 5fa1f8bfdf..e3da05e989 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -33,9 +33,9 @@ case "$with_rapidjson" in #pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}" install_lock_file="$pkg_install_dir/install_successful" #url="https://github.com/Tencent/rapidjson/archive/refs/tags/v${rapidjson_ver}.tar.gz" # commented by Kai Luo in 2025/04/28 - url="https://codeload.github.com/Tencent/rapidjson/zip/refs/heads/${rapidjson_ver}" + url="https://codeload.github.com/Tencent/rapidjson/tar.gz/${rapidjson_ver}" # changed by Kai Luo in 2025/04/28, modified by Zhaoqing Liu in 2025/05/01 - filename="rapidjson-${rapidjson_ver}.zip" # changed by Kai Luo in 2025/04/28 + filename="rapidjson-${rapidjson_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." else @@ -52,7 +52,8 @@ case "$with_rapidjson" in else echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname - unzip -q $filename # use -q to suppress output + #unzip -q $filename # use -q to suppress output + tar -xzf $filename mkdir -p "${pkg_install_dir}" cp -r $dirname/* "${pkg_install_dir}/" # for CMake to find rapidjson From 46b3325fe8b72309c2295a2a9318430d7a39aba5 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 21:23:57 +0800 Subject: [PATCH 05/29] update cmake via cp2k-toolchain --- toolchain/scripts/stage0/install_cmake.sh | 28 +++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index 894a1e58f2..0ef5158c97 100755 --- a/toolchain/scripts/stage0/install_cmake.sh +++ b/toolchain/scripts/stage0/install_cmake.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2025-0308 +# Last Update in 2025-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" @@ -21,13 +21,23 @@ cd "${BUILDDIR}" case "${with_cmake}" in __INSTALL__) echo "==================== Installing CMake ====================" - cmake_ver="3.31.2" + cmake_ver="3.31.7" + cmake_ext="sh" if [ "${OPENBLAS_ARCH}" = "arm64" ]; then - cmake_arch="linux-aarch64" - cmake_sha256="85cc81f782cd8b5ac346e570ad5cfba3bdbe5aa01f27f7ce6266c4cef93342550" + if [ "$(uname -s)" = "Darwin" ]; then + cmake_arch="macos-universal" + cmake_sha256="1cb11aa2edae8551bb0f22807c6f5246bd0eb60ae9fa1474781eb4095d299aca" + cmake_ext="tar.gz" + elif [ "$(uname -s)" = "Linux" ]; then + cmake_arch="linux-aarch64" + cmake_sha256="ce8e32b2c1c497dd7f619124c043ac5c28a88677e390c58748dd62fe460c62a2" + else + report_error ${LINENO} \ + "cmake installation for ARCH=${OPENBLAS_ARCH} under $(uname -s) is not supported. You can try to use the system installation using the flag --with-cmake=system instead." + fi elif [ "${OPENBLAS_ARCH}" = "x86_64" ]; then cmake_arch="linux-x86_64" - cmake_sha256="b81cf3f4892683133f330cd7c016c28049b5725617db24ca8763360883545d34" + cmake_sha256="b7a5c909cdafc36042c8c9bd5765e92ff1f2528cf01720aa6dc4df294ec7e1a0" else report_error ${LINENO} \ "cmake installation for ARCH=${ARCH} is not supported. You can try to use the system installation using the flag --with-cmake=system instead." @@ -36,7 +46,7 @@ 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}.sh" + 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." else @@ -52,7 +62,11 @@ case "${with_cmake}" in else echo "Installing from scratch into ${pkg_install_dir}" mkdir -p ${pkg_install_dir} - /bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log + 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 + else + /bin/sh $cmake_pkg --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log + fi write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})" fi fi From 6757df53f2800d2fd07d6f3f2e7a08ec324ac629 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 21:50:42 +0800 Subject: [PATCH 06/29] update openmpi --- toolchain/scripts/stage1/install_openmpi.sh | 10 +++++++--- toolchain/scripts/stage1/opemmpi_RHEL8.patch | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 toolchain/scripts/stage1/opemmpi_RHEL8.patch diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index e9ececd7a7..6bbfd584ec 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2025-0308 +# Last Update in 2025-0504 # Change default version to openmpi 5 # allow user to choose openmpi 4 in used scripts @@ -14,8 +14,8 @@ if [ "${OPENMPI_4TH}" = "yes" ]; then openmpi_ver="4.1.6" openmpi_sha256="f740994485516deb63b5311af122c265179f5328a0d857a567b85db00b11e415" else - openmpi_ver="5.0.6" - openmpi_sha256="bd4183fcbc43477c254799b429df1a6e576c042e74a2d2f8b37d537b2ff98157" + openmpi_ver="5.0.7" + openmpi_sha256="119f2009936a403334d0df3c0d74d5595a32d99497f9b1d41e90019fee2fc2dd" fi openmpi_pkg="openmpi-${openmpi_ver}.tar.bz2" @@ -69,6 +69,10 @@ case "${with_openmpi}" in CFLAGS="${CFLAGS} -fgnu89-inline" fi fi + + # Apply patch for RHEL8 from https://github.com/open-mpi/ompi/issues/13103 + patch -p1 oshmem/mca/sshmem/base/sshmem_base_open.c < ${SCRIPT_DIR}/stage1/openmpi_RHEL8.patch + # OpenMPI 5.0 only supports PMIx # PMI support is required for Slurm, but not for other schedulers # default not use diff --git a/toolchain/scripts/stage1/opemmpi_RHEL8.patch b/toolchain/scripts/stage1/opemmpi_RHEL8.patch new file mode 100644 index 0000000000..94ce4a18d3 --- /dev/null +++ b/toolchain/scripts/stage1/opemmpi_RHEL8.patch @@ -0,0 +1,20 @@ +--- a/oshmem/mca/sshmem/base/sshmem_base_open.c ++++ b/oshmem/mca/sshmem/base/sshmem_base_open.c +@@ -31,7 +31,7 @@ + * globals + */ + +-void *mca_sshmem_base_start_address = UINTPTR_MAX; ++void *mca_sshmem_base_start_address = (void*)UINTPTR_MAX; + + char * mca_sshmem_base_backing_file_dir = NULL; + +@@ -49,7 +49,7 @@ mca_sshmem_base_register (mca_base_register_flag_t flags) + "base", + "start_address", + "Specify base address for shared memory region", +- MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, ++ MCA_BASE_VAR_TYPE_UNSIGNED_LONG, + NULL, + 0, + MCA_BASE_VAR_FLAG_SETTABLE, \ No newline at end of file From fd0320b517bb1d89d282ac7aa920f97f233d006d Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 22:30:12 +0800 Subject: [PATCH 07/29] update elpa: fix link and add compile options --- toolchain/scripts/stage3/install_elpa.sh | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index d826668c4a..8d930ffc8e 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2025-0308 +# Last Update in 2025-0504 # other contributor: Benrui Tang [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 @@ -15,7 +15,6 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" elpa_ver="2025.01.001" elpa_sha256="3ef0c6aed9a3e05db6efafe6e14d66eb88b2a1354d61e765b7cde0d3d5f3951e" - source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -35,9 +34,6 @@ cd "${BUILDDIR}" # elpa only works with MPI switched on if [ $MPI_MODE = no ]; then report_warning $LINENO "MPI is disabled, skipping elpa installation" - cat << EOF > "${BUILDDIR}/setup_elpa" -with_elpa="__FALSE__" -EOF exit 0 fi @@ -102,27 +98,32 @@ case "$with_elpa" in config_flags="--enable-avx-kernels=${has_AVX} --enable-avx2-kernels=${has_AVX2} --enable-avx512-kernels=${has_AVX512}" fi fi - # CUDA_CFLAGS="-std=c++14 -allow-unsupported-compiler" \ for TARGET in "cpu" "nvidia"; do [ "$TARGET" = "nvidia" ] && [ "$ENABLE_CUDA" != "__TRUE__" ] && continue - # disable cpu if cuda is enabled + # disable cpu if cuda is enabled, only install one [ "$TARGET" != "nvidia" ] && [ "$ENABLE_CUDA" = "__TRUE__" ] && continue - echo "Installing from scratch into ${pkg_install_dir}/${TARGET}" + # 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}" + + echo "Installing from scratch into ${pkg_install_dir}" mkdir -p "build_${TARGET}" cd "build_${TARGET}" if [ "${with_amd}" != "__DONTUSE__" ] && [ "${WITH_FLANG}" = "yes" ] ; then echo "AMD fortran compiler detected, enable special option operation" - ../configure --prefix="${pkg_install_dir}/${TARGET}/" \ - --libdir="${pkg_install_dir}/${TARGET}/lib" \ + ../configure --prefix="${pkg_install_dir}" \ + --libdir="${pkg_install_dir}/lib" \ --enable-openmp=${enable_openmp} \ --enable-static=no \ --enable-shared=yes \ --disable-c-tests \ --disable-cpp-tests \ ${config_flags} \ - --enable-nvidia-gpu-kernels=$([ "$TARGET" = "nvidia" ] && echo "yes" || echo "no") \ --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") \ + CUDA_CFLAGS="-std=c++14 -allow-unsupported-compiler" \ OMPI_MCA_plm_rsh_agent=/bin/false \ FC=${MPIFC} \ CC=${MPICC} \ @@ -140,8 +141,9 @@ case "$with_elpa" in -e 's/\\$wl--whole-archive\\$convenience \\$wl--no-whole-archive//g' \ -e 's/\\$wl\\$soname //g' else - ../configure --prefix="${pkg_install_dir}/${TARGET}/" \ - --libdir="${pkg_install_dir}/${TARGET}/lib" \ + # normal installation + ../configure --prefix="${pkg_install_dir}/" \ + --libdir="${pkg_install_dir}/lib" \ --enable-openmp=${enable_openmp} \ --enable-static=no \ --enable-shared=yes \ @@ -151,6 +153,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") \ + CUDA_CFLAGS="-std=c++14 -allow-unsupported-compiler" \ FC=${MPIFC} \ CC=${MPICC} \ CXX=${MPICXX} \ @@ -166,9 +169,9 @@ case "$with_elpa" in make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log cd .. # link elpa - link=${pkg_install_dir}/${TARGET}/include/elpa + link=${pkg_install_dir}/include/elpa if [[ ! -d $link ]]; then - ln -s ${pkg_install_dir}/${TARGET}/include/elpa_openmp-${elpa_ver}/elpa $link + ln -s ${pkg_install_dir}/include/elpa_openmp-${elpa_ver}/elpa $link fi done cd .. @@ -177,8 +180,8 @@ case "$with_elpa" in fi fi [ "$enable_openmp" != "yes" ] && elpa_dir_openmp="" - ELPA_CFLAGS="-I'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/include/elpa${elpa_dir_openmp}-${elpa_ver}/modules' -I'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/include/elpa${elpa_dir_openmp}-${elpa_ver}/elpa'" - ELPA_LDFLAGS="-L'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/lib' -Wl,-rpath,'${pkg_install_dir}/IF_CUDA(nvidia|cpu)/lib'" + 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'" ;; __SYSTEM__) echo "==================== Finding ELPA from system paths ====================" @@ -202,7 +205,7 @@ case "$with_elpa" in pkg_install_dir="$with_elpa" check_dir "${pkg_install_dir}/include" check_dir "${pkg_install_dir}/lib" - user_include_path="$pkg_install_dir/include" + user_include_path="${pkg_install_dir}/include" elpa_include="$(find_in_paths "elpa_openmp-*" user_include_path)" if [ "$elpa_include" != "__FALSE__" ]; then echo "ELPA include directory threaded version is found to be $elpa_include/modules" From 3c31e21a33f9a3c74414b9c249c85d45ba02481e Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 22:33:04 +0800 Subject: [PATCH 08/29] hide the requirements scripts --- toolchain/root_requirements/README | 7 +++++++ toolchain/{ => root_requirements}/install_requirements.sh | 0 .../{ => root_requirements}/install_requirements_fedora.sh | 0 .../{ => root_requirements}/install_requirements_ubuntu.sh | 0 4 files changed, 7 insertions(+) create mode 100644 toolchain/root_requirements/README rename toolchain/{ => root_requirements}/install_requirements.sh (100%) rename toolchain/{ => root_requirements}/install_requirements_fedora.sh (100%) rename toolchain/{ => root_requirements}/install_requirements_ubuntu.sh (100%) diff --git a/toolchain/root_requirements/README b/toolchain/root_requirements/README new file mode 100644 index 0000000000..e513139b41 --- /dev/null +++ b/toolchain/root_requirements/README @@ -0,0 +1,7 @@ +## Scripts in root_requirements directory + +These scripts are for basic requirements for using toolchain +which should be implemented in your server global environments. +if not, please contact your server manager. + +You should use these scripts under root permission. \ No newline at end of file diff --git a/toolchain/install_requirements.sh b/toolchain/root_requirements/install_requirements.sh similarity index 100% rename from toolchain/install_requirements.sh rename to toolchain/root_requirements/install_requirements.sh diff --git a/toolchain/install_requirements_fedora.sh b/toolchain/root_requirements/install_requirements_fedora.sh similarity index 100% rename from toolchain/install_requirements_fedora.sh rename to toolchain/root_requirements/install_requirements_fedora.sh diff --git a/toolchain/install_requirements_ubuntu.sh b/toolchain/root_requirements/install_requirements_ubuntu.sh similarity index 100% rename from toolchain/install_requirements_ubuntu.sh rename to toolchain/root_requirements/install_requirements_ubuntu.sh From 44fe4ba743cd60a8fecc24598fb438fa84b1e4ce Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 22:39:34 +0800 Subject: [PATCH 09/29] update scalapack --- toolchain/scripts/stage3/install_scalapack.sh | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index b5f150e8f7..c2d6690bd1 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -3,16 +3,14 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2023-0901 +# Last Update in 2024-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" scalapack_ver="2.2.2" scalapack_sha256="a2f0c9180a210bf7ffe126c9cb81099cf337da1a7120ddb4cbe4894eb7b7d022" -#scalapack_ver="2.2.1" -#scalapack_sha256="4aede775fdb28fa44b331875730bcd5bab130caaec225fadeccf424c8fcb55aa" -scalapack_pkg="scalapack-${scalapack_ver}.tgz" +scalapack_pkg="scalapack-${scalapack_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh @@ -55,18 +53,21 @@ case "$with_scalapack" in mkdir -p "scalapack-${scalapack_ver}/build" pushd "scalapack-${scalapack_ver}/build" > /dev/null - flags="" + cflags="" + fflags="" if ("${FC}" --version | grep -q 'GNU'); then - flags=$(allowed_gfortran_flags "-fallow-argument-mismatch") + cflags="-fpermissive" + fflags=$(allowed_gfortran_flags "-fallow-argument-mismatch") fi - # modified by @YuugataShinonome for GCC 14 - FFLAGS=$flags cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \ + CFLAGS=${cflags} FFLAGS=${fflags} \ + cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \ -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \ -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBUILD_SHARED_LIBS=YES \ -DCMAKE_BUILD_TYPE=Release .. \ - -DCMAKE_C_FLAGS:STRING="$CFLAGS -Wno-implicit-function-declaration" \ + -DBUILD_TESTING=NO \ -DSCALAPACK_BUILD_TESTS=NO \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log @@ -99,13 +100,13 @@ if [ "$with_scalapack" != "__DONTUSE__" ]; then 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" -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} +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 From 0b02763aad71c1fb34b569c6f1443cd9e41c2033 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 22:59:02 +0800 Subject: [PATCH 10/29] update VERSION --- toolchain/README.md | 22 +++++++++++----------- toolchain/scripts/VERSION | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index a08ab7a559..a3235c83dd 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -1,6 +1,6 @@ # The ABACUS Toolchain -Version 2025.1 +Version 2025.2 ## Main Developer @@ -98,7 +98,7 @@ The above station will be updated handly but one should notice that the version If one want to install ABACUS by toolchain OFFLINE, one can manually download all the packages from [cp2k-static/download](https://www.cp2k.org/static/downloads) or official website and put them in *build* directory by formatted name -like *fftw-3.3.10.tar.gz*, or *openmpi-5.0.6.tar.bz2*, +like *fftw-3.3.10.tar.gz*, or *openmpi-5.0.7.tar.bz2*, then run this toolchain. All package will be detected and installed automatically. Also, one can install parts of packages OFFLINE and parts of packages ONLINE @@ -113,17 +113,17 @@ just by using this toolchain The needed dependencies version default: -- `cmake` 3.31.2 +- `cmake` 3.31.7 - `gcc` 13.2.0 (which will always NOT be installed, But use system) -- `OpenMPI` 5.0.6 (Version 5 OpenMPI is good but will have compability problem, user can manually downarade to Version 4 in toolchain scripts) +- `OpenMPI` 5.0.7 (Version 5 OpenMPI is good but will have compability problem, user can manually downarade to Version 4 in toolchain scripts) - `MPICH` 4.3.0 -- `OpenBLAS` 0.3.28 (Intel toolchain need `get_vars.sh` tool from it) -- `ScaLAPACK` 2.2.1 (a developing version) +- `OpenBLAS` 0.3.29 (Intel toolchain need `get_vars.sh` tool from it) +- `ScaLAPACK` 2.2.2 - `FFTW` 3.3.10 - `LibXC` 7.0.0 -- `ELPA` 2025.01.001 -- `CEREAL` 1.3.2 -- `RapidJSON` 1.1.0 +- `ELPA` 2025.01.001 (may not be conpatiable for gpu-ver) +- `CEREAL` master (for oneapi compatibility) +- `RapidJSON` master (for oneapi compatibility) And: - Intel-oneAPI need user or server manager to manually install from Intel. - - [Intel-oneAPI](https://www.intel.cn/content/www/cn/zh/developer/tools/oneapi/toolkits.html) @@ -135,8 +135,8 @@ Dependencies below are optional, which is NOT installed by default: - `LibTorch` 2.1.2 - `Libnpy` 1.0.1 -- `LibRI` 0.2.0 -- `LibComm` 0.1.1 +- `LibRI` 0.2.1.0 +- `LibComm` master (for openmpi compatibility) Users can install them by using `--with-*=install` in toolchain*.sh, which is `no` in default. Also, user can specify the absolute path of the package by `--with-*=path/to/package` in toolchain*.sh to allow toolchain to use the package. > Notice: LibTorch always suffer from GLIBC_VERSION problem, if you encounter this, please downgrade LibTorch version to 1.12.1 in scripts/stage4/install_torch.sh diff --git a/toolchain/scripts/VERSION b/toolchain/scripts/VERSION index d50de5efde..e94549a66e 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.1" \ No newline at end of file +VERSION="2025.2" \ No newline at end of file From 8eafa3e44e8bb3c5ccd04ef8f260b4543ee8ba62 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 22:59:13 +0800 Subject: [PATCH 11/29] adjust the stage4 scripts --- toolchain/scripts/stage4/install_cereal.sh | 2 +- toolchain/scripts/stage4/install_libcomm.sh | 2 +- toolchain/scripts/stage4/install_libnpy.sh | 12 +++++------- toolchain/scripts/stage4/install_libri.sh | 2 +- toolchain/scripts/stage4/install_rapidjson.sh | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index ecca75645e..066d7d7975 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -5,7 +5,7 @@ # CEREAL is not need any complex setting # Only problem is the installation from github.com -# Last Update in 2023-0918 +# Last Update in 2025-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index bdfb135b8e..ccb39061ea 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -6,7 +6,7 @@ # Only problem is the installation from github.com # LibComm is under highly-active development, the git submodule installation is more recommended -# Last Update in 2024-0815 +# Last Update in 2025-0504 # other contributor: Peize Lin [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index d0b21467b1..ebca6214e7 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -6,13 +6,13 @@ # Only problem is the installation from github.com # Libnpy is under active development, you can check the latest version in github yourself -# Last Update in 2023-1124 +# Last Update in 2025-0504 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -libnpy_ver="master" -libnpy_sha256="--no-checksum" +libnpy_ver="1.0.1" +libnpy_sha256="43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0fba44" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh @@ -32,9 +32,7 @@ case "$with_libnpy" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/libnpy/${libnpy_ver}" install_lock_file="$pkg_install_dir/install_successful" - #url="https://github.com/llohse/libnpy/archive/refs/tags/v${libnpy_ver}.tar.gz" - #filename="libnpy-${libnpy_ver}.tar.gz" - url="https://codeload.github.com/llohse/libnpy/tar.gz/${libnpy_ver}" + url="https://codeload.github.com/llohse/libnpy/tar.gz/v${libnpy_ver}" filename="libnpy-${libnpy_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." @@ -43,7 +41,7 @@ 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 master repository <===" + 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 2d4bd12679..4de041f660 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -6,7 +6,7 @@ # Only problem is the installation from github.com # LibRI is under highly-active development, the git submodule installation is more recommended -# Last Update in 2024-0815 +# Last Update in 2025-0504 # other contributor: Peize Lin [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index e3da05e989..27fb94edd3 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -5,7 +5,7 @@ # RAPIDJSON is not need any complex setting # Only problem is the installation from github.com -# Last Update in 2025-05-01 +# Last Update in 2025-0504 # other contributor: Kai Luo, XingLiang Peng [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 From f3092321a71edab8283193ae7185fbdda9567dac Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 23:01:05 +0800 Subject: [PATCH 12/29] update build*.sh --- toolchain/build_abacus_gnu-aocl.sh | 6 +++--- toolchain/build_abacus_gnu.sh | 10 +++++----- toolchain/build_abacus_intel-mpich.sh | 6 +++--- toolchain/build_abacus_intel.sh | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/toolchain/build_abacus_gnu-aocl.sh b/toolchain/build_abacus_gnu-aocl.sh index ab283efb3b..50c3ade1c1 100755 --- a/toolchain/build_abacus_gnu-aocl.sh +++ b/toolchain/build_abacus_gnu-aocl.sh @@ -23,14 +23,14 @@ rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # LAPACK=$AOCLhome/lib # SCALAPACK=$AOCLhome/lib # FFTW3=$AOCLhome # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # 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 diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index febe2fa5aa..d66354d671 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -21,16 +21,16 @@ BUILD_DIR=build_abacus_gnu rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -LAPACK=$INSTALL_DIR/openblas-0.3.28/lib -SCALAPACK=$INSTALL_DIR/scalapack-2.2.1/lib +LAPACK=$INSTALL_DIR/openblas-0.3.29/lib +SCALAPACK=$INSTALL_DIR/scalapack-2.2.2/lib ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu # ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao FFTW3=$INSTALL_DIR/fftw-3.3.10 -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # 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 diff --git a/toolchain/build_abacus_intel-mpich.sh b/toolchain/build_abacus_intel-mpich.sh index 59e93967ae..be8616f7f2 100755 --- a/toolchain/build_abacus_intel-mpich.sh +++ b/toolchain/build_abacus_intel-mpich.sh @@ -23,13 +23,13 @@ rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libx-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 5fc96a26b8..9fec9247a4 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -24,13 +24,13 @@ rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu # ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao -CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal +CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/ +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-0.1.1 +# LIBCOMM=$INSTALL_DIR/LibComm-master # 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 recommended From f27b304f025e71e214645c6a4f94612981ac7665 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 23:06:09 +0800 Subject: [PATCH 13/29] update the version of cereal for automatic download --- cmake/FindCereal.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindCereal.cmake b/cmake/FindCereal.cmake index e32f94711a..a8ef2682a0 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://github.com/USCiLab/cereal/archive/refs/tags/v1.3.2.tar.gz ) FetchContent_Populate(cereal) set(CEREAL_INCLUDE_DIR ${cereal_SOURCE_DIR}/include) From af51899acdf42d26fac7a0c8c8854dddfe539050 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 23:15:58 +0800 Subject: [PATCH 14/29] bug fixed --- toolchain/install_abacus_toolchain.sh | 14 +++++++------- .../{opemmpi_RHEL8.patch => openmpi_RHEL8.patch} | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename toolchain/scripts/stage1/{opemmpi_RHEL8.patch => openmpi_RHEL8.patch} (100%) diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index dce50684ec..a0413c322d 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -699,19 +699,19 @@ fi # Select the correct compute number based on the GPU architecture # QuantumMisaka in 2025-03-19 export ARCH_NUM="${GPUVER//.}" -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 # 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 + 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 fi diff --git a/toolchain/scripts/stage1/opemmpi_RHEL8.patch b/toolchain/scripts/stage1/openmpi_RHEL8.patch similarity index 100% rename from toolchain/scripts/stage1/opemmpi_RHEL8.patch rename to toolchain/scripts/stage1/openmpi_RHEL8.patch From ce64e283145cd4e1b06c7546155786cfca012602 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Sun, 4 May 2025 23:17:14 +0800 Subject: [PATCH 15/29] fix if-fi in CUDA/HIP --- toolchain/install_abacus_toolchain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index a0413c322d..cdd7dacb10 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -705,13 +705,13 @@ 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 fi From dd66b62724583ec5cd05932f6526ffc1d1e9e003 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 00:34:14 +0800 Subject: [PATCH 16/29] bug fixed --- toolchain/scripts/stage1/install_openmpi.sh | 3 +-- toolchain/scripts/stage1/openmpi_RHEL8.patch | 20 -------------------- toolchain/scripts/stage4/install_cereal.sh | 2 +- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 toolchain/scripts/stage1/openmpi_RHEL8.patch diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index 6bbfd584ec..faad08eb48 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -70,8 +70,7 @@ case "${with_openmpi}" in fi fi - # Apply patch for RHEL8 from https://github.com/open-mpi/ompi/issues/13103 - patch -p1 oshmem/mca/sshmem/base/sshmem_base_open.c < ${SCRIPT_DIR}/stage1/openmpi_RHEL8.patch + # Notice for RHEL8 refer https://github.com/open-mpi/ompi/issues/13103 # OpenMPI 5.0 only supports PMIx # PMI support is required for Slurm, but not for other schedulers diff --git a/toolchain/scripts/stage1/openmpi_RHEL8.patch b/toolchain/scripts/stage1/openmpi_RHEL8.patch deleted file mode 100644 index 94ce4a18d3..0000000000 --- a/toolchain/scripts/stage1/openmpi_RHEL8.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/oshmem/mca/sshmem/base/sshmem_base_open.c -+++ b/oshmem/mca/sshmem/base/sshmem_base_open.c -@@ -31,7 +31,7 @@ - * globals - */ - --void *mca_sshmem_base_start_address = UINTPTR_MAX; -+void *mca_sshmem_base_start_address = (void*)UINTPTR_MAX; - - char * mca_sshmem_base_backing_file_dir = NULL; - -@@ -49,7 +49,7 @@ mca_sshmem_base_register (mca_base_register_flag_t flags) - "base", - "start_address", - "Specify base address for shared memory region", -- MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, -+ MCA_BASE_VAR_TYPE_UNSIGNED_LONG, - NULL, - 0, - MCA_BASE_VAR_FLAG_SETTABLE, \ No newline at end of file diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 066d7d7975..a6c597d69f 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -31,7 +31,7 @@ case "$with_cereal" in pkg_install_dir="${INSTALLDIR}/$dirname" #pkg_install_dir="${HOME}/lib/cereal/${cereal_ver}" install_lock_file="$pkg_install_dir/install_successful" - url="https://codeload.github.com/USCiLab/cereal/tar.gz/${cereal_ver}.tar.gz" + url="https://codeload.github.com/USCiLab/cereal/tar.gz/${cereal_ver}" filename="cereal-${cereal_ver}.tar.gz" if verify_checksums "${install_lock_file}"; then echo "$dirname is already installed, skipping it." From bb75f99e8e7baed09e8978455e6a66b362348e37 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 12:09:22 +0800 Subject: [PATCH 17/29] remove intel-mpich scripts --- toolchain/build_abacus_intel-mpich.sh | 76 --------------------------- toolchain/toolchain_intel-mpich.sh | 33 ------------ 2 files changed, 109 deletions(-) delete mode 100755 toolchain/build_abacus_intel-mpich.sh delete mode 100755 toolchain/toolchain_intel-mpich.sh diff --git a/toolchain/build_abacus_intel-mpich.sh b/toolchain/build_abacus_intel-mpich.sh deleted file mode 100755 index be8616f7f2..0000000000 --- a/toolchain/build_abacus_intel-mpich.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -#SBATCH -J build -#SBATCH -N 1 -#SBATCH -n 16 -#SBATCH -o install.log -#SBATCH -e install.err -# JamesMisaka in 2025.03.09 - -# Build ABACUS by intel-toolchain with mpich - -# module load mkl compiler -# 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_intel-mpich -rm -rf $BUILD_DIR - -PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu -CEREAL=$INSTALL_DIR/cereal-master/include/cereal -LIBXC=$INSTALL_DIR/libx-7.0.0 -RAPIDJSON=$INSTALL_DIR/rapidjson-master/ -# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch -# LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include -# LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 -# LIBCOMM=$INSTALL_DIR/LibComm-master -# DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem - -cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_CXX_COMPILER=icpx \ - -DMPI_CXX_COMPILER=mpicxx \ - -DMKLROOT=$MKLROOT \ - -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_DEEPKS=1 \ -# -DTorch_DIR=$LIBTORCH \ -# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ -# -DENABLE_LIBRI=ON \ -# -DLIBRI_DIR=$LIBRI \ -# -DLIBCOMM_DIR=$LIBCOMM \ -# -DDeePMD_DIR=$DEEPMD \ - - -# if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements - -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 \ No newline at end of file diff --git a/toolchain/toolchain_intel-mpich.sh b/toolchain/toolchain_intel-mpich.sh deleted file mode 100755 index afa9871762..0000000000 --- a/toolchain/toolchain_intel-mpich.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -#SBATCH -J install -#SBATCH -N 1 -#SBATCH -n 16 -#SBATCH -o compile.log -#SBATCH -e compile.err - -# JamesMisaka in 2023-09-16 -# install abacus dependency by intel-toolchain -# use mkl ,and mpich instead of intelmpi -# libtorch and libnpy are for deepks support, which can be =no - -# module load mkl compiler - -./install_abacus_toolchain.sh \ ---with-intel=system \ ---math-mode=mkl \ ---with-gcc=no \ ---with-mpich=install \ ---with-cmake=install \ ---with-scalapack=no \ ---with-libxc=install \ ---with-fftw=no \ ---with-elpa=install \ ---with-cereal=install \ ---with-rapidjson=install \ ---with-libtorch=no \ ---with-libnpy=no \ ---with-libri=no \ ---with-libcomm=no \ ---with-intel-classic=no \ -| tee compile.log -# for using AMD-CPU or GPU-version: set --with-intel-classic=yes \ No newline at end of file From a5b9948dfaada4afd91db4cb3460266351556dda Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 12:54:26 +0800 Subject: [PATCH 18/29] match cp2k toolchain --- toolchain/root_requirements/install_requirements_fedora.sh | 3 ++- toolchain/root_requirements/install_requirements_ubuntu.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/toolchain/root_requirements/install_requirements_fedora.sh b/toolchain/root_requirements/install_requirements_fedora.sh index c31d504b0a..71b531ed73 100755 --- a/toolchain/root_requirements/install_requirements_fedora.sh +++ b/toolchain/root_requirements/install_requirements_fedora.sh @@ -28,7 +28,8 @@ dnf -qy install \ vim-common \ wget \ which \ - zlib-devel + zlib-devel \ + zlib-static dnf clean -q all diff --git a/toolchain/root_requirements/install_requirements_ubuntu.sh b/toolchain/root_requirements/install_requirements_ubuntu.sh index aa60f4bfc4..8f97db1ec5 100755 --- a/toolchain/root_requirements/install_requirements_ubuntu.sh +++ b/toolchain/root_requirements/install_requirements_ubuntu.sh @@ -28,6 +28,7 @@ apt-get install -qq --no-install-recommends \ patch \ pkg-config \ python3 \ + python3-pip \ unzip \ wget \ xxd \ From baae62b9a4c9774302404072a8ed75b2de1746fc Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 12:55:40 +0800 Subject: [PATCH 19/29] add gcc version checking and others --- toolchain/install_abacus_toolchain.sh | 38 ++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index cdd7dacb10..08a647ad74 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)" #> can be used to compile and use ABACUS #> \history Created on Friday, 2023/08/18 # Update for Intel (18.08.2023, MK) -#> \author Zhaoqing Liu quanmisaka@stu.pku.edu.cn +#> \author Zhaoqing Liu (Quantum Misaka) quanmisaka@stu.pku.edu.cn # ***************************************************************************** # ------------------------------------------------------------------------ @@ -158,7 +158,7 @@ The --with-PKG options follow the rules: 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 CP2K. + --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 @@ -622,6 +622,37 @@ export ENABLE_CRAY="${enable_cray}" # ------------------------------------------------------------------------ # Check and solve known conflicts before installations proceed # ------------------------------------------------------------------------ +# Check GCC version: +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 +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." @@ -632,9 +663,10 @@ if [ "${with_amd}" != "__DONTUSE__" ] && [ "${with_gcc}" = "__INSTALL__" ]; then 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. Select only one compiler." + 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 From c0c19670d9575b7375a7ef555313f83e69a725b8 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 12:55:52 +0800 Subject: [PATCH 20/29] update building scripts --- toolchain/build_abacus_amd.sh | 86 ++++++++++++++++++++++++++++++ toolchain/build_abacus_gnu-aocl.sh | 20 ++++--- toolchain/build_abacus_gnu.sh | 6 +-- toolchain/build_abacus_intel.sh | 5 +- toolchain/toolchain_gcc-aocl.sh | 35 ++++++++++++ 5 files changed, 139 insertions(+), 13 deletions(-) create mode 100755 toolchain/build_abacus_amd.sh create mode 100755 toolchain/toolchain_gcc-aocl.sh diff --git a/toolchain/build_abacus_amd.sh b/toolchain/build_abacus_amd.sh new file mode 100755 index 0000000000..4bd3a3cd39 --- /dev/null +++ b/toolchain/build_abacus_amd.sh @@ -0,0 +1,86 @@ +#!/bin/bash +#SBATCH -J build +#SBATCH -N 1 +#SBATCH -n 16 +#SBATCH -o install.log +#SBATCH -e install.err +# JamesMisaka in 2025.03.09 + +# Build ABACUS by amd-openmpi toolchain + +# module load openmpi aocc aocl + +ABACUS_DIR=.. +TOOL=$(pwd) +INSTALL_DIR=$TOOL/install +source $INSTALL_DIR/setup +cd $ABACUS_DIR +ABACUS_DIR=$(pwd) +#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocc/ # user should specify this parameter + +BUILD_DIR=build_abacus_aocl +rm -rf $BUILD_DIR + +PREFIX=$ABACUS_DIR +ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu +# ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao +CEREAL=$INSTALL_DIR/cereal-master/include/cereal +LIBXC=$INSTALL_DIR/libxc-7.0.0 +RAPIDJSON=$INSTALL_DIR/rapidjson-master/ +LAPACK=$AOCLhome/lib +SCALAPACK=$AOCLhome/lib +FFTW3=$AOCLhome +# LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 +# LIBCOMM=$INSTALL_DIR/LibComm-master +# 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 + +# if clang++ have problem, switch back to g++ + +cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DMPI_CXX_COMPILER=mpicxx \ + -DLAPACK_DIR=$LAPACK \ + -DSCALAPACK_DIR=$SCALAPACK \ + -DFFTW3_DIR=$FFTW3 \ + -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_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DENABLE_LIBRI=ON \ +# -DLIBRI_DIR=$LIBRI \ +# -DLIBCOMM_DIR=$LIBCOMM \ +# -DDeePMD_DIR=$DEEPMD \ +# -DUSE_CUDA=ON \ +# -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 + +# if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements + +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 \ No newline at end of file diff --git a/toolchain/build_abacus_gnu-aocl.sh b/toolchain/build_abacus_gnu-aocl.sh index 50c3ade1c1..b90eb77d5a 100755 --- a/toolchain/build_abacus_gnu-aocl.sh +++ b/toolchain/build_abacus_gnu-aocl.sh @@ -16,19 +16,20 @@ INSTALL_DIR=$TOOL/install source $INSTALL_DIR/setup cd $ABACUS_DIR ABACUS_DIR=$(pwd) -#AOCLhome=/opt/aocl # user can specify this parameter +#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocc/ # user should specify this parameter BUILD_DIR=build_abacus_aocl rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2025.01.001/cpu +# ELPA=$INSTALL_DIR/elpa-2025.01.001/nvidia # for gpu-lcao CEREAL=$INSTALL_DIR/cereal-master/include/cereal LIBXC=$INSTALL_DIR/libxc-7.0.0 RAPIDJSON=$INSTALL_DIR/rapidjson-master/ -# LAPACK=$AOCLhome/lib -# SCALAPACK=$AOCLhome/lib -# FFTW3=$AOCLhome +LAPACK=$AOCLhome/lib +SCALAPACK=$AOCLhome/lib +FFTW3=$AOCLhome # LIBRI=$INSTALL_DIR/LibRI-0.2.1.0 # LIBCOMM=$INSTALL_DIR/LibComm-master # LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch @@ -38,8 +39,11 @@ RAPIDJSON=$INSTALL_DIR/rapidjson-master/ # if clang++ have problem, switch back to g++ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_CXX_COMPILER=g++ \ -DMPI_CXX_COMPILER=mpicxx \ + -DLAPACK_DIR=$LAPACK \ + -DSCALAPACK_DIR=$SCALAPACK \ + -DFFTW3_DIR=$FFTW3 \ -DELPA_DIR=$ELPA \ -DCEREAL_INCLUDE_DIR=$CEREAL \ -DLibxc_DIR=$LIBXC \ @@ -49,9 +53,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DLAPACK_DIR=$LAPACK \ -# -DSCALAPACK_DIR=$SCALAPACK \ -# -DFFTW3_DIR=$FFTW3 \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -59,6 +60,9 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBRI_DIR=$LIBRI \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ +# -DUSE_CUDA=ON \ +# -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 # if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index d66354d671..1cb6dbf14c 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -50,7 +50,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DUSE_CUDA=ON \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -58,8 +57,9 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBRI_DIR=$LIBRI \ # -DLIBCOMM_DIR=$LIBCOMM \ # -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 +# -DUSE_CUDA=ON \ +# -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 # # add mkl env for libtorch to link # if one want to install libtorch, mkl should be load in build process diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 9fec9247a4..b54bf6f6ad 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -47,7 +47,6 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DUSE_ELPA=ON \ -DENABLE_RAPIDJSON=ON \ -DRapidJSON_DIR=$RAPIDJSON \ -# -DUSE_CUDA=ON \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -55,7 +54,9 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBRI_DIR=$LIBRI \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ - +# -DUSE_CUDA=ON \ +# -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 cmake --build $BUILD_DIR -j `nproc` cmake --install $BUILD_DIR 2>/dev/null diff --git a/toolchain/toolchain_gcc-aocl.sh b/toolchain/toolchain_gcc-aocl.sh new file mode 100755 index 0000000000..aa2d5fbb56 --- /dev/null +++ b/toolchain/toolchain_gcc-aocl.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#SBATCH -J install +#SBATCH -N 1 +#SBATCH -n 16 +#SBATCH -o compile.log +#SBATCH -e compile.err + +# JamesMisaka in 2023-09-16 +# install abacus dependency by gnu-toolchain +# one can use mpich or openmpi. +# openmpi will be faster, but not compatible in some cases. +# libtorch and libnpy are for deepks support, which can be =no +# if you want to run EXX calculation, you should set --with-libri=install +# mpich (and intel toolchain) is recommended for EXX support + +./install_abacus_toolchain.sh \ +--with-gcc=system \ +--math-mode=aocl \ +--with-amd=no \ +--with-intel=no \ +--with-openmpi=install \ +--with-cmake=install \ +--with-scalapack=system \ +--with-libxc=install \ +--with-fftw=system \ +--with-elpa=install \ +--with-cereal=install \ +--with-rapidjson=install \ +--with-libtorch=no \ +--with-libnpy=no \ +--with-libri=no \ +--with-libcomm=no \ +--with-4th-openmpi=no \ +| tee compile.log +# to use openmpi-version4: set --with-4th-openmpi=yes \ No newline at end of file From 2a9788bb284b90d09eb0945361fa6f9b8a9ee8df Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 13:03:11 +0800 Subject: [PATCH 21/29] update more messsage for gcc-ver checking --- toolchain/install_abacus_toolchain.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index 08a647ad74..a3057bd0fb 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -623,6 +623,7 @@ 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 @@ -651,6 +652,7 @@ 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 From 689964d690c156d45debd4e96d031c9e3433996c Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 13:28:11 +0800 Subject: [PATCH 22/29] disable static installation of fftw --- toolchain/scripts/stage3/install_fftw.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/scripts/stage3/install_fftw.sh b/toolchain/scripts/stage3/install_fftw.sh index a04d47d322..485afbdfa3 100755 --- a/toolchain/scripts/stage3/install_fftw.sh +++ b/toolchain/scripts/stage3/install_fftw.sh @@ -49,7 +49,7 @@ case "$with_fftw" in [ -d fftw-${fftw_ver} ] && rm -rf fftw-${fftw_ver} tar -xzf ${fftw_pkg} cd fftw-${fftw_ver} - FFTW_FLAGS="--enable-openmp --enable-shared --enable-static" + FFTW_FLAGS="--enable-openmp --enable-shared" # fftw has mpi support but not compiled by default. so compile it if we build with mpi. # it will create a second library to link with if needed [ "${MPI_MODE}" != "no" ] && FFTW_FLAGS="--enable-mpi ${FFTW_FLAGS}" From d61552237f37c9f53a530b8270ca19f3c846767a Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 13:28:26 +0800 Subject: [PATCH 23/29] rename amd scripts for avoid confusion --- toolchain/{build_abacus_amd.sh => build_abacus_aocc-aocl.sh} | 0 toolchain/{toolchain_amd.sh => toolchain_aocc-aocl.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename toolchain/{build_abacus_amd.sh => build_abacus_aocc-aocl.sh} (100%) rename toolchain/{toolchain_amd.sh => toolchain_aocc-aocl.sh} (100%) diff --git a/toolchain/build_abacus_amd.sh b/toolchain/build_abacus_aocc-aocl.sh similarity index 100% rename from toolchain/build_abacus_amd.sh rename to toolchain/build_abacus_aocc-aocl.sh diff --git a/toolchain/toolchain_amd.sh b/toolchain/toolchain_aocc-aocl.sh similarity index 100% rename from toolchain/toolchain_amd.sh rename to toolchain/toolchain_aocc-aocl.sh From dc2176a2d4a4a3f4c07f59991e69a840d6d51e7d Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 13:37:24 +0800 Subject: [PATCH 24/29] update fftw downloading url --- toolchain/scripts/stage3/install_fftw.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolchain/scripts/stage3/install_fftw.sh b/toolchain/scripts/stage3/install_fftw.sh index 485afbdfa3..fac3c2040d 100755 --- a/toolchain/scripts/stage3/install_fftw.sh +++ b/toolchain/scripts/stage3/install_fftw.sh @@ -40,7 +40,9 @@ case "$with_fftw" in if [ -f ${fftw_pkg} ]; then echo "${fftw_pkg} is found" else - download_pkg_from_ABACUS_org "${fftw_sha256}" "${fftw_pkg}" + #download_pkg_from_ABACUS_org "${fftw_sha256}" "${fftw_pkg}" + url="http://www.fftw.org/${fftw_pkg}" + download_pkg_from_url "${fftw_sha256}" "${fftw_pkg}" "${url}" fi if [ "${PACK_RUN}" = "__TRUE__" ]; then echo "--pack-run mode specified, skip installation" From cd830a99099b3238dee0de03be6ce894781fa70d Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Mon, 5 May 2025 16:33:27 +0800 Subject: [PATCH 25/29] msg update --- toolchain/README.md | 79 ++++++++++++++------------- toolchain/install_abacus_toolchain.sh | 3 +- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index a3235c83dd..1232d7d861 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -33,7 +33,6 @@ and give setup files that you can use to compile ABACUS. - [ ] Support a JSON or YAML configuration file for toolchain, which can be easily modified by users. - [ ] A better README and Detail markdown file. - [ ] Automatic installation of [DEEPMD](https://github.com/deepmodeling/deepmd-kit). -- [ ] Better compliation method for ABACUS-DEEPMD and ABACUS-DEEPKS. - [ ] Modulefile generation scripts. @@ -44,17 +43,17 @@ which will use scripts in *scripts* directory to compile install dependencies of ABACUS. It can be directly used, but not recommended. -There are also well-modified script to run *install_abacus_toolchain.sh* for `gnu-openblas` and `intel-mkl` toolchains dependencies. +There are also well-modified script to run *install_abacus_toolchain.sh* for `gnu` (gcc-openblas), `intel` (intel-mkl-mpi-compiler), `gcc-aocl` and `aocc-aocl` toolchains dependencies. ```shell # for gnu-openblas > ./toolchain_gnu.sh # for intel-mkl > ./toolchain_intel.sh -# for amd aocc-aocl -> ./toolchain_amd.sh -# for intel-mkl-mpich -> ./toolchain_intel-mpich.sh +# for AMD gcc-aocl +> ./toolchain_gcc-aocl.sh +# for AMD aocc-aocl +> ./toolchain_aocc-aocl.sh ``` It is recommended to run one of them first to get a fast installation of ABACUS under certain environments. @@ -66,13 +65,16 @@ If you are using Intel environments via Intel-OneAPI: please note: 4. Users can manually specify `--with-ifx=no` in `toolchain*.sh` to use `ifort` while keep other compiler to new version. 5. More information is in the later part of this README. -**Notice: You GCC version should be no lower than 5 !!!, larger than 7.3.0 is recommended** +If you are using AMD AOCL and AOCC, please note: -**Notice: You SHOULD `source` or `module load` related environments before use toolchain method for installation, espacially for `gcc` or `intel-oneAPI` !!!! for example, `module load mkl mpi icc compiler`** + +**Notice: You GCC version should be no lower than 5 !!!. The toolchain will check it, and gcc with version larger than 7.3.0 is recommended.** + +**Notice: You SHOULD `source` or `module load` related environments before use toolchain method for installation, espacially for `intel`, `gcc-aocl` or `aocc-aocl` toolchain !!!! for example, `module load mkl mpi icc compiler` for loading oneapi envs** **Notice: You SHOULD keep your environments systematic, for example, you CANNOT load `intel-OneAPI` environments while use gcc toolchain !!!** -**Notice: If your server system already have libraries like `cmake`, `openmpi`, please change related setting in `toolchain*.sh` like `--with-cmake=system`** +**Notice: If your server system already have libraries like `cmake`, `openmpi`, please change related setting in `toolchain*.sh` like `--with-cmake=system`, note that the environments of these system package will not be added into install/setup file** All packages will be downloaded from [cp2k-static/download](https://www.cp2k.org/static/downloads). by `wget` , and will be detailedly compiled and installed in `install` directory by toolchain scripts, despite of: @@ -82,7 +84,7 @@ All packages will be downloaded from [cp2k-static/download](https://www.cp2k.org - `LibRI` which will be downloaded from [LibRI](https://github.com/abacusmodeling/LibRI) - `LibCOMM` which will be downloaded from [LibComm](https://github.com/abacusmodeling/LibComm) - `RapidJSON` which will be downloaded from [RapidJSON](https://github.com/Tencent/rapidjson) -Notice: These packages will be downloaded by `wget` from `github.com`, which is hard to be done in Chinese Internet. You may need to use offline installation method. +Notice: These packages will be downloaded by `wget` from `codeload.github.com`, which bypass the difficulty of Chinese Internet in some extent. If any downloading problem occurs, you may need to use offline installation method. Instead of github.com, we offer other package station, you can use it by: ```shell @@ -115,10 +117,10 @@ The needed dependencies version default: - `cmake` 3.31.7 - `gcc` 13.2.0 (which will always NOT be installed, But use system) -- `OpenMPI` 5.0.7 (Version 5 OpenMPI is good but will have compability problem, user can manually downarade to Version 4 in toolchain scripts) +- `OpenMPI` 5.0.7 (Version 5 OpenMPI is good but will have compability problem, user can manually downarade to Version 4 in toolchain scripts by specify `--with-openmpi4`) - `MPICH` 4.3.0 - `OpenBLAS` 0.3.29 (Intel toolchain need `get_vars.sh` tool from it) -- `ScaLAPACK` 2.2.2 +- `ScaLAPACK` 2.2.2 - `FFTW` 3.3.10 - `LibXC` 7.0.0 - `ELPA` 2025.01.001 (may not be conpatiable for gpu-ver) @@ -132,7 +134,6 @@ And: - - [AOCL](https://www.amd.com/zh-cn/developer/aocl.html) Dependencies below are optional, which is NOT installed by default: - - `LibTorch` 2.1.2 - `Libnpy` 1.0.1 - `LibRI` 0.2.1.0 @@ -144,11 +145,10 @@ Users can install them by using `--with-*=install` in toolchain*.sh, which is `n > Notice: LibRI, LibComm, Rapidjson and Libnpy is on actively development, you should check-out the package version when using this toolchain. Users can easily compile and install dependencies of ABACUS -by running these scripts after loading `gcc` or `intel-mkl-mpi` -environment. +by running these scripts after loading related environment. The toolchain installation process can be interrupted at anytime. -just re-run *toolchain_\*.sh*, toolchain itself may fix it. If you encouter some problem, you can always remove some package in the interrupted points and re-run the toolchain. +just re-run *toolchain_\*.sh*, toolchain itself may fix it. If you encouter some problem like file corrupted, you can always remove some package in the interrupted points and re-run the toolchain. Some useful options: - `--dry-run`: just run the main install scripts for environment setting, without any package downloading or installation. @@ -157,22 +157,25 @@ Some useful options: If compliation is successful, a message will be shown like this: ```shell -> Done! -> To use the installed tools and libraries and ABACUS version -> compiled with it you will first need to execute at the prompt: -> source ./install/setup -> 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_amd.sh -> or you can modify the builder scripts to suit your needs. +========================== 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_gnu-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. ``` You can run *build_abacus_gnu.sh* or *build_abacus_intel.sh* to build ABACUS -by gnu-toolchain or intel-toolchain respectively, the builder scripts will -automatically locate the environment and compile ABACUS. +by gnu-toolchain or intel-toolchain respectively, same for the `gcc-aocl` and `aocc-aocl` toolchain. +Then, the builder scripts will automatically locate the environment and compile ABACUS. You can manually change the builder scripts to suit your needs. The builder scripts will generate `abacus_env.sh` for source @@ -268,11 +271,8 @@ After compiling, you can specify `device GPU` in INPUT file to use GPU version o #### OneAPI 2025.0 problem -Generally, OneAPI 2025.0 can be useful to compile basic function of ABACUS, but one will encounter compatible problem related to something. Here is the treatment -- related to rapidjson: -- - Not to use rapidjson in your toolchain -- - or use the master branch of [RapidJSON](https://github.com/Tencent/rapidjson) -- related to LibRI: not to use LibRI or downgrade your OneAPI. +Generally, OneAPI 2025.0 can be useful to compile basic function of ABACUS, but one will encounter compatible problem related to something. +- related to LibRI: refer to [#6190](https://github.com/deepmodeling/abacus-develop/issues/6190), it is recommended not to use LibRI or downgrade your OneAPI now. #### ELPA problem via Intel-oneAPI toolchain in AMD server @@ -301,19 +301,22 @@ And will not occur in Intel-MPI before 2021.10.0 (Intel-oneAPI before 2023.2.0) More problem and possible solution can be accessed via [#2928](https://github.com/deepmodeling/abacus-develop/issues/2928) +#### gcc-MKL problem + +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 -You cannot use AOCC to complie abacus now, see [#5982](https://github.com/deepmodeling/abacus-develop/issues/5982) . +Use AOCC-AOCL to compile dependencies is permitted and usually get boosting in ABACUS effciency. But you need to get rid of `flang` while compling ELPA. Toolchain itself help you make this `flang` shade in default of `aocc-aocl` toolchain, and you can manully use `flang` by setting `--with-flang=yes` in `toolchain_aocc-aocl.sh` to have a try, while toolchain help 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. -However, use AOCC-AOCL to compile dependencies is permitted and usually get boosting in ABACUS effciency. But you need to get rid of `flang` while compling ELPA. Toolchain itself help you make this `flang` shade in default, and you can manully use `flang` by setting `--with-flang=yes` in `toolchain_amd.sh` to have a try. +The `gcc-aocl` toolchain will have no problem above for aocc-dependent aocl. However, the gcc-dependent aocl will have some package linking problem related to OpenMPI. Take it with caution. -Notice: ABACUS via GCC-AOCL in AOCC-AOCL toolchain have no application with DeePKS, DeePMD and LibRI. ### OpenMPI problem #### in EXX and LibRI -- GCC toolchain with OpenMPI cannot compile LibComm v0.1.1 due to the different MPI variable type from MPICH and IntelMPI, see discussion here [#5033](https://github.com/deepmodeling/abacus-develop/issues/5033), you can try use a newest branch of LibComm by +- [Fixed in Toolchain 2025-02] GCC toolchain with OpenMPI cannot compile LibComm v0.1.1 due to the different MPI variable type from MPICH and IntelMPI, see discussion here [#5033](https://github.com/deepmodeling/abacus-develop/issues/5033), you can try use a newest branch of LibComm by ``` git clone https://gitee.com/abacus_dft/LibComm -b MPI_Type_Contiguous_Pool ``` diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index a3057bd0fb..8112aa9d82 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -892,8 +892,9 @@ 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_gnu-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 From b9ac3274f526255a78a54cfc3d1df9614c21f93f Mon Sep 17 00:00:00 2001 From: James Misaka Date: Mon, 5 May 2025 17:12:43 +0800 Subject: [PATCH 26/29] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- toolchain/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index 1232d7d861..3d1f4fd964 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -70,7 +70,7 @@ If you are using AMD AOCL and AOCC, please note: **Notice: You GCC version should be no lower than 5 !!!. The toolchain will check it, and gcc with version larger than 7.3.0 is recommended.** -**Notice: You SHOULD `source` or `module load` related environments before use toolchain method for installation, espacially for `intel`, `gcc-aocl` or `aocc-aocl` toolchain !!!! for example, `module load mkl mpi icc compiler` for loading oneapi envs** +**Notice: You SHOULD `source` or `module load` related environments before use toolchain method for installation, especially for `intel`, `gcc-aocl` or `aocc-aocl` toolchain! For example, `module load mkl mpi icc compiler` for loading oneapi envs.** **Notice: You SHOULD keep your environments systematic, for example, you CANNOT load `intel-OneAPI` environments while use gcc toolchain !!!** @@ -307,7 +307,7 @@ You cannot use gcc as compiler while using MKL as math library for compile ABACU ### AMD AOCC-AOCL problem -Use AOCC-AOCL to compile dependencies is permitted and usually get boosting in ABACUS effciency. But you need to get rid of `flang` while compling ELPA. Toolchain itself help you make this `flang` shade in default of `aocc-aocl` toolchain, and you can manully use `flang` by setting `--with-flang=yes` in `toolchain_aocc-aocl.sh` to have a try, while toolchain help 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. +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. The `gcc-aocl` toolchain will have no problem above for aocc-dependent aocl. However, the gcc-dependent aocl will have some package linking problem related to OpenMPI. Take it with caution. From e640c416a77d8b2a0aaea74c113a640eb23e88d7 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Tue, 6 May 2025 15:02:18 +0800 Subject: [PATCH 27/29] unify some name&text --- toolchain/build_abacus_aocc-aocl.sh | 2 +- ...ld_abacus_gnu-aocl.sh => build_abacus_gcc-aocl.sh} | 4 +--- toolchain/install_abacus_toolchain.sh | 2 +- toolchain/toolchain_aocc-aocl.sh | 10 +++++----- toolchain/toolchain_gcc-aocl.sh | 11 ++++++----- toolchain/toolchain_gnu.sh | 7 +++---- toolchain/toolchain_intel.sh | 6 ++++-- 7 files changed, 21 insertions(+), 21 deletions(-) rename toolchain/{build_abacus_gnu-aocl.sh => build_abacus_gcc-aocl.sh} (95%) diff --git a/toolchain/build_abacus_aocc-aocl.sh b/toolchain/build_abacus_aocc-aocl.sh index 4bd3a3cd39..c06cdd1f4b 100755 --- a/toolchain/build_abacus_aocc-aocl.sh +++ b/toolchain/build_abacus_aocc-aocl.sh @@ -16,7 +16,7 @@ INSTALL_DIR=$TOOL/install source $INSTALL_DIR/setup cd $ABACUS_DIR ABACUS_DIR=$(pwd) -#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocc/ # user should specify this parameter +#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocl/ # user should specify this parameter BUILD_DIR=build_abacus_aocl rm -rf $BUILD_DIR diff --git a/toolchain/build_abacus_gnu-aocl.sh b/toolchain/build_abacus_gcc-aocl.sh similarity index 95% rename from toolchain/build_abacus_gnu-aocl.sh rename to toolchain/build_abacus_gcc-aocl.sh index b90eb77d5a..acf5942143 100755 --- a/toolchain/build_abacus_gnu-aocl.sh +++ b/toolchain/build_abacus_gcc-aocl.sh @@ -16,7 +16,7 @@ INSTALL_DIR=$TOOL/install source $INSTALL_DIR/setup cd $ABACUS_DIR ABACUS_DIR=$(pwd) -#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocc/ # user should specify this parameter +#AOCLhome=/opt/aocl-linux-aocc-5.0.0/5.0.0/aocl/ # user should specify this parameter BUILD_DIR=build_abacus_aocl rm -rf $BUILD_DIR @@ -36,8 +36,6 @@ FFTW3=$AOCLhome # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd # v3.0 might have problem -# if clang++ have problem, switch back to g++ - cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_CXX_COMPILER=g++ \ -DMPI_CXX_COMPILER=mpicxx \ diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index 8112aa9d82..92dad2a761 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -891,7 +891,7 @@ To build ABACUS by gnu-toolchain, just use: 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_gnu-aocl.sh + ./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. diff --git a/toolchain/toolchain_aocc-aocl.sh b/toolchain/toolchain_aocc-aocl.sh index 797f7c67ea..ca3e2e4759 100755 --- a/toolchain/toolchain_aocc-aocl.sh +++ b/toolchain/toolchain_aocc-aocl.sh @@ -5,13 +5,13 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-09-16 -# install abacus dependency by gnu-toolchain -# one can use mpich or openmpi. -# openmpi will be faster, but not compatible in some cases. +# JamesMisaka in 2025-05-05 +# install abacus dependency by aocc-aocl toolchain +# openmpi is recommended to use # libtorch and libnpy are for deepks support, which can be =no # if you want to run EXX calculation, you should set --with-libri=install -# mpich (and intel toolchain) is recommended for EXX support +# gpu-lcao supporting modify: CUDA_PATH and --enable-cuda +# export CUDA_PATH=/usr/local/cuda ./install_abacus_toolchain.sh \ --with-amd=system \ diff --git a/toolchain/toolchain_gcc-aocl.sh b/toolchain/toolchain_gcc-aocl.sh index aa2d5fbb56..f7b717b257 100755 --- a/toolchain/toolchain_gcc-aocl.sh +++ b/toolchain/toolchain_gcc-aocl.sh @@ -5,13 +5,14 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-09-16 -# install abacus dependency by gnu-toolchain -# one can use mpich or openmpi. -# openmpi will be faster, but not compatible in some cases. +# JamesMisaka in 2025-05-05 +# install abacus dependency by gcc-aocl toolchain +# openmpi is recommended to use # libtorch and libnpy are for deepks support, which can be =no # if you want to run EXX calculation, you should set --with-libri=install -# mpich (and intel toolchain) is recommended for EXX support + +# gpu-lcao supporting modify: CUDA_PATH and --enable-cuda +# export CUDA_PATH=/usr/local/cuda ./install_abacus_toolchain.sh \ --with-gcc=system \ diff --git a/toolchain/toolchain_gnu.sh b/toolchain/toolchain_gnu.sh index bea1ee0793..03e1c55440 100755 --- a/toolchain/toolchain_gnu.sh +++ b/toolchain/toolchain_gnu.sh @@ -5,13 +5,12 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-09-16 +# JamesMisaka in 2025-05-05 # install abacus dependency by gnu-toolchain -# one can use mpich or openmpi. -# openmpi will be faster, but not compatible in some cases. +# one can use mpich or openmpi. openmpi will be faster and less compatiable # libtorch and libnpy are for deepks support, which can be =no # if you want to run EXX calculation, you should set --with-libri=install -# mpich (and intel toolchain) is recommended for EXX support + # gpu-lcao supporting modify: CUDA_PATH and --enable-cuda # export CUDA_PATH=/usr/local/cuda diff --git a/toolchain/toolchain_intel.sh b/toolchain/toolchain_intel.sh index 4af7236896..54a73ae28c 100755 --- a/toolchain/toolchain_intel.sh +++ b/toolchain/toolchain_intel.sh @@ -5,14 +5,16 @@ #SBATCH -o compile.log #SBATCH -e compile.err -# JamesMisaka in 2023-08-31 +# JamesMisaka in 2025-05-05 # install abacus dependency by intel-toolchain # use mkl and intelmpi # but mpich and openmpi can also be tried # libtorch and libnpy are for deepks support, which can be =no +# gpu-lcao supporting modify: CUDA_PATH and --enable-cuda +# export CUDA_PATH=/usr/local/cuda # module load mkl mpi compiler -export CUDA_PATH=/usr/local/cuda + ./install_abacus_toolchain.sh \ --with-intel=system \ --math-mode=mkl \ From 4bbc200156cb400f62f7456ef5f3e97d04777837 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Tue, 6 May 2025 15:21:15 +0800 Subject: [PATCH 28/29] fix aocl linking bug --- toolchain/scripts/stage2/install_aocl.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolchain/scripts/stage2/install_aocl.sh b/toolchain/scripts/stage2/install_aocl.sh index 83d6d125b3..d3f0d70dd5 100755 --- a/toolchain/scripts/stage2/install_aocl.sh +++ b/toolchain/scripts/stage2/install_aocl.sh @@ -49,7 +49,7 @@ case "${with_aocl}" in *) echo "==================== Linking AOCL to user paths ====================" - pkg_install_dir="$with_openblas" + pkg_install_dir="$with_aocl" check_dir "${pkg_install_dir}/include" check_dir "${pkg_install_dir}/lib" AOCL_CFLAGS="-I'${pkg_install_dir}/include'" @@ -57,8 +57,8 @@ case "${with_aocl}" in AOCL_LIBS="-lblis -lflame" ;; esac -if [ "$with_openblas" != "__DONTUSE__" ]; then - if [ "$with_openblas" != "__SYSTEM__" ]; then +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" @@ -76,7 +76,7 @@ export AOCL_ROOT=${pkg_install_dir} EOF cat "${BUILDDIR}/setup_aocl" >> $SETUPFILE fi - cat << EOF >> "${BUILDDIR}/setup_aocl" +cat << EOF >> "${BUILDDIR}/setup_aocl" export AOCL_ROOT="${pkg_install_dir}" export AOCL_CFLAGS="${AOCL_CFLAGS}" export AOCL_LDFLAGS="${AOCL_LDFLAGS}" From 761b1a9ac350646b83dbd1786ad1f169789a6b81 Mon Sep 17 00:00:00 2001 From: JamesMisaka Date: Wed, 7 May 2025 16:22:28 +0800 Subject: [PATCH 29/29] elpa-gpu modify --- toolchain/README.md | 24 +++++++++++++++++++++++- toolchain/scripts/stage3/install_elpa.sh | 3 +-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index 3d1f4fd964..feae610a78 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -243,7 +243,29 @@ then just build the abacus executable program by compiling it with `./build_abac The ELPA method need more parameter setting, but it doesn't seem to be affected by the CUDA toolkits version, and it is no need to manually install and package. -2. For the cusolvermp method, toolchain_*.sh does not need to be changed, just follow it directly install dependencies using `./toolchain_*.sh`, and then add +Note: ELPA-2025.01.001 may have problem in nvidia-GPU compilation on some V100-GPU with AMD-CPU machine, error message: +```bash + 1872 | static __forceinline void CONCAT_8ARGS(hh_trafo_complex_kernel_,ROW_LENGTH,_,SIMD_SET,_,BLOCK,hv_,WORD_LENGTH) (DATA_TYPE_PTR q, DATA_TYPE_PTR hh, int nb, int ldq + | ^~~~~~~~~~~~~~~~~~~~~~~~ +../src/elpa2/kernels/complex_128bit_256bit_512bit_BLOCK_template.c:51:47: note: in definition of macro 'CONCAT2_8ARGS' + 51 | #define CONCAT2_8ARGS(a, b, c, d, e, f, g, h) a ## b ## c ## d ## e ## f ## g ## h + | ^ +../src/elpa2/kernels/complex_128bit_256bit_512bit_BLOCK_template.c:1872:27: note: in expansion of macro 'CONCAT_8ARGS' + 1872 | static __forceinline void CONCAT_8ARGS(hh_trafo_complex_kernel_,ROW_LENGTH,_,SIMD_SET,_,BLOCK,hv_,WORD_LENGTH) (DATA_TYPE_PTR q, DATA_TYPE_PTR hh, int nb, int ldq + | ^~~~~~~~~~~~ + PPFC src/GPU/libelpa_openmp_private_la-mod_vendor_agnostic_general_layer.lo + PPFC test/shared/GPU/libelpatest_openmp_la-test_gpu_vendor_agnostic_layer.lo +../src/GPU/CUDA/./cudaFunctions_template.h(942): error: identifier "creal" is undefined + double alpha_real = creal(alpha); + ^ + +../src/GPU/CUDA/./cudaFunctions_template.h(960): error: identifier "creal" is undefined + float alpha_real = creal(alpha); +``` + +And you may need to change ELPA version to 2024.05.001, edit `toolchain/scripts/stage3/install_elpa.sh` to do it. + +1. For the cusolvermp method, toolchain_*.sh does not need to be changed, just follow it directly install dependencies using `./toolchain_*.sh`, and then add ```shell -DUSE_CUDA=ON \ -DENABLE_CUSOLVERMP=ON \ diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 8d930ffc8e..56bd30c966 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -12,6 +12,7 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" # From https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html # elpa_ver="2024.05.001" # elpa_sha256="9caf41a3e600e2f6f4ce1931bd54185179dade9c171556d0c9b41bbc6940f2f6" +# newer version of elpa may have problem in GPU-ELPA compliation elpa_ver="2025.01.001" elpa_sha256="3ef0c6aed9a3e05db6efafe6e14d66eb88b2a1354d61e765b7cde0d3d5f3951e" @@ -123,7 +124,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") \ - CUDA_CFLAGS="-std=c++14 -allow-unsupported-compiler" \ OMPI_MCA_plm_rsh_agent=/bin/false \ FC=${MPIFC} \ CC=${MPICC} \ @@ -153,7 +153,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") \ - CUDA_CFLAGS="-std=c++14 -allow-unsupported-compiler" \ FC=${MPIFC} \ CC=${MPICC} \ CXX=${MPICXX} \