Toolchain: Update libxs* and DBCSR; fix CUDA/HIP package discovery (#5472)

This commit is contained in:
SY Wang 2026-06-29 04:15:19 +08:00 committed by GitHub
parent 871dbd59fb
commit 39eddeee7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 81 additions and 66 deletions

View file

@ -122,7 +122,6 @@ elif [[ "${PROFILE}" == "toolchain_cuda_"* ]] && [[ "${VERSION}" == "psmp" ]]; t
cmake \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
-DDBCSR_DIR="${DBCSR_CUDA_ROOT}/lib/cmake/dbcsr" \
-DSPLA_ROOT="${SPLA_ROOT}-cuda" \
-DCP2K_WITH_GPU="${PROFILE:15}" \
-DCP2K_USE_ACCEL=CUDA \
@ -150,7 +149,6 @@ elif [[ "${PROFILE}" == "toolchain_hip_"* ]] && [[ "${VERSION}" == "psmp" ]]; th
cmake \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
-DDBCSR_DIR="${DBCSR_HIP_ROOT}/lib/cmake/dbcsr" \
-DCP2K_WITH_GPU="${PROFILE:14}" \
-DCP2K_USE_ACCEL=HIP \
-DCP2K_USE_MPI=ON \

View file

@ -193,16 +193,26 @@ if [ ${DEBUG_BUILD} == "__TRUE__" ]; then
fi
if [ -n "$(grep -- "--install-all" "${TOOLCHAIN_ROOTDIR}/toolchain_settings")" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_EVERYTHING=ON -DCP2K_USE_DLAF=OFF -DCP2K_USE_PEXSI=OFF"
# If MPI is disabled, set "CP2K_USE_MPI" to "OFF"
if [ "${mpi_mode}" = "no" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_MPI=OFF"
fi
# Some options that should be specially considered:
# Intel MKL includes FFTW
if [ "${with_fftw}" = "__DONTUSE__" ] && [ "${math_mode}" != "mkl" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_FFTW3=OFF"
fi
# MiMic-MCL (MiMiC Communication Library)
if [ "${with_mcl}" = "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_MIMIC=OFF"
fi
for toolchain_option in $(grep -i "dontuse" "${TOOLCHAIN_INSTALL_DIR}/toolchain.conf" |
grep -Evi "gcc|amd|intel" | cut -d'_' -f2 | cut -d'=' -f1); do
var_name="with_${toolchain_option}"
if [ "${!var_name}" != "__DONTUSE__" ]; then
ADDED_CMAKE_OPTION=$(sed -n '/option(/,/)/p' "${CP2K_ROOT}/CMakeLists.txt" |
grep -i "${toolchain_option}" | awk '{print $1}' | cut -d'(' -f2 | head -n 1)
# Use "if-then" below can avoid generating empty "-D=OFF" options
if [ -n "${ADDED_CMAKE_OPTION}" ]; then
CMAKE_OPTIONS+=" -D${ADDED_CMAKE_OPTION}=OFF"
fi
grep -Evi "gcc|amd|intel|cmake|fftw|mkl|dbcsr" | cut -d'_' -f2 | cut -d'=' -f1); do
ADDED_CMAKE_OPTION=$(sed -n '/option(/,/)/p' "${CP2K_ROOT}/CMakeLists.txt" |
grep -i "${toolchain_option}" | awk '{print $1}' | cut -d'(' -f2 | head -n 1)
# Use "if-then" below can avoid generating empty "-D=OFF" options
if [ -n "${ADDED_CMAKE_OPTION}" ]; then
CMAKE_OPTIONS+=" -D${ADDED_CMAKE_OPTION}=OFF"
fi
done
else
@ -215,7 +225,7 @@ else
if [ "${with_fftw}" != "__DONTUSE__" ] || [ "${math_mode}" = "mkl" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_FFTW3=ON"
fi
# Mimic-MCL (MiMiC Communication Library)
# MiMic-MCL (MiMiC Communication Library)
if [ "${with_mcl}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_MIMIC=ON"
fi
@ -233,19 +243,22 @@ else
fi
fi
done
# Additional feature of SIRIUS
if [ "${with_sirius}" = "__INSTALL__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_SIRIUS_VCSQNM=ON"
if [ "${with_tblite}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_SIRIUS_DFTD3=ON -DCP2K_USE_SIRIUS_DFTD4=ON"
elif [ "${with_dftd4}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_SIRIUS_DFTD4=ON"
fi
fi
# Additional feature of SIRIUS
if [ "${with_sirius}" = "__INSTALL__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_SIRIUS_VCSQNM=ON"
if [ "${with_tblite}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_SIRIUS_DFTD3=ON -DCP2K_USE_SIRIUS_DFTD4=ON"
elif [ "${with_dftd4}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_SIRIUS_DFTD4=ON"
fi
fi
# If GPU acceleration is used, add the option about GPU acceleration
if [ "${ENABLE_CUDA}" = "__TRUE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_ACCEL=CUDA -DCP2K_WITH_GPU=${GPU_VER}"
if [ "${with_cusolvermp}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_CUSOLVER_MP=ON"
fi
elif [ "${ENABLE_HIP}" = "__TRUE__" ]; then
CMAKE_OPTIONS+=" -DCP2K_USE_ACCEL=HIP -DCP2K_WITH_GPU=${GPU_VER}"
elif [ "${ENABLE_OPENCL}" = "__TRUE__" ]; then

View file

@ -25,11 +25,11 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
# HIP-build of Tiled-MM and COSMA requires rocblas
if [ "$with_cosma" != "__DONTUSE__" ] && [ "$ENABLE_HIP" = "__TRUE__" ]; then
if [ "${with_cosma}" != "__DONTUSE__" ] && [ "$ENABLE_HIP" = "__TRUE__" ]; then
check_lib -lrocblas "rocm"
fi
case "$with_cosma" in
case "${with_cosma}" in
__INSTALL__)
require_env OPENBLAS_ROOT
require_env SCALAPACK_ROOT
@ -227,19 +227,26 @@ case "$with_cosma" in
check_dir "${pkg_install_dir}/include"
;;
esac
if [ "$with_cosma" != "__DONTUSE__" ]; then
if [ "$with_cosma" != "__SYSTEM__" ]; then
if [ "${with_cosma}" != "__DONTUSE__" ]; then
if [ "${with_cosma}" != "__SYSTEM__" ]; then
pkg_install_dir1="${pkg_install_dir}"
if [ "${with_cosma}" = "__INSTALL__" ]; then
if [ "${ENABLE_CUDA}" = "__TRUE__" ]; then
pkg_install_dir1="${pkg_install_dir}-cuda"
elif [ "${ENABLE_HIP}" = "__TRUE__" ]; then
pkg_install_dir1="${pkg_install_dir}-hip"
fi
fi
cat << EOF > "${BUILDDIR}/setup_cosma"
prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib"
prepend_path LD_RUN_PATH "${pkg_install_dir}/lib"
prepend_path LIBRARY_PATH "${pkg_install_dir}/lib"
prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig"
prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}"
prepend_path LD_LIBRARY_PATH "${pkg_install_dir1}/lib"
prepend_path LD_RUN_PATH "${pkg_install_dir1}/lib"
prepend_path LIBRARY_PATH "${pkg_install_dir1}/lib"
prepend_path PKG_CONFIG_PATH "${pkg_install_dir1}/lib/pkgconfig"
prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir1}"
EOF
fi
cat << EOF >> "${BUILDDIR}/setup_cosma"
export COSMA_VER="${cosma_ver}"
export COSMA_ROOT="${pkg_install_dir}"
EOF
filter_setup "${BUILDDIR}/setup_cosma" "${SETUPFILE}"

View file

@ -6,8 +6,8 @@
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
libxs_ver="ee1e6ab"
libxs_sha256="c5b64701d5c1d01b0307c9ae438d3e12408b04cf8b0f4a11e8139107b3bd82fa"
libxs_ver="1.0.0"
libxs_sha256="de26f50cb986a2f0e4f92c0eb489d40a44f7e4c5acd22751a6cfa2829dabd04d"
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
source "${SCRIPT_DIR}"/signal_trap.sh
@ -31,9 +31,8 @@ case "$with_libxs" in
if [ -f libxs-${libxs_ver}.tar.gz ]; then
echo "libxs-${libxs_ver}.tar.gz is found"
else
download_pkg_from_urlpath "${libxs_sha256}" "${libxs_ver}" \
https://codeload.github.com/hfp/libxs/tar.gz \
"libxs-${libxs_ver}.tar.gz"
download_pkg_from_urlpath "${libxs_sha256}" "libxs-${libxs_ver}.tar.gz" \
https://github.com/hfp/libxs/releases/download/${libxs_ver}
fi
[ -d libxs-${libxs_ver} ] && rm -rf libxs-${libxs_ver}
tar -xzf libxs-${libxs_ver}.tar.gz

View file

@ -6,8 +6,8 @@
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
libxstream_ver="9b5d4ed"
libxstream_sha256="77bd005aaf1d03556c32ea30b3f239d2ac09270c9adb219a82d585a82f1b6fea"
libxstream_ver="1.0.0"
libxstream_sha256="44a2823b12eb58b5eaf97649244b93dcf921597ceabc718053cd28e5f59260e3"
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
source "${SCRIPT_DIR}"/signal_trap.sh
@ -34,7 +34,13 @@ case "$with_libxstream" in
if verify_checksums "${install_lock_file}"; then
echo "libxstream-${libxstream_ver} is already installed, skipping it."
else
retrieve_package "${libxstream_sha256}" "libxstream-${libxstream_ver}.tar.gz"
# retrieve_package "${libxstream_sha256}" "libxstream-${libxstream_ver}.tar.gz"
if [ -f libxstream-${libxstream_ver}.tar.gz ]; then
echo "libxstream-${libxstream_ver}.tar.gz is found"
else
download_pkg_from_urlpath "${libxstream_sha256}" "libxstream-${libxstream_ver}.tar.gz" \
https://github.com/hfp/libxs/releases/download/${libxstream_ver}
fi
[ -d libxstream-${libxstream_ver} ] && rm -rf libxstream-${libxstream_ver}
tar -xzf libxstream-${libxstream_ver}.tar.gz

View file

@ -103,6 +103,7 @@ case "$with_sirius" in
if [ "$ENABLE_CUDA" = "__TRUE__" ]; then
[ -d build-cuda ] && rm -rf "build-cuda"
echo "Installing from scratch into ${pkg_install_dir}/cuda"
mkdir build-cuda
cd build-cuda
cmake \

View file

@ -6,8 +6,8 @@
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_NAME}")/.." && pwd -P)"
dbcsr_ver="4d85b72"
dbcsr_sha256="33461c7313e432b8902c9484ec327550d01b32b1b487020d3372d0ddd19265dc"
dbcsr_ver="2.10.0"
dbcsr_sha256="3d897220fbb4498215331efad6905eb7744881b4cf04eb5c5fb4db7c48a56ef9"
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
source "${SCRIPT_DIR}"/signal_trap.sh
@ -27,12 +27,12 @@ case "${with_dbcsr}" in
if verify_checksums "${install_lock_file}"; then
echo "dbcsr-${dbcsr_ver} is already installed, skipping it."
else
# retrieve_package "${dbcsr_sha256}" "dbcsr-${dbcsr_ver}.tar.gz"
if [ -f dbcsr-${dbcsr_ver}.tar.gz ]; then
echo "dbcsr-${dbcsr_ver}.tar.gz is found"
else
download_pkg_from_urlpath "${dbcsr_sha256}" "${dbcsr_ver}" \
https://codeload.github.com/cp2k/dbcsr/tar.gz \
"dbcsr-${dbcsr_ver}.tar.gz"
download_pkg_from_urlpath "${dbcsr_sha256}" "dbcsr-${dbcsr_ver}.tar.gz" \
https://github.com/cp2k/dbcsr/releases/download/v${dbcsr_ver}
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d dbcsr-${dbcsr_ver} ] && rm -rf dbcsr-${dbcsr_ver}
@ -45,30 +45,18 @@ case "${with_dbcsr}" in
sed -i "s/ H100)/ H100\\n GB10)/" CMakeLists.txt
sed -i "/ set(GPU_ARCH_NUMBER_H100 90)/a\\ set(GPU_ARCH_NUMBER_GB10 121)" CMakeLists.txt
cp src/acc/libsmm_acc/parameters/parameters_H100.json \
src/acc/libsmm_acc/parameters/parameters_GB10.json 2> /dev/null || true
src/acc/libsmm_acc/parameters/parameters_GB10.json
fi
fi
# Locate fypp (GitHub tarballs lack submodules).
FYPP_EXE=""
if [ -x "${ROOTDIR}/../../tools/build_utils/fypp" ]; then
FYPP_EXE="${ROOTDIR}/../../tools/build_utils/fypp"
elif [ -x "${SCRIPT_DIR}/fypp" ]; then
FYPP_EXE="${SCRIPT_DIR}/fypp"
elif command -v fypp > /dev/null 2>&1; then
FYPP_EXE="$(command -v fypp)"
else
report_error $LINENO "Failed to find the FYPP preprocessor."
fi
mkdir build-cpu
cd build-cpu
CMAKE_OPTIONS="-DBUILD_TESTING=NO -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=RelWithDebInfo"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DUSE_OPENMP=ON"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_EXAMPLES=NO -DFYPP_EXECUTABLE=${FYPP_EXE}"
if [ "${with_libxsmm}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_LIBXSMM=ON"
fi
CMAKE_OPTIONS="-DBUILD_TESTING=NO -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=ON"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DUSE_OPENMP=ON -DWITH_EXAMPLES=NO"
if [ "${with_libxs}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_LIBXS=ON"
if [ "${with_libxsmm}" != "__DONTUSE__" ]; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_LIBXSMM=ON"
fi
fi
if [ "${MPI_MODE}" == "no" ]; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_MPI=OFF"
@ -82,6 +70,7 @@ case "${with_dbcsr}" in
make -j $(get_nprocs) install > make.log 2>&1 || tail_excerpt make.log
cd ..
if [ "${ENABLE_CUDA}" == "__TRUE__" ]; then
echo "Installing from scratch into ${pkg_install_dir}-cuda"
mkdir build-cuda
cd build-cuda
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_ACCEL=cuda"
@ -94,6 +83,7 @@ case "${with_dbcsr}" in
cd ..
fi
if [ "${ENABLE_HIP}" == "__TRUE__" ]; then
echo "Installing from scratch into ${pkg_install_dir}-hip"
mkdir build-hip
cd build-hip
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_ACCEL=hip -DWITH_GPU=Mi250"
@ -128,14 +118,15 @@ esac
if [ "${with_dbcsr}" != "__DONTUSE__" ]; then
cat << EOF > "${BUILDDIR}/setup_dbcsr"
export DBCSR_VER="${dbcsr_ver}"
export DBCSR_ROOT="${pkg_install_dir}"
EOF
if [ "${with_dbcsr}" != "__SYSTEM__" ]; then
pkg_install_dir1="${pkg_install_dir}"
if [ "${ENABLE_CUDA}" == "__TRUE__" ]; then
pkg_install_dir1="${pkg_install_dir}-cuda"
elif [ "${ENABLE_HIP}" == "__TRUE__" ]; then
pkg_install_dir1="${pkg_install_dir}-hip"
if [ "${with_dbcsr}" = "__INSTALL__" ]; then
if [ "${ENABLE_CUDA}" = "__TRUE__" ]; then
pkg_install_dir1="${pkg_install_dir}-cuda"
elif [ "${ENABLE_HIP}" = "__TRUE__" ]; then
pkg_install_dir1="${pkg_install_dir}-hip"
fi
fi
cat << EOF >> "${BUILDDIR}/setup_dbcsr"
prepend_path LD_LIBRARY_PATH "${pkg_install_dir1}/lib"