Skip to content

Commit

Permalink
Use system as default for Intel compiler, MPI, MKL
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrack committed Jan 17, 2022
1 parent c43749b commit 7a52abb
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 89 deletions.
115 changes: 47 additions & 68 deletions tools/toolchain/install_cp2k_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,13 @@ while [ $# -ge 1 ]; do
export DOWNLOADER_FLAGS="-n"
;;
--install-all)
# set all package to __INSTALL__ status
# set all package to the default installation status
for ii in ${package_list}; do
[ "${ii}" != "intel" ] && eval with_${ii}="__INSTALL__"
if [ "${ii}" = "intel" ]; then
eval with_${ii}="__SYSTEM__"
else
eval with_${ii}="__INSTALL__"
fi
done
# default mpi-mode to MPICH
export MPI_MODE=mpich
Expand All @@ -400,16 +404,16 @@ while [ $# -ge 1 ]; do
user_input="${1#*=}"
case "$user_input" in
mpich)
export MPI_MODE=mpich
export MPI_MODE="mpich"
;;
openmpi)
export MPI_MODE=openmpi
export MPI_MODE="openmpi"
;;
intelmpi)
export MPI_MODE=intelmpi
export MPI_MODE="intelmpi"
;;
no)
export MPI_MODE=no
export MPI_MODE="no"
;;
*)
report_error ${LINENO} \
Expand Down Expand Up @@ -441,36 +445,11 @@ while [ $# -ge 1 ]; do
;;
--gpu-ver=*)
user_input="${1#*=}"
case "$user_input" in
K20X)
export GPUVER=K20X
;;
K40)
export GPUVER=K40
;;
K80)
export GPUVER=K80
;;
P100)
export GPUVER=P100
;;
V100)
export GPUVER=V100
;;
A100)
export GPUVER=A100
;;
Mi50)
export GPUVER=Mi50
;;
Mi100)
export GPUVER=Mi100
;;
no)
export GPUVER=no
case "${user_input}" in
K20X | K40 | K80 | P100 | V100 | A100 | Mi50 | Mi100 | no)
export GPUVER="${user_input}"
;;
*)
export GPUVER=no
report_error ${LINENO} \
"--gpu-ver currently only supports K20X, K40, K80, P100, V100, A100, Mi50, Mi100 and no as options"
exit 1
Expand Down Expand Up @@ -534,112 +513,112 @@ while [ $# -ge 1 ]; do
fi
;;
--with-gcc*)
with_gcc=$(read_with $1)
with_gcc=$(read_with "${1}")
;;
--with-cmake*)
with_cmake=$(read_with $1)
with_cmake=$(read_with "${1}")
;;
--with-mpich*)
with_mpich=$(read_with $1)
if [ $with_mpich != "__DONTUSE__" ]; then
with_mpich=$(read_with "${1}")
if [ "${with_mpich}" != "__DONTUSE__" ]; then
export MPI_MODE=mpich
fi
;;
--with-openmpi*)
with_openmpi=$(read_with $1)
with_openmpi=$(read_with "${1}")
if [ "${with_openmpi}" != "__DONTUSE__" ]; then
export MPI_MODE=openmpi
fi
;;
--with-intelmpi*)
with_intelmpi=$(read_with $1)
with_intelmpi=$(read_with "${1}" "__SYSTEM__")
if [ "${with_intelmpi}" != "__DONTUSE__" ]; then
export MPI_MODE=intelmpi
fi
;;
--with-intel*)
with_intel=$(read_with $1)
with_intel=$(read_with "${1}" "__SYSTEM__")
;;
--with-libint*)
with_libint=$(read_with $1)
with_libint=$(read_with "${1}")
;;
--with-libxc*)
with_libxc=$(read_with $1)
with_libxc=$(read_with "${1}")
;;
--with-fftw*)
with_fftw=$(read_with $1)
with_fftw=$(read_with "${1}")
;;
--with-mkl*)
with_mkl=$(read_with $1)
if [ $with_mkl != "__DONTUSE__" ]; then
with_mkl=$(read_with "${1}" "__SYSTEM__")
if [ "${with_mkl}" != "__DONTUSE__" ]; then
export MATH_MODE="mkl"
fi
;;
--with-acml*)
with_acml=$(read_with $1)
if [ $with_acml != __DONTUSE__ ]; then
with_acml=$(read_with "${1}")
if [ "${with_acml}" != "__DONTUSE__" ]; then
export MATH_MODE="acml"
fi
;;
--with-openblas*)
with_openblas=$(read_with $1)
if [ "${with_openblas}" != __DONTUSE__ ]; then
with_openblas=$(read_with "${1}")
if [ "${with_openblas}" != "__DONTUSE__" ]; then
export MATH_MODE="openblas"
fi
;;
--with-scalapack*)
with_scalapack=$(read_with $1)
with_scalapack=$(read_with "${1}")
;;
--with-libsmm*)
with_libsmm=$(read_with $1)
with_libsmm=$(read_with "${1}")
;;
--with-libxsmm*)
with_libxsmm=$(read_with $1)
with_libxsmm=$(read_with "${1}")
;;
--with-elpa*)
with_elpa=$(read_with $1)
with_elpa=$(read_with "${1}")
;;
--with-ptscotch*)
with_ptscotch=$(read_with $1)
with_ptscotch=$(read_with "${1}")
;;
--with-superlu*)
with_superlu=$(read_with $1)
with_superlu=$(read_with "${1}")
;;
--with-pexsi*)
with_pexsi=$(read_with $1)
with_pexsi=$(read_with "${1}")
;;
--with-quip*)
with_quip=$(read_with $1)
with_quip=$(read_with "${1}")
;;
--with-plumed*)
with_plumed=$(read_with $1)
with_plumed=$(read_with "${1}")
;;
--with-sirius*)
with_sirius=$(read_with $1)
with_sirius=$(read_with "${1}")
;;
--with-gsl*)
with_gsl=$(read_with $1)
with_gsl=$(read_with "${1}")
;;
--with-spglib*)
with_spglib=$(read_with $1)
with_spglib=$(read_with "${1}")
;;
--with-hdf5*)
with_hdf5=$(read_with $1)
with_hdf5=$(read_with "${1}")
;;
--with-libvdwxc*)
with_libvdwxc=$(read_with $1)
with_libvdwxc=$(read_with "${1}")
;;
--with-spfft*)
with_spfft=$(read_with $1)
with_spfft=$(read_with "${1}")
;;
--with-cosma*)
with_cosma=$(read_with $1)
with_cosma=$(read_with "${1}")
;;
--with-libvori*)
with_libvori=$(read_with $1)
with_libvori=$(read_with "${1}")
;;
--with-spla*)
with_spla=$(read_with $1)
with_spla=$(read_with "${1}")
;;
--help*)
show_help
Expand Down
3 changes: 2 additions & 1 deletion tools/toolchain/scripts/stage1/install_intelmpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ INTELMPI_LIBS=""
mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"

