Skip to content

Commit 05de419

Browse files
Toolchain update: use new intel-OneAPI compiler as default (#5458)
* ifx add and minor fix * set default --with-intel-classic=no * ifx link add-in * support new intelmpi compiler * date info * minor update * Fix --with-intelmpi-classic=yes problem * fix mpiicpx&mpiicx link error * Truly fixed * minor adjustment
1 parent 22b85f9 commit 05de419

File tree

9 files changed

+89
-46
lines changed

9 files changed

+89
-46
lines changed

toolchain/README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ and give setup files that you can use to compile ABACUS.
3131
- [ ] A better README and Detail markdown file.
3232
- [ ] Automatic installation of [DEEPMD](https://github.com/deepmodeling/deepmd-kit).
3333
- [ ] Better compliation method for ABACUS-DEEPMD and ABACUS-DEEPKS.
34-
- [ ] A better `setup` and toolchain code structure.
3534
- [ ] Modulefile generation scripts.
3635
- [ ] Support for AMD compiler and math lib like `AOCL` and `AOCC`
3736

@@ -54,19 +53,23 @@ There are also well-modified script to run *install_abacus_toolchain.sh* for `gn
5453
> ./toolchain_intel-mpich.sh
5554
```
5655

57-
It is recommended to run them first to get a fast installation of ABACUS under certain environments.
56+
It is recommended to run one of them first to get a fast installation of ABACUS under certain environments.
5857

59-
If you have a fresh environments and you have `sudo` permission, you can use *install_requirements.sh* to install system libraries and dependencies needed by toolchain.
58+
If you are using Intel environments via Intel-OneAPI: please note:
59+
1. After version 2024.0, Intel classic compilers `icc` and `icpc` are not present, so as `ifort` after version 2025.0. Intel MPI compiler will also be updated to `mpiicx`, `mpiicpx` and `mpiifx`.
60+
2. toolchain will detect `icx`, `icpx`, `ifx`, `mpiicx`, `mpiicpx` and `mpiifx` as default compiler.
61+
3. Users can manually specify `--with-intel-classic=yes` to use Intel classic compiler in `toolchain*.sh`, or specify `--with-intel-mpi-clas=yes` to use Intel MPI classic compiler in `toolchain*.sh` while keep the CC, CXX and F90 compiler to new version.
62+
4. Users can manually specify `--with-ifx=no` in `toolchain*.sh` to use `ifort` while keep other compiler to new version.
63+
5. More information is in the later part of this README.
64+
65+
**Notice: You GCC version should be no lower than 5 !!!, larger than 7.3.0 is recommended**
6066

6167
**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`**
6268

6369
**Notice: You SHOULD keep your environments systematic, for example, you CANNOT load `intel-OneAPI` environments while use gcc toolchain !!!**
6470

6571
**Notice: If your server system already have libraries like `cmake`, `openmpi`, please change related setting in `toolchain*.sh` like `--with-cmake=system`**
6672

67-
```shell
68-
> ./install_ABACUS_toolchain.sh
69-
```
7073

7174
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:
7275

@@ -198,6 +201,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \
198201

199202
Notice: You CANNOT use `icpx` compiler for GPU version of ABACUS for now, see discussion here [#2906](https://github.com/deepmodeling/abacus-develop/issues/2906) and [#4976](https://github.com/deepmodeling/abacus-develop/issues/4976)
200203

204+
If you wants to use ABACUS GPU-LCAO by `cusolvermp` or `elpa`, please contact the coresponding developer, toolchain do not fully support them now.
201205

202206
### Shell problem
203207

@@ -238,15 +242,17 @@ When you encounter problem like `GLIBCXX_3.4.29 not found`, it is sure that your
238242

239243
After my test, you need `gcc`>11.3.1 to enable deepmd feature in ABACUS.
240244

241-
### ELPA problem via Intel-oneAPI toolchain in AMD server
245+
### Intel-oneAPI problem
246+
247+
#### ELPA problem via Intel-oneAPI toolchain in AMD server
242248

243249
The default compiler for Intel-oneAPI is `icpx` and `icx`, which will cause problem when compling ELPA in AMD server. (Which is a problem and needed to have more check-out)
244250

245251
The best way is to change `icpx` to `icpc`, `icx` to `icc`. user can manually change it in toolchain*.sh via `--with-intel-classic=yes`
246252

247253
Notice: `icc` and `icpc` from Intel Classic Compiler of Intel-oneAPI is not supported for 2024.0 and newer version. And Intel-OneAPI 2023.2.0 can be found in website. See discussion here [#4976](https://github.com/deepmodeling/abacus-develop/issues/4976)
248254

249-
### Intel-oneAPI problem
255+
#### link problem in early 2023 version oneAPI
250256

251257
Sometimes Intel-oneAPI have problem to link `mpirun`,
252258
which will always show in 2023.2.0 version of MPI in Intel-oneAPI.

toolchain/build_abacus_gnu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \
6565
# for -lmkl when load libtorch
6666
# module load mkl
6767

68-
# if one want's to include deepmd, your gcc version should be >= 11.3.0
68+
# if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements
6969

7070
cmake --build $BUILD_DIR -j `nproc`
7171
cmake --install $BUILD_DIR 2>/dev/null

toolchain/build_abacus_intel-mpich.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \
5656
# -DTensorFlow_DIR=$DEEPMD \
5757

5858

59-
# if one want's to include deepmd, your gcc version should be >= 11.3.0
59+
# if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements
6060

6161
cmake --build $BUILD_DIR -j `nproc`
6262
cmake --install $BUILD_DIR 2>/dev/null

toolchain/build_abacus_intel.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RAPIDJSON=$INSTALL_DIR/rapidjson-1.1.0/
3636
# if use deepks and deepmd
3737
cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \
3838
-DCMAKE_CXX_COMPILER=icpx \
39-
-DMPI_CXX_COMPILER=mpiicpc \
39+
-DMPI_CXX_COMPILER=mpiicpx \
4040
-DMKLROOT=$MKLROOT \
4141
-DELPA_DIR=$ELPA \
4242
-DCEREAL_INCLUDE_DIR=$CEREAL \
@@ -60,7 +60,7 @@ cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX=$PREFIX \
6060
cmake --build $BUILD_DIR -j `nproc`
6161
cmake --install $BUILD_DIR 2>/dev/null
6262

63-
# if one want's to include deepmd, your gcc version should be >= 11.3.0
63+
# if one want's to include deepmd, your system gcc version should be >= 11.3.0 for glibc requirements
6464

6565
# generate abacus_env.sh
6666
cat << EOF > "${TOOL}/abacus_env.sh"

toolchain/install_abacus_toolchain.sh

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ OPTIONS:
9797
options to values other than no will also switch --mpi-mode
9898
to the respective mode.
9999
--math-mode Selects which core math library to use. Available options
100-
are: acml, cray, mkl, and openblas. The option "cray"
100+
are: cray, mkl, and openblas. The option "cray"
101101
corresponds to cray libsci, and is the default for CRAY
102102
(CLE) systems. For non-CRAY systems, if env variable MKLROOT
103103
exists then mkl will be default, otherwise openblas is the
104-
default option. Explicitly setting --with-acml, --with-mkl,
104+
default option. Explicitly setting --with-mkl,
105105
or --with-openblas options will switch --math-mode to the
106106
respective modes.
107107
--gpu-ver Selects the GPU architecture for which to compile. Available
@@ -152,8 +152,10 @@ The --with-PKG options follow the rules:
152152
Default = system
153153
--with-intel Use the Intel compiler to compile ABACUS.
154154
Default = system
155-
--with-intel-classic Use the classic Intel compiler to compile ABACUS.
155+
--with-intel-classic Use the classic Intel compiler (icc, icpc, ifort) to compile ABACUS.
156156
Default = no
157+
--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)
158+
Default = yes
157159
--with-cmake Cmake utilities
158160
Default = install
159161
--with-openmpi OpenMPI, important if you want a parallel version of ABACUS.
@@ -166,6 +168,8 @@ The --with-PKG options follow the rules:
166168
--with-intelmpi Intel MPI, MPI library like OpenMPI. one should
167169
use only one of OpenMPI, MPICH or Intel MPI.
168170
Default = system
171+
--with-intel-mpi-clas Use the classic Intelmpi compiler (mpiicc, mpiicpc and mpiifort)
172+
Default = no
169173
--with-libxc libxc, exchange-correlation library. Needed for
170174
QuickStep DFT and hybrid calculations.
171175
Default = install
@@ -231,7 +235,7 @@ EOF
231235
# ------------------------------------------------------------------------
232236
tool_list="gcc intel cmake"
233237
mpi_list="mpich openmpi intelmpi"
234-
math_list="mkl acml openblas"
238+
math_list="mkl openblas"
235239
lib_list="fftw libxc scalapack elpa cereal rapidjson libtorch libnpy libri libcomm"
236240
package_list="${tool_list} ${mpi_list} ${math_list} ${lib_list}"
237241
# ------------------------------------------------------------------------
@@ -262,7 +266,6 @@ if [ "${MKLROOT}" ]; then
262266
else
263267
export MATH_MODE="openblas"
264268
fi
265-
with_acml="__SYSTEM__"
266269
with_openblas="__INSTALL__"
267270
with_elpa="__INSTALL__"
268271
with_cereal="__INSTALL__"
@@ -305,13 +308,15 @@ enable_opencl="__FALSE__"
305308
enable_cuda="__FALSE__"
306309
enable_hip="__FALSE__"
307310
export intel_classic="no"
308-
# no, then icc->icx, icpc->icpx,
311+
# no, then icc->icx, icpc->icpx
309312
# which cannot compile elpa in AMD server
310313
# due to some so-called cross-compile problem
311314
# and will lead to problem in force calculation
312315
# but icx is recommended by intel compiler
313316
# option: --with-intel-classic can change it to yes/no
314-
# zhaoqing by 2023.08.31
317+
# zhaoqing by 2023.08
318+
export intelmpi_classic="no"
319+
export with_ifx="yes"
315320
export GPUVER="no"
316321
export MPICH_DEVICE="ch4"
317322
export TARGET_CPU="native"
@@ -406,15 +411,12 @@ while [ $# -ge 1 ]; do
406411
mkl)
407412
export MATH_MODE="mkl"
408413
;;
409-
acml)
410-
export MATH_MODE="acml"
411-
;;
412414
openblas)
413415
export MATH_MODE="openblas"
414416
;;
415417
*)
416418
report_error ${LINENO} \
417-
"--math-mode currently only supports mkl, acml, and openblas as options"
419+
"--math-mode currently only supports mkl, and openblas as options"
418420
;;
419421
esac
420422
;;
@@ -507,11 +509,17 @@ while [ $# -ge 1 ]; do
507509
fi
508510
;;
509511
--with-intel-classic*)
510-
intel_classic=$(read_with "${1}" "yes") # default yes
512+
intel_classic=$(read_with "${1}" "no") # default new intel compiler
513+
;;
514+
--with-intel-mpi-clas*)
515+
intelmpi_classic=$(read_with "${1}" "no") # default new intel mpi compiler
511516
;;
512517
--with-intel*)
513518
with_intel=$(read_with "${1}" "__SYSTEM__")
514519
;;
520+
--with-ifx*)
521+
with_ifx=$(read_with "${1}" "yes") # default yes
522+
;;
515523
--with-libxc*)
516524
with_libxc=$(read_with "${1}")
517525
;;
@@ -524,12 +532,6 @@ while [ $# -ge 1 ]; do
524532
export MATH_MODE="mkl"
525533
fi
526534
;;
527-
--with-acml*)
528-
with_acml=$(read_with "${1}")
529-
if [ "${with_acml}" != "__DONTUSE__" ]; then
530-
export MATH_MODE="acml"
531-
fi
532-
;;
533535
--with-openblas*)
534536
with_openblas=$(read_with "${1}")
535537
if [ "${with_openblas}" != "__DONTUSE__" ]; then

toolchain/scripts/stage0/install_gcc.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
1111
gcc_ver="13.2.0"
1212
gcc_sha256="8cb4be3796651976f94b9356fa08d833524f62420d6292c5033a9a26af315078"
1313
# use gcc 14 with caution
14-
#gcc_ver="14.1.0"
15-
#gcc_sha256="a0be066c02775002a0fa65ad3c65fb56a8bfd923d072a26ed148c0439ecdb68f"
14+
#gcc_ver="14.2.0"
15+
#gcc_sha256="7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293"
1616

1717
source "${SCRIPT_DIR}"/common_vars.sh
1818
source "${SCRIPT_DIR}"/tool_kit.sh

toolchain/scripts/stage0/install_intel.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# TODO: Review and if possible fix shellcheck errors.
44
# shellcheck disable=all
55

6-
# Last Update in 2024-0811
6+
# Last Update in 2024-1112
77

88
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=${0}
99
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_NAME}")/.." && pwd -P)"
@@ -37,7 +37,11 @@ case "${with_intel}" in
3737
else
3838
check_command icx "intel" && CC="$(realpath $(command -v icx))" || exit 1
3939
check_command icpx "intel" && CXX="$(realpath $(command -v icpx))" || exit 1
40-
check_command ifort "intel" && FC="$(realpath $(command -v ifort))" || exit 1
40+
if [ "${with_ifx}" = "yes" ]; then
41+
check_command ifx "intel" && FC="$(realpath $(command -v ifx))" || exit 1
42+
else
43+
check_command ifort "intel" && FC="$(realpath $(command -v ifort))" || exit 1
44+
fi
4145
fi
4246
F90="${FC}"
4347
F77="${FC}"
@@ -58,8 +62,11 @@ case "${with_intel}" in
5862
else
5963
check_command ${pkg_install_dir}/bin/icx "intel" && CC="${pkg_install_dir}/bin/icx" || exit 1
6064
check_command ${pkg_install_dir}/bin/icpx "intel" && CXX="${pkg_install_dir}/bin/icpx" || exit 1
61-
check_command ${pkg_install_dir}/bin/ifort "intel" && FC="${pkg_install_dir}/bin/ifort" || exit 1
62-
# is ifx needed ?
65+
if [ "${with_ifx}" = "yes" ]; then
66+
check_command ${pkg_install_dir}/bin/ifx "intel" && FC="${pkg_install_dir}/bin/ifx" || exit 1
67+
else
68+
check_command ${pkg_install_dir}/bin/ifort "intel" && FC="${pkg_install_dir}/bin/ifort" || exit 1
69+
fi
6370
fi
6471
F90="${FC}"
6572
F77="${FC}"

toolchain/scripts/stage1/install_intelmpi.sh

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# TODO: Review and if possible fix shellcheck errors.
44
# shellcheck disable=all
55

6-
# Last Update in 2023-0918
6+
# Last Update in 2024-1112
77

88
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
99
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
@@ -32,10 +32,24 @@ case "${with_intelmpi}" in
3232
__SYSTEM__)
3333
echo "==================== Finding Intel MPI from system paths ===================="
3434
check_command mpiexec "intelmpi" && MPIRUN="$(realpath $(command -v mpiexec))"
35+
if [ "${intel_classic}" = "yes" ]; then
36+
# if intel compiler used as classic, so as intelmpi
37+
export intelmpi_classic="yes"
38+
fi
3539
if [ "${with_intel}" != "__DONTUSE__" ]; then
36-
check_command mpiicc "intelmpi" && MPICC="$(realpath $(command -v mpiicc))" || exit 1
37-
check_command mpiicpc "intelmpi" && MPICXX="$(realpath $(command -v mpiicpc))" || exit 1
38-
check_command mpiifort "intelmpi" && MPIFC="$(realpath $(command -v mpiifort))" || exit 1
40+
if [ "${intelmpi_classic}" = "yes" ]; then
41+
check_command mpiicc "intelmpi" && MPICC="$(realpath $(command -v mpiicc))" || exit 1
42+
check_command mpiicpc "intelmpi" && MPICXX="$(realpath $(command -v mpiicpc))" || exit 1
43+
check_command mpiifort "intelmpi" && MPIFC="$(realpath $(command -v mpiifort))" || exit 1
44+
else
45+
check_command mpiicx "intelmpi" && MPICC="$(realpath $(command -v mpiicx))" || exit 1
46+
check_command mpiicpx "intelmpi" && MPICXX="$(realpath $(command -v mpiicpx))" || exit 1
47+
if [ "${with_ifx}" == "yes" ]; then
48+
check_command mpiifx "intelmpi" && MPIFC="$(realpath $(command -v mpiifx))" || exit 1
49+
else
50+
check_command mpiifort "intelmpi" && MPIFC="$(realpath $(command -v mpiifort))" || exit 1
51+
fi
52+
fi
3953
else
4054
echo "The use of Intel MPI is only supported with the Intel compiler"
4155
exit 1
@@ -59,17 +73,27 @@ case "${with_intelmpi}" in
5973
check_dir "${pkg_install_dir}/include"
6074
check_command ${pkg_install_dir}/bin/mpiexec "intel" && MPIRUN="${pkg_install_dir}/bin/mpiexec" || exit 1
6175
if [ "${with_intel}" != "__DONTUSE__" ]; then
62-
check_command ${pkg_install_dir}/bin/mpiicc "intel" && MPICC="${pkg_install_dir}/bin/mpiicc" || exit 1
63-
check_command ${pkg_install_dir}/bin/mpiicpc "intel" && MPICXX="${pkg_install_dir}/bin/mpiicpc" || exit 1
64-
check_command ${pkg_install_dir}/bin/mpiifort "intel" && MPIFC="${pkg_install_dir}/bin/mpiifort" || exit 1
76+
if [ "${intelmpi_classic}" = "yes" ]; then
77+
check_command ${pkg_install_dir}/bin/mpiicc "intel" && MPICC="${pkg_install_dir}/bin/mpiicc" || exit 1
78+
check_command ${pkg_install_dir}/bin/mpiicpc "intel" && MPICXX="${pkg_install_dir}/bin/mpiicpc" || exit 1
79+
check_command ${pkg_install_dir}/bin/mpiifort "intel" && MPIFC="${pkg_install_dir}/bin/mpiifort" || exit 1
80+
else
81+
check_command ${pkg_install_dir}/bin/mpiicx "intel" && MPICC="${pkg_install_dir}/bin/mpiicx" || exit 1
82+
check_command ${pkg_install_dir}/bin/mpiicpx "intel" && MPICXX="${pkg_install_dir}/bin/mpiicpx" || exit 1
83+
if [ "${with_ifx}" = "yes" ]; then
84+
check_command ${pkg_install_dir}/bin/mpiifx "intel" && MPIFC="${pkg_install_dir}/bin/mpiifx" || exit 1
85+
else
86+
check_command ${pkg_install_dir}/bin/mpiifort "intel" && MPIFC="${pkg_install_dir}/bin/mpiifort" || exit 1
87+
fi
88+
fi
6589
else
6690
echo "The use of Intel MPI is only supported with the Intel compiler"
6791
exit 1
6892
fi
6993
MPIFORT="${MPIFC}"
7094
MPIF77="${MPIFC}"
7195
# include path is already handled by compiler wrapper scripts (can cause wrong mpi.mod with GNU Fortran)
72-
#INTELMPI_CFLAGS="-I'${pkg_install_dir}/include'"
96+
INTELMPI_CFLAGS="-I'${pkg_install_dir}/include'"
7397
INTELMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath,'${pkg_install_dir}/lib'"
7498
;;
7599
esac
@@ -81,7 +105,11 @@ if [ "${with_intelmpi}" != "__DONTUSE__" ]; then
81105
else
82106
I_MPI_CXX="icpx"
83107
I_MPI_CC="icx"
84-
I_MPI_FC="ifort"
108+
if [ "${with_ifx}" = "yes" ]; then
109+
I_MPI_FC="ifx"
110+
else
111+
I_MPI_FC="ifort"
112+
fi
85113
fi
86114
INTELMPI_LIBS="-lmpi -lmpicxx"
87115
echo "I_MPI_CXX is ${I_MPI_CXX}"

toolchain/scripts/stage4/install_libtorch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ case "${with_libtorch}" in
4444
filename="${dirname}.zip"
4545

4646
if verify_checksums "${install_lock_file}"; then
47-
echo "${filename} is already installed, skipping it."
47+
echo "${dirname} is already installed, skipping it."
4848
else
4949
if [ -f ${filename} ]; then
5050
echo "${filename} is found"

0 commit comments

Comments
 (0)