Skip to content

Commit

Permalink
Prepare switch from classic to DPC++/C++ Intel compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrack committed Mar 16, 2023
1 parent b22e234 commit 57b3283
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
6 changes: 6 additions & 0 deletions tools/toolchain/install_cp2k_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ The --with-PKG options follow the rules:
Default = system
--with-intel Use the Intel compiler to compile CP2K.
Default = system
--with-intel-classic Use the classic Intel compiler to compile CP2K.
Default = yes
--with-cmake Cmake utilities
Default = install
--with-openmpi OpenMPI, important if you want a parallel version of CP2K.
Expand Down Expand Up @@ -338,6 +340,7 @@ enable_tsan="__FALSE__"
enable_opencl="__FALSE__"
enable_cuda="__FALSE__"
enable_hip="__FALSE__"
export intel_classic="yes"
export GPUVER="no"
export MPICH_DEVICE="ch3"
export TARGET_CPU="native"
Expand Down Expand Up @@ -542,6 +545,9 @@ while [ $# -ge 1 ]; do
export MPI_MODE=intelmpi
fi
;;
--with-intel-classic*)
intel_classic=$(read_with "${1}" "yes")
;;
--with-intel*)
with_intel=$(read_with "${1}" "__SYSTEM__")
;;
Expand Down
3 changes: 2 additions & 1 deletion tools/toolchain/scripts/generate_arch_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ fi
if [ "${with_intel}" == "__DONTUSE__" ]; then
CFLAGS="$G_CFLAGS -std=c11 -Wall -Wextra -Werror -Wno-vla-parameter -Wno-deprecated-declarations \$(DFLAGS)"
else
CXXFLAGS="IF_MPI(-cxx=${I_MPI_CXX}|) $G_CFLAGS -std=c11 -Wall \$(DFLAGS)"
CFLAGS="IF_MPI(-cc=${I_MPI_CC}|) $G_CFLAGS -std=c11 -Wall \$(DFLAGS)"
FCFLAGS="IF_MPI(-fc=${I_MPI_FC}|) $FCFLAGS -diag-disable=8291 -diag-disable=8293 -fpp -free"
fi
Expand All @@ -144,7 +145,7 @@ LIBS="${CP_LIBS} -lstdc++"
if [ "${with_intel}" == "__DONTUSE__" ]; then
CXXFLAGS+=" --std=c++14 \$(DFLAGS) -Wno-deprecated-declarations"
else
CXXFLAGS=" ${G_CFLAGS} --std=c++14 \$(DFLAGS)"
CXXFLAGS+=" ${G_CFLAGS} --std=c++14 \$(DFLAGS)"
fi
# CUDA handling
if [ "${ENABLE_CUDA}" = __TRUE__ ] && [ "${GPUVER}" != no ]; then
Expand Down
24 changes: 18 additions & 6 deletions tools/toolchain/scripts/stage0/install_intel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ case "${with_intel}" in
;;
__SYSTEM__)
echo "==================== Finding Intel compiler from system paths ===================="
check_command icc "intel" && CC="$(realpath $(command -v icc))" || exit 1
check_command icpc "intel" && CXX="$(realpath $(command -v icpc))" || exit 1
check_command ifort "intel" && FC="$(realpath $(command -v ifort))" || exit 1
if [ "${intel_classic}" = "yes" ]; then
check_command icc "intel" && CC="$(realpath $(command -v icc))" || exit 1
check_command icpc "intel" && CXX="$(realpath $(command -v icpc))" || exit 1
check_command ifort "intel" && FC="$(realpath $(command -v ifort))" || exit 1
else
check_command icx "intel" && CC="$(realpath $(command -v icx))" || exit 1
check_command icpx "intel" && CXX="$(realpath $(command -v icpx))" || exit 1
check_command ifort "intel" && FC="$(realpath $(command -v ifort))" || exit 1
fi
F90="${FC}"
F77="${FC}"
;;
Expand All @@ -43,9 +49,15 @@ case "${with_intel}" in
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
check_command ${pkg_install_dir}/bin/icc "intel" && CC="${pkg_install_dir}/bin/icc" || exit 1
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
if [ "${intel_classic}" = "yes" ]; then
check_command ${pkg_install_dir}/bin/icc "intel" && CC="${pkg_install_dir}/bin/icc" || exit 1
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
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
fi
F90="${FC}"
F77="${FC}"
INTEL_CFLAGS="-I'${pkg_install_dir}/include'"
Expand Down
11 changes: 9 additions & 2 deletions tools/toolchain/scripts/stage1/install_intelmpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ case "${with_intelmpi}" in
;;
esac
if [ "${with_intelmpi}" != "__DONTUSE__" ]; then
I_MPI_CC="icc"
I_MPI_FC="ifort"
if [ "${intel_classic}" = "yes" ]; then
I_MPI_CXX="icpc"
I_MPI_CC="icc"
I_MPI_FC="ifort"
else
I_MPI_CXX="icpx"
I_MPI_CC="icx"
I_MPI_FC="ifort"
fi
INTELMPI_LIBS="-lmpi -lmpicxx"
echo "I_MPI_CC is ${I_MPI_CC}"
echo "I_MPI_FC is ${I_MPI_FC}"
Expand Down

0 comments on commit 57b3283

Please sign in to comment.