case "$with_intelmpi" in
case "${with_intelmpi}" in
__INSTALL__)
echo "==================== Installing Intel MPI ===================="
echo '__INSTALL__ is not supported; please manually install Intel MPI'
exit 1
;;
Expand Down
29 changes: 14 additions & 15 deletions tools/toolchain/scripts/stage2/install_mkl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ MKL_LDFLAGS=""
MKL_LIBS=""

MKL_FFTW="yes"
if [ "$with_libvdwxc" != "__DONTUSE__" ] && [ "$MPI_MODE" != "no" ]; then
report_warning ${LINENO} "MKL FFTW3 interface is present, but FFTW library is needed (FFTW-MPI)"
if [ "${with_libvdwxc}" != "__DONTUSE__" ] && [ "${MPI_MODE}" != "no" ]; then
report_warning ${LINENO} "MKL FFTW3 interface is present, but FFTW library is needed for FFTW-MPI wrappers."
MKL_FFTW="no"
fi

! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"

case "$with_mkl" in
case "${with_mkl}" in
__INSTALL__)
echo "==================== Installing MKL ===================="
report_error ${LINENO} "To install MKL, please contact your system administrator."
Expand All @@ -47,22 +47,23 @@ case "$with_mkl" in
check_lib -lm
check_lib -ldl
;;
__DONTUSE__) ;;

__DONTUSE__)
# Nothing to do
;;
*)
echo "==================== Linking MKL to user paths ===================="
check_dir "$with_mkl"
MKLROOT="$with_mkl"
check_dir "${with_mkl}"
MKLROOT="${with_mkl}"
;;
esac
if [ "$with_mkl" != "__DONTUSE__" ]; then
case $OPENBLAS_ARCH in
if [ "${with_mkl}" != "__DONTUSE__" ]; then
case ${OPENBLAS_ARCH} in
x86_64)
mkl_arch_dir=intel64
mkl_arch_dir="intel64"
MKL_CFLAGS="-m64"
;;
i386)
mkl_arch_dir=ia32
mkl_arch_dir="ia32"
MKL_CFLAGS="-m32"
;;
*)
Expand All @@ -80,7 +81,7 @@ if [ "$with_mkl" != "__DONTUSE__" ]; then
fi
done

case $MPI_MODE in
case ${MPI_MODE} in
intelmpi | mpich)
mkl_scalapack_lib="IF_MPI(-lmkl_scalapack_lp64|)"
mkl_blacs_lib="IF_MPI(-lmkl_blacs_intelmpi_lp64|)"
Expand Down Expand Up @@ -109,9 +110,6 @@ if [ "$with_mkl" != "__DONTUSE__" ]; then
# write setup files
cat << EOF > "${BUILDDIR}/setup_mkl"
export MKLROOT="${MKLROOT}"
EOF
cat "${BUILDDIR}/setup_mkl" >> ${SETUPFILE}
cat << EOF >> "${BUILDDIR}/setup_mkl"
export MKL_CFLAGS="${MKL_CFLAGS}"
export MKL_LIBS="${MKL_LIBS}"
export MATH_CFLAGS="\${MATH_CFLAGS} ${MKL_CFLAGS}"
Expand All @@ -134,6 +132,7 @@ export FFTW_LDFLAGS="${MKL_LDFLAGS}"
export FFTW_LIBS="${MKL_LIBS}"
EOF
fi
cat "${BUILDDIR}/setup_mkl" >> ${SETUPFILE}
fi

load "${BUILDDIR}/setup_mkl"
Expand Down
14 changes: 9 additions & 5 deletions tools/toolchain/scripts/tool_kit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -580,18 +580,22 @@ read_enable() {
read_with() {
local __input_var="${1#--with*=}"
case $__input_var in
"$1")
"${1}")
# if there is no "=" then treat as "install"
echo '__INSTALL__'
if [ ${#} -gt 1 ]; then
echo "${2}"
else
echo "__INSTALL__"
fi
;;
install)
echo '__INSTALL__'
echo "__INSTALL__"
;;
system)
echo '__SYSTEM__'
echo "__SYSTEM__"
;;
no)
echo '__DONTUSE__'
echo "__DONTUSE__"
;;
*)
echo "${__input_var//\~/$HOME}"
Expand Down

0 comments on commit 7a52abb

Please sign in to comment.