From 7ccf053a93538527859ce3a8f39920396783e9dc Mon Sep 17 00:00:00 2001 From: apple Date: Sat, 10 Aug 2024 20:32:21 +0800 Subject: [PATCH 01/14] basic toolchain update - remove ACML support - update dependence version - try to update scalapack for gcc-14 - tag libri 0.2.0 - enable rapidjson in build scripts (but not as default) --- toolchain/build_abacus_gnu.sh | 8 +- toolchain/build_abacus_intel-mpich.sh | 21 ++--- toolchain/build_abacus_intel.sh | 5 +- toolchain/install_abacus_toolchain.sh | 2 - toolchain/scripts/get_openblas_arch.sh | 6 +- toolchain/scripts/stage0/install_cmake.sh | 8 +- toolchain/scripts/stage0/install_gcc.sh | 8 +- toolchain/scripts/stage0/install_intel.sh | 4 +- toolchain/scripts/stage1/install_openmpi.sh | 6 +- toolchain/scripts/stage2/install_acml.sh | 76 ------------------- toolchain/scripts/stage2/install_mathlibs.sh | 6 +- toolchain/scripts/stage2/install_openblas.sh | 6 +- toolchain/scripts/stage3/install_elpa.sh | 14 ++-- toolchain/scripts/stage3/install_scalapack.sh | 3 + toolchain/scripts/stage4/install_libri.sh | 2 +- 15 files changed, 50 insertions(+), 125 deletions(-) delete mode 100755 toolchain/scripts/stage2/install_acml.sh diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 724131bc23..0d26c2d09e 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -22,12 +22,13 @@ BUILD_DIR=build_abacus_gnu rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -LAPACK=$INSTALL_DIR/openblas-0.3.25/lib +LAPACK=$INSTALL_DIR/openblas-0.3.27/lib SCALAPACK=$INSTALL_DIR/scalapack-2.2.1/lib -ELPA=$INSTALL_DIR/elpa-2023.05.001/cpu +ELPA=$INSTALL_DIR/elpa-2024.03.001/cpu FFTW3=$INSTALL_DIR/fftw-3.3.10 CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 +# RAPIDJSON=$INSTALL_DIR/rapidjson-1.2.2 # LIBRI=$INSTALL_DIR/LibRI-0.1.1 # LIBCOMM=$INSTALL_DIR/LibComm-0.1.0 # LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch @@ -47,6 +48,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DENABLE_LIBXC=ON \ -DUSE_OPENMP=ON \ -DUSE_ELPA=ON \ + -DENABLE_RAPIDJSON=ON \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -55,7 +57,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ # -DTensorFlow_DIR=$DEEPMD \ -# -DENABLE_RAPIDJSON=ON \ + # # 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-mpich.sh b/toolchain/build_abacus_intel-mpich.sh index 6eb476c215..7c0ed0a065 100755 --- a/toolchain/build_abacus_intel-mpich.sh +++ b/toolchain/build_abacus_intel-mpich.sh @@ -23,7 +23,7 @@ BUILD_DIR=build_abacus_intel-mpich rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2023.05.001/cpu +ELPA=$INSTALL_DIR/elpa-2024.03.001/cpu CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 # LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch @@ -43,15 +43,16 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DENABLE_LIBXC=ON \ -DUSE_OPENMP=ON \ -DUSE_ELPA=ON \ - # -DENABLE_DEEPKS=1 \ - # -DTorch_DIR=$LIBTORCH \ - # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ - # -DENABLE_LIBRI=ON \ - # -DLIBRI_DIR=$LIBRI \ - # -DLIBCOMM_DIR=$LIBCOMM \ - # -DDeePMD_DIR=$DEEPMD \ - # -DTensorFlow_DIR=$DEEPMD \ -# -DENABLE_RAPIDJSON=ON \ + -DENABLE_RAPIDJSON=ON \ +# -DENABLE_DEEPKS=1 \ +# -DTorch_DIR=$LIBTORCH \ +# -Dlibnpy_INCLUDE_DIR=$LIBNPY \ +# -DENABLE_LIBRI=ON \ +# -DLIBRI_DIR=$LIBRI \ +# -DLIBCOMM_DIR=$LIBCOMM \ +# -DDeePMD_DIR=$DEEPMD \ +# -DTensorFlow_DIR=$DEEPMD \ + # if one want's to include deepmd, your gcc version should be >= 11.3.0 diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index 4dde3bcce2..c4ed8aa9c8 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -23,7 +23,7 @@ BUILD_DIR=build_abacus_intel rm -rf $BUILD_DIR PREFIX=$ABACUS_DIR -ELPA=$INSTALL_DIR/elpa-2023.05.001/cpu +ELPA=$INSTALL_DIR/elpa-2024.03.001/cpu CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 # LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch @@ -44,6 +44,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DENABLE_LIBXC=ON \ -DUSE_OPENMP=ON \ -DUSE_ELPA=ON \ + -DENABLE_RAPIDJSON=ON \ # -DENABLE_DEEPKS=1 \ # -DTorch_DIR=$LIBTORCH \ # -Dlibnpy_INCLUDE_DIR=$LIBNPY \ @@ -52,7 +53,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \ # -DLIBCOMM_DIR=$LIBCOMM \ # -DDeePMD_DIR=$DEEPMD \ # -DTensorFlow_DIR=$DEEPMD \ -# -DENABLE_RAPIDJSON=ON \ + cmake --build $BUILD_DIR -j `nproc` cmake --install $BUILD_DIR 2>/dev/null diff --git a/toolchain/install_abacus_toolchain.sh b/toolchain/install_abacus_toolchain.sh index e0d35eb06c..23c88a8b59 100755 --- a/toolchain/install_abacus_toolchain.sh +++ b/toolchain/install_abacus_toolchain.sh @@ -171,8 +171,6 @@ The --with-PKG options follow the rules: Default = install --with-fftw FFTW3, library for fast fourier transform Default = install - --with-acml AMD core maths library, which provides LAPACK and BLAS - Default = system --with-mkl Intel Math Kernel Library, which provides LAPACK, and BLAS. If MKL's FFTW3 interface is suitable (no FFTW-MPI support), it replaces the FFTW library. If the ScaLAPACK component is diff --git a/toolchain/scripts/get_openblas_arch.sh b/toolchain/scripts/get_openblas_arch.sh index a07913bc34..70b492d576 100755 --- a/toolchain/scripts/get_openblas_arch.sh +++ b/toolchain/scripts/get_openblas_arch.sh @@ -3,13 +3,13 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2024-0219 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)" -openblas_ver="0.3.25" # Keep in sync with install_openblas.sh -openblas_sha256="4c25cb30c4bb23eddca05d7d0a85997b8db6144f5464ba7f8c09ce91e2f35543" +openblas_ver="0.3.27" # Keep in sync with install_openblas.sh +openblas_sha256="aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897" openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index 8523d35dcb..66d2595623 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 2024-0219 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" @@ -21,13 +21,13 @@ cd "${BUILDDIR}" case "${with_cmake}" in __INSTALL__) echo "==================== Installing CMake ====================" - cmake_ver="3.28.1" + cmake_ver="3.30.0" if [ "${OPENBLAS_ARCH}" = "arm64" ]; then cmake_arch="linux-aarch64" - cmake_sha256="4ecba78ef9499a973d012a83feab5f888e86fc5388e9a768037ab4f7232cab16" + cmake_sha256="daa89552fd9102fb70399b31b5605c4f61125023bbbed947757a7b53ce36c4d0" elif [ "${OPENBLAS_ARCH}" = "x86_64" ]; then cmake_arch="linux-x86_64" - cmake_sha256="ada6a46be9da5f8cbeb00b9523ffe45ee6b36172eb81aaa5bdc6a2a8231b677c" + cmake_sha256="1a5969fe81fea6e5220d053d9d3e3754cbc85be07d2d428bebdcfe87137971a9" 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." diff --git a/toolchain/scripts/stage0/install_gcc.sh b/toolchain/scripts/stage0/install_gcc.sh index 43b9fc496a..397a3915f2 100755 --- a/toolchain/scripts/stage0/install_gcc.sh +++ b/toolchain/scripts/stage0/install_gcc.sh @@ -3,13 +3,13 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2023-1111 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -gcc_ver="13.2.0" -gcc_sha256="8cb4be3796651976f94b9356fa08d833524f62420d6292c5033a9a26af315078" +gcc_ver="14.1.0" +gcc_sha256="a0be066c02775002a0fa65ad3c65fb56a8bfd923d072a26ed148c0439ecdb68f" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh @@ -61,7 +61,7 @@ case "${with_gcc}" in # TODO: Unfortunately, we can not simply use --disable-shared, because # it would break OpenBLAS build and probably others too. COMMON_FLAGS="-O2 -fPIC -fno-omit-frame-pointer -fopenmp -g" - CFLAGS="${COMMON_FLAGS} -std=gnu99" + CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${CFLAGS}" FCFLAGS="${COMMON_FLAGS} -fbacktrace" ${GCCROOT}/configure --prefix="${pkg_install_dir}" \ diff --git a/toolchain/scripts/stage0/install_intel.sh b/toolchain/scripts/stage0/install_intel.sh index ed5e4c5f30..fce2984c64 100755 --- a/toolchain/scripts/stage0/install_intel.sh +++ b/toolchain/scripts/stage0/install_intel.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2023-0901 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=${0} SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_NAME}")/.." && pwd -P)" @@ -56,10 +56,10 @@ case "${with_intel}" in check_command ${pkg_install_dir}/bin/icpc "intel" && CXX="${pkg_install_dir}/bin/icpc" || exit 1 check_command ${pkg_install_dir}/bin/ifort "intel" && FC="${pkg_install_dir}/bin/ifort" || exit 1 else - # abacus do not need icx, the key is mkl check_command ${pkg_install_dir}/bin/icx "intel" && CC="${pkg_install_dir}/bin/icx" || exit 1 check_command ${pkg_install_dir}/bin/icpx "intel" && CXX="${pkg_install_dir}/bin/icpx" || exit 1 check_command ${pkg_install_dir}/bin/ifort "intel" && FC="${pkg_install_dir}/bin/ifort" || exit 1 + # is ifx needed ? fi F90="${FC}" F77="${FC}" diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index a99746f828..fffa9a4cec 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -3,13 +3,13 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2024-0219 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -openmpi_ver="5.0.0" -openmpi_sha256="9d845ca94bc1aeb445f83d98d238cd08f6ec7ad0f73b0f79ec1668dbfdacd613" +openmpi_ver="5.0.3" +openmpi_sha256="990582f206b3ab32e938aa31bbf07c639368e4405dca196fabe7f0f76eeda90b" openmpi_pkg="openmpi-${openmpi_ver}.tar.bz2" source "${SCRIPT_DIR}"/common_vars.sh diff --git a/toolchain/scripts/stage2/install_acml.sh b/toolchain/scripts/stage2/install_acml.sh deleted file mode 100755 index e9cb511162..0000000000 --- a/toolchain/scripts/stage2/install_acml.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -e - -# TODO: Review and if possible fix shellcheck errors. -# shellcheck disable=all - -# Last Update in 2023-0901 - -[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 -SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" - -source "${SCRIPT_DIR}"/common_vars.sh -source "${SCRIPT_DIR}"/tool_kit.sh -source "${SCRIPT_DIR}"/signal_trap.sh -source "${INSTALLDIR}"/toolchain.conf -source "${INSTALLDIR}"/toolchain.env - -[ -f "${BUILDDIR}/setup_acml" ] && rm "${BUILDDIR}/setup_acml" - -ACML_CFLAGS='' -ACML_LDFLAGS='' -ACML_LIBS='' -! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}" -cd "${BUILDDIR}" - -case "$with_acml" in - __INSTALL__) - echo "==================== Installing ACML ====================" - report_error $LINENO "To install ACML you should either contact your system administrator or go to https://developer.amd.com/tools-and-sdks/archive/amd-core-math-library-acml/acml-downloads-resources/ and download the correct version for your system." - exit 1 - ;; - __SYSTEM__) - echo "==================== Finding ACML from system paths ====================" - check_lib -lacml "ACML" - add_include_from_paths ACML_CFLAGS "acml.h" $INCLUDE_PATHS - add_lib_from_paths ACML_LDFLAGS "libacml.*" $LIB_PATHS - ;; - __DONTUSE__) ;; - - *) - echo "==================== Linking ACML to user paths ====================" - pkg_install_dir="$with_acml" - check_dir "${pkg_install_dir}/lib" - ACML_CFLAGS="-I'${pkg_install_dir}/include'" - ACML_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'" - ;; -esac -if [ "$with_acml" != "__DONTUSE__" ]; then - ACML_LIBS="-lacml" - if [ "$with_acml" != "__SYSTEM__" ]; then - cat << EOF > "${BUILDDIR}/setup_acml" -prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path LD_RUN_PATH "$pkg_install_dir/lib" -prepend_path LIBRARY_PATH "$pkg_install_dir/lib" -prepend_path CPATH "$pkg_install_dir/include" -export LD_LIBRARY_PATH="$pkg_install_dir/lib":\${LD_LIBRARY_PATH} -export LD_RUN_PATH="$pkg_install_dir/lib":\${LD_RUN_PATH} -export LIBRARY_PATH="$pkg_install_dir/lib":\${LIBRARY_PATH} -export CPATH="$pkg_install_dir/include":\${CPATH} -EOF - cat "${BUILDDIR}/setup_acml" >> $SETUPFILE - fi - cat << EOF >> "${BUILDDIR}/setup_acml" -export ACML_CFLAGS="${ACML_CFLAGS}" -export ACML_LDFLAGS="${ACML_LDFLAGS}" -export ACML_LIBS="${ACML_LIBS}" -export MATH_CFLAGS="\${MATH_CFLAGS} ${ACML_CFLAGS}" -export MATH_LDFLAGS="\${MATH_LDFLAGS} ${ACML_LDFLAGS}" -export MATH_LIBS="\${MATH_LIBS} ${ACML_LIBS}" -EOF -fi - -load "${BUILDDIR}/setup_acml" -write_toolchain_env "${INSTALLDIR}" - -cd "${ROOTDIR}" -report_timing "acml" diff --git a/toolchain/scripts/stage2/install_mathlibs.sh b/toolchain/scripts/stage2/install_mathlibs.sh index 79c7687404..ed78957882 100755 --- a/toolchain/scripts/stage2/install_mathlibs.sh +++ b/toolchain/scripts/stage2/install_mathlibs.sh @@ -3,7 +3,7 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2023-0901 +# Last Update in 2024-0810 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" @@ -25,10 +25,6 @@ case "$MATH_MODE" in "${SCRIPTDIR}"/stage2/install_mkl.sh "${with_mkl}" load "${BUILDDIR}/setup_mkl" ;; - acml) - "${SCRIPTDIR}"/stage2/install_acml.sh "${with_acml}" - load "${BUILDDIR}/setup_acml" - ;; openblas) "${SCRIPTDIR}"/stage2/install_openblas.sh "${with_openblas}" load "${BUILDDIR}/setup_openblas" diff --git a/toolchain/scripts/stage2/install_openblas.sh b/toolchain/scripts/stage2/install_openblas.sh index 50225fcb34..18039b2023 100755 --- a/toolchain/scripts/stage2/install_openblas.sh +++ b/toolchain/scripts/stage2/install_openblas.sh @@ -3,13 +3,13 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2023-1111 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -openblas_ver="0.3.25" # Keep in sync with get_openblas_arch.sh -openblas_sha256="4c25cb30c4bb23eddca05d7d0a85997b8db6144f5464ba7f8c09ce91e2f35543" +openblas_ver="0.3.27" # Keep in sync with get_openblas_arch.sh +openblas_sha256="aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897" openblas_pkg="OpenBLAS-${openblas_ver}.tar.gz" source "${SCRIPT_DIR}"/common_vars.sh diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 41db352ad2..8bd4d018db 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -3,14 +3,14 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all -# Last Update in 2024-0219 +# Last Update in 2024-0811 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" # From https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html -elpa_ver="2023.05.001" -elpa_sha256="ec64be5d6522810d601a3b8e6a31720e3c3eb4af33a434d8a64570d76e6462b6" +elpa_ver="2024.03.001" +elpa_sha256="41c6cbf56d2dac26443faaba8a77307d261bf511682a64b96e24def77c813622" source "${SCRIPT_DIR}"/common_vars.sh @@ -52,7 +52,7 @@ case "$with_elpa" in # extra LDFLAGS needed cray_ldflags="-dynamic" fi - enable_openmp="no" + # enable_openmp="no" fi if verify_checksums "${install_lock_file}"; then @@ -76,7 +76,7 @@ case "$with_elpa" in AVX512_flags="" FMA_flag="" SSE4_flag="" - config_flags="--disable-avx --disable-avx2 --disable-avx512 --disable-sse --disable-sse-assembly" + config_flags="--disable-avx-kernels --disable-avx2-kernels --disable-avx512-kernels --disable-sse-kernels --disable-sse-assembly-kernels" if [ "${TARGET_CPU}" = "native" ]; then if [ -f /proc/cpuinfo ] && [ "${OPENBLAS_ARCH}" = "x86_64" ]; then has_AVX=$(grep '\bavx\b' /proc/cpuinfo 1> /dev/null && echo 'yes' || echo 'no') @@ -91,7 +91,7 @@ case "$with_elpa" in grep '\bavx512cd\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512cd" grep '\bavx512bw\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512bw" grep '\bavx512vl\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512vl" - config_flags="--enable-avx=${has_AVX} --enable-avx2=${has_AVX2} --enable-avx512=${has_AVX512}" + config_flags="--enable-avx-kernels=${has_AVX} --enable-avx2-kernels=${has_AVX2} --enable-avx512-kernels=${has_AVX512}" fi fi for TARGET in "cpu" "nvidia"; do @@ -120,7 +120,7 @@ case "$with_elpa" in FCFLAGS="${FCFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} -ffree-line-length-none ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags} -fno-lto" \ CFLAGS="${CFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags} -fno-lto" \ CXXFLAGS="${CXXFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags} -fno-lto" \ - LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-new-dtags ${MATH_LDFLAGS} ${SCALAPACK_LDFLAGS} ${cray_ldflags}" \ + LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-new-dtags ${MATH_LDFLAGS} ${SCALAPACK_LDFLAGS} ${cray_ldflags}" "-lstdc++" \ LIBS="${SCALAPACK_LIBS} $(resolve_string "${MATH_LIBS}" "MPI")" \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index 2dc0ce0d87..d7030526b6 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -52,13 +52,16 @@ case "$with_scalapack" in if ("${FC}" --version | grep -q 'GNU'); then flags=$(allowed_gfortran_flags "-fallow-argument-mismatch") fi + # modified by @YuugataShinonome for GCC 14 FFLAGS=$flags cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \ -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \ -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBUILD_SHARED_LIBS=YES \ -DCMAKE_BUILD_TYPE=Release .. \ -DBUILD_TESTING=NO \ -DSCALAPACK_BUILD_TESTS=NO \ + -D > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log make install >> make.log 2>&1 || tail -n ${LOG_LINES} make.log diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index d33fe3068f..1ca3f49be4 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -11,7 +11,7 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -libri_ver="0.1.1" +libri_ver="0.1.1" # libri 0.2 is not ready ? libri_sha256="51deb08aa373e54d2c123b57bfd4b3507accac0d496a94b766eaeadccd9e4bd0" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh From 92695e974f3fded5d6045417cf13d7be1076014e Mon Sep 17 00:00:00 2001 From: apple Date: Sat, 10 Aug 2024 20:37:49 +0800 Subject: [PATCH 02/14] Update README.md --- toolchain/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index cf2d4830f2..ac7be366bb 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -19,7 +19,7 @@ and give setup files that you can use to compile ABACUS. ## Todo - [x] `gnu-openblas` toolchain support for `openmpi` and `mpich`. -- [x] `intel-mkl-mpi` toolchain support using `icc` or `icx`. (`icx` version of ABACUS have some problem now, please be cautious) +- [x] `intel-mkl-mpi` toolchain support using `icc`/`icpc`/`ifort` or `icx`/`icpx`/`ifort`. (`icx` as default, but will have problem for ELPA in AMD machine, one can specify `--with-intel-classic=yes` to use `icc`), - [x] `intel-mkl-mpich` toolchain support. - [x] Automatic installation of [CEREAL](https://github.com/USCiLab/cereal) and [LIBNPY](https://github.com/llohse/libnpy) (by github.com) - [x] Support for [LibRI](https://github.com/abacusmodeling/LibRI) by submodule or automatic installation from github.com (but installed LibRI via `wget` seems to have some problem, please be cautious) @@ -82,7 +82,7 @@ wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps-v2.zip 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-4.1.5.tar.gz*, +like *fftw-3.3.10.tar.gz*, or *openmpi-5.0.3.tar.gz*, 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 @@ -97,14 +97,14 @@ just by using this toolchain The needed dependencies version default: - `cmake` 3.28.1 -- `gcc` 13.2.0 (which will always NOT be installed, But use system) -- `OpenMPI` 5.0.0 +- `gcc` 14.1.0 (which will always NOT be installed, But use system) +- `OpenMPI` 5.0.3 - `MPICH` 4.1.2 -- `OpenBLAS` 0.3.25 (Intel toolchain need `get_vars.sh` tool from it) +- `OpenBLAS` 0.3.27 (Intel toolchain need `get_vars.sh` tool from it) - `ScaLAPACK` 2.2.1 - `FFTW` 3.3.10 - `LibXC` 6.2.2 -- `ELPA` 2023.05.001 +- `ELPA` 2024.03.001 - `CEREAL` 1.3.2 - `RapidJSON` 1.1.0 And Intel-oneAPI need user or server manager to manually install from Intel. From 2af8d4aa754cc73fb661fd157163de6410d3b223 Mon Sep 17 00:00:00 2001 From: apple Date: Sat, 10 Aug 2024 21:01:43 +0800 Subject: [PATCH 03/14] Version 2024.2 tag --- toolchain/README.md | 2 +- toolchain/scripts/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index ac7be366bb..b58f0b0289 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -1,5 +1,5 @@ # The ABACUS Toolchain -Version 2024.1 +Version 2024.2 ## Author [QuantumMisaka](https://github.com/QuantumMisaka) diff --git a/toolchain/scripts/VERSION b/toolchain/scripts/VERSION index 810524d3d4..a6faad3be8 100644 --- a/toolchain/scripts/VERSION +++ b/toolchain/scripts/VERSION @@ -1,2 +1,2 @@ # version file to force a rebuild of the entire toolchain -VERSION="2024.1" +VERSION="2024.2" From 429b0b369378d1d218849c6e0d67a7b41db2d245 Mon Sep 17 00:00:00 2001 From: apple Date: Sun, 11 Aug 2024 11:10:52 +0800 Subject: [PATCH 04/14] Update install_elpa.sh --- toolchain/scripts/stage3/install_elpa.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/scripts/stage3/install_elpa.sh b/toolchain/scripts/stage3/install_elpa.sh index 8bd4d018db..24756c43b7 100755 --- a/toolchain/scripts/stage3/install_elpa.sh +++ b/toolchain/scripts/stage3/install_elpa.sh @@ -120,7 +120,7 @@ case "$with_elpa" in FCFLAGS="${FCFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} -ffree-line-length-none ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags} -fno-lto" \ CFLAGS="${CFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags} -fno-lto" \ CXXFLAGS="${CXXFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags} -fno-lto" \ - LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-new-dtags ${MATH_LDFLAGS} ${SCALAPACK_LDFLAGS} ${cray_ldflags}" "-lstdc++" \ + LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-new-dtags ${MATH_LDFLAGS} ${SCALAPACK_LDFLAGS} ${cray_ldflags}" \ LIBS="${SCALAPACK_LIBS} $(resolve_string "${MATH_LIBS}" "MPI")" \ > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log From c83b3ef5505f318c57fee84630d11fa2bd52aeed Mon Sep 17 00:00:00 2001 From: apple Date: Sun, 11 Aug 2024 11:26:27 +0800 Subject: [PATCH 05/14] enable rapidjson as default in toolchain usage --- toolchain/toolchain_gnu.sh | 2 +- toolchain/toolchain_intel-mpich.sh | 2 +- toolchain/toolchain_intel.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolchain/toolchain_gnu.sh b/toolchain/toolchain_gnu.sh index e24c492391..04635bb63d 100755 --- a/toolchain/toolchain_gnu.sh +++ b/toolchain/toolchain_gnu.sh @@ -18,7 +18,7 @@ --with-fftw=install \ --with-elpa=install \ --with-cereal=install \ ---with-rapidjson=no \ +--with-rapidjson=install \ --with-libtorch=no \ --with-libnpy=no \ --with-libri=no \ diff --git a/toolchain/toolchain_intel-mpich.sh b/toolchain/toolchain_intel-mpich.sh index 99b4bc54d4..059ef541dd 100755 --- a/toolchain/toolchain_intel-mpich.sh +++ b/toolchain/toolchain_intel-mpich.sh @@ -21,7 +21,7 @@ --with-fftw=no \ --with-elpa=install \ --with-cereal=install \ ---with-rapidjson=no \ +--with-rapidjson=install \ --with-libtorch=no \ --with-libnpy=no \ --with-libri=no \ diff --git a/toolchain/toolchain_intel.sh b/toolchain/toolchain_intel.sh index d6ad383545..e5298c570d 100755 --- a/toolchain/toolchain_intel.sh +++ b/toolchain/toolchain_intel.sh @@ -22,7 +22,7 @@ --with-fftw=no \ --with-elpa=install \ --with-cereal=install \ ---with-rapidjson=no \ +--with-rapidjson=install \ --with-libtorch=no \ --with-libnpy=no \ --with-libri=no \ From ba04a992d65e51d8e8f2e0b39d0ecda4f7bfd0c5 Mon Sep 17 00:00:00 2001 From: apple Date: Sun, 11 Aug 2024 13:08:00 +0800 Subject: [PATCH 06/14] fix #4601 for scalapack --- toolchain/scripts/stage3/install_scalapack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/scripts/stage3/install_scalapack.sh b/toolchain/scripts/stage3/install_scalapack.sh index d7030526b6..748f6882ba 100755 --- a/toolchain/scripts/stage3/install_scalapack.sh +++ b/toolchain/scripts/stage3/install_scalapack.sh @@ -59,9 +59,9 @@ case "$with_scalapack" in -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 \ - -D > configure.log 2>&1 || tail -n ${LOG_LINES} configure.log make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log make install >> make.log 2>&1 || tail -n ${LOG_LINES} make.log From b1879b42c27332082de1b01266cd5cfc40a02c46 Mon Sep 17 00:00:00 2001 From: apple Date: Sun, 11 Aug 2024 13:08:15 +0800 Subject: [PATCH 07/14] modify export --- toolchain/scripts/stage0/install_cmake.sh | 2 +- toolchain/scripts/stage4/install_cereal.sh | 2 +- toolchain/scripts/stage4/install_rapidjson.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolchain/scripts/stage0/install_cmake.sh b/toolchain/scripts/stage0/install_cmake.sh index 66d2595623..a76472901b 100755 --- a/toolchain/scripts/stage0/install_cmake.sh +++ b/toolchain/scripts/stage0/install_cmake.sh @@ -67,7 +67,7 @@ if [ "${with_cmake}" != "__DONTUSE__" ]; then if [ "${with_cmake}" != "__SYSTEM__" ]; then cat << EOF > "${BUILDDIR}/setup_cmake" prepend_path PATH "${pkg_install_dir}/bin" -export PATH="${pkg_install_dir}/bin:":\${PATH} +export PATH="${pkg_install_dir}/bin":\${PATH} EOF cat "${BUILDDIR}/setup_cmake" >> $SETUPFILE fi diff --git a/toolchain/scripts/stage4/install_cereal.sh b/toolchain/scripts/stage4/install_cereal.sh index 540743ce92..27f8234452 100755 --- a/toolchain/scripts/stage4/install_cereal.sh +++ b/toolchain/scripts/stage4/install_cereal.sh @@ -78,7 +78,7 @@ if [ "$with_cereal" != "__DONTUSE__" ]; then # LibRI deps should find cereal include in CPATH cat << EOF > "${BUILDDIR}/setup_cereal" prepend_path CPATH "$pkg_install_dir/include" -export CPATH="${pkg_install_dir}/include:"\${CPATH} +export CPATH="${pkg_install_dir}/include":\${CPATH} EOF cat "${BUILDDIR}/setup_cereal" >> $SETUPFILE fi diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 0f02538ff3..8cfe278085 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -78,7 +78,7 @@ if [ "$with_rapidjson" != "__DONTUSE__" ]; then # LibRI deps should find rapidjson include in CPATH cat << EOF > "${BUILDDIR}/setup_rapidjson" prepend_path CPATH "$pkg_install_dir/include" -export CPATH="${pkg_install_dir}/include:"\${CPATH} +export CPATH="${pkg_install_dir}/include":\${CPATH} EOF cat "${BUILDDIR}/setup_rapidjson" >> $SETUPFILE fi From 36bae4aebcf18c8494f48ebc60640cf2ff3cd33b Mon Sep 17 00:00:00 2001 From: apple Date: Sun, 11 Aug 2024 14:24:25 +0800 Subject: [PATCH 08/14] reverse gcc default version to 13.2.0 --- toolchain/scripts/stage0/install_gcc.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/toolchain/scripts/stage0/install_gcc.sh b/toolchain/scripts/stage0/install_gcc.sh index 397a3915f2..cdbfffbd26 100755 --- a/toolchain/scripts/stage0/install_gcc.sh +++ b/toolchain/scripts/stage0/install_gcc.sh @@ -7,9 +7,12 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" - -gcc_ver="14.1.0" -gcc_sha256="a0be066c02775002a0fa65ad3c65fb56a8bfd923d072a26ed148c0439ecdb68f" +# gcc 13 is good +gcc_ver="13.2.0" +gcc_sha256="8cb4be3796651976f94b9356fa08d833524f62420d6292c5033a9a26af315078" +# use gcc 14 with caution +#gcc_ver="14.1.0" +#gcc_sha256="a0be066c02775002a0fa65ad3c65fb56a8bfd923d072a26ed148c0439ecdb68f" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh From 9b1534e371fbbef49354980a1dd6c9b292967125 Mon Sep 17 00:00:00 2001 From: apple Date: Sun, 11 Aug 2024 14:24:38 +0800 Subject: [PATCH 09/14] remove redundant option --- toolchain/build_abacus_gnu.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 0d26c2d09e..9957c014e0 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -28,7 +28,6 @@ ELPA=$INSTALL_DIR/elpa-2024.03.001/cpu FFTW3=$INSTALL_DIR/fftw-3.3.10 CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 -# RAPIDJSON=$INSTALL_DIR/rapidjson-1.2.2 # LIBRI=$INSTALL_DIR/LibRI-0.1.1 # LIBCOMM=$INSTALL_DIR/LibComm-0.1.0 # LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch From 7e049b5cb3001d36a94ed75551196b7fa4c7bbc3 Mon Sep 17 00:00:00 2001 From: apple Date: Mon, 12 Aug 2024 12:15:06 +0800 Subject: [PATCH 10/14] update libtorch version and downloading --- toolchain/build_abacus_gnu.sh | 2 +- toolchain/build_abacus_intel-mpich.sh | 2 +- toolchain/build_abacus_intel.sh | 2 +- toolchain/scripts/stage4/install_libcomm.sh | 4 +- toolchain/scripts/stage4/install_libtorch.sh | 62 ++++++++++++-------- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/toolchain/build_abacus_gnu.sh b/toolchain/build_abacus_gnu.sh index 9957c014e0..4ae7490a38 100755 --- a/toolchain/build_abacus_gnu.sh +++ b/toolchain/build_abacus_gnu.sh @@ -30,7 +30,7 @@ CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 # LIBRI=$INSTALL_DIR/LibRI-0.1.1 # LIBCOMM=$INSTALL_DIR/LibComm-0.1.0 -# LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # DEEPMD=$HOME/apps/anaconda3/envs/deepmd diff --git a/toolchain/build_abacus_intel-mpich.sh b/toolchain/build_abacus_intel-mpich.sh index 7c0ed0a065..7f42579d06 100755 --- a/toolchain/build_abacus_intel-mpich.sh +++ b/toolchain/build_abacus_intel-mpich.sh @@ -26,7 +26,7 @@ PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2024.03.001/cpu CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 -# LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # LIBRI=$INSTALL_DIR/LibRI-0.1.1 # LIBCOMM=$INSTALL_DIR/LibComm-0.1.0 diff --git a/toolchain/build_abacus_intel.sh b/toolchain/build_abacus_intel.sh index c4ed8aa9c8..6ad3c89e76 100755 --- a/toolchain/build_abacus_intel.sh +++ b/toolchain/build_abacus_intel.sh @@ -26,7 +26,7 @@ PREFIX=$ABACUS_DIR ELPA=$INSTALL_DIR/elpa-2024.03.001/cpu CEREAL=$INSTALL_DIR/cereal-1.3.2/include/cereal LIBXC=$INSTALL_DIR/libxc-6.2.2 -# LIBTORCH=$INSTALL_DIR/libtorch-2.0.1/share/cmake/Torch +# LIBTORCH=$INSTALL_DIR/libtorch-2.1.2/share/cmake/Torch # LIBNPY=$INSTALL_DIR/libnpy-1.0.1/include # LIBRI=$INSTALL_DIR/LibRI-0.1.1 # LIBCOMM=$INSTALL_DIR/LibComm-0.1.0 diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 90cecb9c16..6e1a30e973 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -47,8 +47,8 @@ case "$with_libcomm" in report_error "failed to download $url" recommend_offline_installation $filename $url fi - # checksum - checksum "$filename" "$libcomm_sha256" + # checksum + checksum "$filename" "$libcomm_sha256" fi echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname diff --git a/toolchain/scripts/stage4/install_libtorch.sh b/toolchain/scripts/stage4/install_libtorch.sh index e890e14958..444dd3a40b 100755 --- a/toolchain/scripts/stage4/install_libtorch.sh +++ b/toolchain/scripts/stage4/install_libtorch.sh @@ -4,17 +4,22 @@ # shellcheck disable=all -# Last Update in 2023-0908 +# Last Update in 2024-0812 [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" # From https://pytorch.org/get-started/locally/ -#libtorch_ver="1.12.1" # stable version -#libtorch_sha256="82c7be80860f2aa7963f8700004a40af8205e1d721298f2e09b700e766a9d283" -libtorch_ver="2.0.1" # newest, -# 2.0.1 libtorch will lead to lots of warning during build process in intel toolchain -libtorch_sha256="137a842d1cf1e9196b419390133a1623ef92f8f84dc7a072f95ada684f394afd" +# libtorch_ver="1.12.1" +# libtorch_sha256="82c7be80860f2aa7963f8700004a40af8205e1d721298f2e09b700e766a9d283" +# libtorch_ver="2.0.1" +# libtorch_sha256="137a842d1cf1e9196b419390133a1623ef92f8f84dc7a072f95ada684f394afd" +libtorch_ver="2.1.2" +libtorch_sha256="904b764df6106a8a35bef64c4b55b8c1590ad9d071eb276e680cf42abafe79e9" + +# user can manually download higher version of libtorch by: +# wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-{libtorch_ver}%2Bcpu.zip +# 2.4.0 latest, 2.1.2 recommended for lower GLIBC support (lower than 3.4.26) # shellcheck source=/dev/null source "${SCRIPT_DIR}"/common_vars.sh @@ -31,29 +36,40 @@ cd "${BUILDDIR}" case "${with_libtorch}" in __INSTALL__) echo "==================== Installing libtorch ====================" - pkg_install_dir="${INSTALLDIR}/libtorch-${libtorch_ver}" + dirname="libtorch-${libtorch_ver}" + filename="${dirname}.zip" + pkg_install_dir="${INSTALLDIR}/${filename}" #pkg_install_dir="${HOME}/lib/libtorch/${libtorch_ver}" install_lock_file="${pkg_install_dir}/install_successful" - archive_file="libtorch-cxx11-abi-shared-with-deps-${libtorch_ver}+cpu.zip" + archive_file="libtorch-cxx11-abi-shared-with-deps-${libtorch_ver}%2Bcpu.zip" if verify_checksums "${install_lock_file}"; then - echo "libtorch-${libtorch_ver} is already installed, skipping it." + echo "${filename} is already installed, skipping it." else - if [ -f ${archive_file} ]; then - echo "${archive_file} is found" - else - download_pkg_from_ABACUS_org "${libtorch_sha256}" "${archive_file}" - fi - - echo "Installing from scratch into ${pkg_install_dir}" - [ -d libtorch ] && rm -rf libtorch - [ -d ${pkg_install_dir} ] && rm -rf ${pkg_install_dir} - unzip -q ${archive_file} - mkdir -p "${pkg_install_dir}" - mv libtorch/* "${pkg_install_dir}" - - write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename "${SCRIPT_NAME}")" + if [ -f ${archive_file} ]; then + echo "${archive_file} is found" + else + # download_pkg_from_ABACUS_org "${libtorch_sha256}" "${archive_file}" + # download from pytorch.com and checksum + url=https://download.pytorch.org/libtorch/cpu/${archive_file} + echo "wget $url -O $filename" + if ! wget $url -O $filename; then + report_error "failed to download $url" + recommend_offline_installation $filename $url + fi + # checksum + checksum "$filename" "$libtorch_sha256" + fi + echo "Installing from scratch into ${pkg_install_dir}" + [ -d libtorch ] && rm -rf libtorch + [ -d ${pkg_install_dir} ] && rm -rf ${pkg_install_dir} + unzip -q $filename # to libtorch + mkdir -p "${pkg_install_dir}" + mv libtorch/* "${pkg_install_dir}/" + + write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})" fi + LIBTORCH_CXXFLAGS="-I${pkg_install_dir}/include" LIBTORCH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'" ;; From 31c3a90029996c1941a53811db4f45d102020082 Mon Sep 17 00:00:00 2001 From: apple Date: Mon, 12 Aug 2024 12:15:09 +0800 Subject: [PATCH 11/14] Update README.md --- toolchain/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolchain/README.md b/toolchain/README.md index b58f0b0289..391ae8bb2a 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -96,8 +96,8 @@ just by using this toolchain ``` The needed dependencies version default: -- `cmake` 3.28.1 -- `gcc` 14.1.0 (which will always NOT be installed, But use system) +- `cmake` 3.30.0 +- `gcc` 13.2.0 (which will always NOT be installed, But use system) - `OpenMPI` 5.0.3 - `MPICH` 4.1.2 - `OpenBLAS` 0.3.27 (Intel toolchain need `get_vars.sh` tool from it) @@ -111,7 +111,7 @@ 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) Dependencies below are optional, which is NOT installed by default: -- `LibTorch` 2.0.1 +- `LibTorch` 2.1.2 - `Libnpy` 1.0.1 - `LibRI` 0.1.1 - `LibComm` 0.1.0 From c9b2508d1e5d7807f69d6b519f99c6e5ad0e4deb Mon Sep 17 00:00:00 2001 From: apple Date: Mon, 12 Aug 2024 12:15:27 +0800 Subject: [PATCH 12/14] formatting --- toolchain/scripts/stage4/install_libnpy.sh | 4 ++-- toolchain/scripts/stage4/install_libri.sh | 4 ++-- toolchain/scripts/stage4/install_rapidjson.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/toolchain/scripts/stage4/install_libnpy.sh b/toolchain/scripts/stage4/install_libnpy.sh index 244c5aeb53..b06bee4d23 100755 --- a/toolchain/scripts/stage4/install_libnpy.sh +++ b/toolchain/scripts/stage4/install_libnpy.sh @@ -47,8 +47,8 @@ case "$with_libnpy" in report_error "failed to download $url" recommend_offline_installation $filename $url fi - # checksum - checksum "$filename" "$libnpy_sha256" + # checksum + checksum "$filename" "$libnpy_sha256" fi echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname diff --git a/toolchain/scripts/stage4/install_libri.sh b/toolchain/scripts/stage4/install_libri.sh index 1ca3f49be4..febf4b2daa 100755 --- a/toolchain/scripts/stage4/install_libri.sh +++ b/toolchain/scripts/stage4/install_libri.sh @@ -47,8 +47,8 @@ case "$with_libri" in report_error "failed to download $url" recommend_offline_installation $filename $url fi - # checksum - checksum "$filename" "$libri_sha256" + # checksum + checksum "$filename" "$libri_sha256" fi echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname diff --git a/toolchain/scripts/stage4/install_rapidjson.sh b/toolchain/scripts/stage4/install_rapidjson.sh index 8cfe278085..1cd2d0deee 100755 --- a/toolchain/scripts/stage4/install_rapidjson.sh +++ b/toolchain/scripts/stage4/install_rapidjson.sh @@ -45,8 +45,8 @@ case "$with_rapidjson" in report_error "failed to download $url" recommend_offline_installation $filename $url fi - # checksum - checksum "$filename" "$rapidjson_sha256" + # checksum + checksum "$filename" "$rapidjson_sha256" fi echo "Installing from scratch into ${pkg_install_dir}" [ -d $dirname ] && rm -rf $dirname From 6501468b46099351f03b66d5ddf7866a5081e681 Mon Sep 17 00:00:00 2001 From: apple Date: Mon, 12 Aug 2024 14:16:12 +0800 Subject: [PATCH 13/14] update database version --- toolchain/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/README.md b/toolchain/README.md index 391ae8bb2a..8718441c7c 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -75,7 +75,7 @@ Notice: These packages will be downloaded by `wget` from `github.com`, which is Instead of github.com, we offer other package station, you can use it by: ```shell -wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps-v2.zip +wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps-v3.zip ``` `unzip` it ,and you can do offline installation of these packages above after rename. The above station will be updated handly but one should notice that the version will always lower than github repo. From 81bdbcfe1c3180d2d99f6092257aa5e09bda5809 Mon Sep 17 00:00:00 2001 From: apple Date: Mon, 12 Aug 2024 14:17:51 +0800 Subject: [PATCH 14/14] update v3 database link --- toolchain/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/README.md b/toolchain/README.md index 8718441c7c..adf6c30051 100644 --- a/toolchain/README.md +++ b/toolchain/README.md @@ -75,7 +75,7 @@ Notice: These packages will be downloaded by `wget` from `github.com`, which is Instead of github.com, we offer other package station, you can use it by: ```shell -wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v2 -O abacus-deps-v3.zip +wget https://bohrium-api.dp.tech/ds-dl/abacus-deps-93wi-v3 -O abacus-deps-v3.zip ``` `unzip` it ,and you can do offline installation of these packages above after rename. The above station will be updated handly but one should notice that the version will always lower than github repo.