diff --git a/tools/toolchain/install_cp2k_toolchain.sh b/tools/toolchain/install_cp2k_toolchain.sh index 70ea700bce..78b993e25a 100755 --- a/tools/toolchain/install_cp2k_toolchain.sh +++ b/tools/toolchain/install_cp2k_toolchain.sh @@ -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 @@ -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} \ @@ -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 @@ -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 diff --git a/tools/toolchain/scripts/stage1/install_intelmpi.sh b/tools/toolchain/scripts/stage1/install_intelmpi.sh index de6f2ab1c9..3cc5274f15 100755 --- a/tools/toolchain/scripts/stage1/install_intelmpi.sh +++ b/tools/toolchain/scripts/stage1/install_intelmpi.sh @@ -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 ;; diff --git a/tools/toolchain/scripts/stage2/install_mkl.sh b/tools/toolchain/scripts/stage2/install_mkl.sh index 65b402355f..566c3d1acc 100755 --- a/tools/toolchain/scripts/stage2/install_mkl.sh +++ b/tools/toolchain/scripts/stage2/install_mkl.sh @@ -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." @@ -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" ;; *) @@ -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|)" @@ -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}" @@ -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" diff --git a/tools/toolchain/scripts/tool_kit.sh b/tools/toolchain/scripts/tool_kit.sh index 51dcb5017c..b588063b0b 100644 --- a/tools/toolchain/scripts/tool_kit.sh +++ b/tools/toolchain/scripts/tool_kit.sh @@ -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}"