NWChem/travis/nwchem.bashrc

233 lines
7.4 KiB
Text
Raw Permalink Normal View History

#- env: == default ==
echo "start nwchem.bashrc"
echo "BLAS_SIZE is " $BLAS_SIZE
echo "BLASOPT is " $BLASOPT
echo "BUILD_OPENBLAS is " $BUILD_OPENBLAS
os=`uname`
arch=`uname -m`
if [[ -z "$APPTAINER_NAME" ]] || [[ -z "$SINGULARITY_NAME" ]] ; then
MYSUDO=sudo
else
MYSUDO=" "
fi
2021-01-19 09:56:05 -08:00
if test -f "/usr/lib/os-release"; then
dist=$(grep ID= /etc/os-release |grep -v VERSION |head -1 |cut -c4-| sed 's/\"//g')
2021-01-19 09:56:05 -08:00
fi
2021-06-28 21:13:10 -07:00
if [ -z "$CC" ] ; then
2021-06-28 21:19:33 -07:00
CC=cc
2021-06-28 21:13:10 -07:00
fi
2021-01-19 09:56:05 -08:00
if [ -z "$DISTR" ] ; then
DISTR=$dist
fi
echo DISTR is "$DISTR"
if [[ -z "$TRAVIS_BUILD_DIR" ]] ; then
TRAVIS_BUILD_DIR=$(pwd)
2020-12-23 15:36:41 -08:00
else
export NWCHEM_TOP=$TRAVIS_BUILD_DIR
fi
2020-12-23 15:36:41 -08:00
echo NWCHEM_TOP is $NWCHEM_TOP
#TARBALL=https://github.com/nwchemgit/nwchem/releases/download/v7.0.0-beta1/nwchem-7.0.0-release.revision-5bcf0416-src.2019-11-01.tar.bz2
export USE_MPI=y
2025-10-17 14:39:24 -07:00
export MPICH_INTERFACE_HOSTNAME=localhost # fix for Mpich interface errors
2025-10-28 10:52:32 -07:00
if [[ "$FC" == *'flang'* ]] || [[ "$FC" == *'nvfortran'* ]]; then
export BUILD_MPICH=1
2021-01-09 00:40:15 -08:00
fi
2022-01-13 18:47:49 -08:00
if [[ "$FC" == "amdflang" ]]; then
2022-07-26 12:02:03 -07:00
export PATH=/opt/rocm/bin:$PATH
export LD_LIBRARY_PATH=/opt/rocm-"$rocm_version"/lib:/opt/rocm/llvm/lib:$LD_LIBRARY_PATH
2023-10-12 15:44:56 -07:00
fi
2022-01-13 18:47:49 -08:00
2021-02-24 11:00:43 -08:00
if [[ "$FC" == "nvfortran" ]]; then
export PATH=/opt/nvidia/hpc_sdk/Linux_"$arch"/latest/compilers/bin:$PATH
echo "**** before hpc_sdk makelocalrc"
$MYSUDO /opt/nvidia/hpc_sdk/Linux_"$arch"/latest/compilers/bin/makelocalrc -x
echo "**** done hpc_sdk makelocalrc"
export LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_"$arch"/latest/compilers/lib:$LD_LIBRARY_PATH
export FC=nvfortran
export MPICH_FC=nvfortran
2025-10-28 10:13:38 -07:00
export OMPI_FC=nvfortran
2021-02-24 11:00:43 -08:00
fi
2022-01-18 21:32:34 -08:00
if [[ "$FC" == "ifort" ]] || [[ "$FC" == "ifx" ]] ; then
2024-08-07 17:20:42 -07:00
if [[ "$os" == "Darwin" ]]; then
IONEAPI_ROOT=~/apps/oneapi
else
IONEAPI_ROOT=/opt/intel/oneapi
# fix runtime mpi_init error
# export FI_LOG_LEVEL=TRACE
export FI_PROVIDER=shm
echo "*** output of fi_info ***"
echo $(fi_info -l) || true
2024-08-07 17:20:42 -07:00
fi
2022-09-06 23:17:36 -07:00
# source "$IONEAPI_ROOT"/compiler/latest/env/vars.sh
2022-09-06 23:37:22 -07:00
source "$IONEAPI_ROOT"/setvars.sh --force
2022-01-19 10:30:48 -08:00
export I_MPI_F90="$FC"
2024-05-31 10:51:09 -07:00
#force icc on macos to cross-compile x86 on arm64
# icx not available on macos
if [[ "$os" == "Darwin" ]]; then
2024-10-08 15:50:56 -07:00
if [[ "$FC" != "gfortran" ]] && [[ "$FC" == "gfortran*" ]]; then
mygccver=$(echo "$FC"|cut -d - -f 2)
export PATH=$HOMEBREW_CELLAR/../opt/gcc@"$mygccver"/bin:$PATH
echo gfortran is $(gfortran -v)
echo gfortran-"$mygccver" is $(gfortran-"$mygccver" -v)
fi
if [[ "$CC" != gcc ]] && [[ "$CC" == gcc* ]]; then
mygccver=$(echo "$CC"|cut -d - -f 2)
export PATH=$HOMEBREW_CELLAR/../opt/gcc@"$mygccver"/bin:$PATH
echo gcc is $(gcc -v)
echo gcc-"$mygccver" is $(gcc-"$mygccver" -v)
fi
2024-10-08 14:11:55 -07:00
# CC=icc
# CXX=icc
2022-09-07 12:05:18 -07:00
# Intel MPI not available on macos
2022-10-09 13:04:48 -07:00
# export BUILD_MPICH=1
2022-09-07 22:55:43 -07:00
unset BUILD_PLUMED
fi
2022-09-07 11:21:29 -07:00
"$FC" -v
"$CC" -v
2021-01-08 23:11:30 -08:00
fi
2022-09-06 23:17:36 -07:00
if [[ -f "$IONEAPI_ROOT"/mpi/latest/env/vars.sh ]]; then
source "$IONEAPI_ROOT"/mpi/latest/env/vars.sh
2022-01-19 10:30:48 -08:00
export I_MPI_F90="$FC"
2022-10-14 16:34:10 -07:00
if [[ "$MPI_IMPL" == "intel" ]]; then
mpif90 -v
mpif90 -show
#to avoid segfault with FI_PROVIDER=shm in MPI_Finalize with Intel MPI 2021.15
export FI_PROVIDER=tcp
2022-10-14 16:34:10 -07:00
fi
2021-01-08 23:11:30 -08:00
if [ -f /opt/intel/oneapi/mkl/latest/env/vars.sh ] ; then
source /opt/intel/oneapi/mkl/latest/env/vars.sh
fi
fi
2025-01-21 18:07:11 -08:00
if [[ "$MPI_IMPL" == "build_mpich" ]]; then
export BUILD_MPICH=1
fi
2017-12-19 22:50:29 -08:00
if [[ "$os" == "Darwin" ]]; then
2017-12-13 17:19:29 -08:00
export NWCHEM_TARGET=MACX64
export DYLD_FALLBACK_LIBRARY_PATH=$TRAVIS_BUILD_DIR/lib:$DYLD_FALLBACK_LIBRARY_PATH
2017-12-06 09:44:29 -08:00
if [[ "$MPI_IMPL" == "openmpi" ]]; then
2017-12-09 01:01:17 -08:00
export PATH=/usr/local/opt/open-mpi/bin/:$PATH
2017-12-06 09:44:29 -08:00
fi
2017-12-05 11:32:17 -08:00
if [[ "$MPI_IMPL" == "mpich" ]]; then
export PATH=/usr/local/opt/mpich/bin/:$PATH
fi
2020-07-18 10:26:55 -07:00
fi
if [[ "$os" == "Linux" ]]; then
export NWCHEM_TARGET=LINUX64
if [[ "$MPI_IMPL" == "mpich" ]]; then
#fix for MPICH on ubuntu 24.04
#https://bugs.launchpad.net/ubuntu/+source/mpich/+bug/2072338
#https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1102612
#https://github.com/pmodels/mpich/issues/7064
ubuntu_v=$(grep VERSION_ID /etc/os-release|cut -d = -f 2 | sed 's/\"//g' )
if [ $ubuntu_v = "24.04" ]; then export BUILD_MPICH=1 ; fi
fi
fi
2017-12-05 13:38:08 -08:00
export OMP_NUM_THREADS=1
2017-12-05 17:49:25 -08:00
export USE_NOIO=1
2021-01-19 09:56:05 -08:00
if [[ "$DISTR" == "fedora" ]] || [[ "$DISTR" == "centos" ]]; then
export PATH=/usr/lib64/"$MPI_IMPL"/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib64/"$MPI_IMPL"/lib:$LD_LIBRARY_PATH
fi
if [[ -z "$BLAS_SIZE" ]] ; then
echo "BLAS_SIZE not set, setting = 8"
export BLAS_SIZE=8
fi
if [[ "$BLAS_ENV" == "internal" ]]; then
export USE_INTERNALBLAS=1
2021-10-24 19:38:22 -07:00
export SCALAPACK_ENV="off"
elif [[ "$BLAS_ENV" == "build_openblas" ]]; then
export BUILD_OPENBLAS="y"
2021-02-23 09:06:53 -08:00
elif [[ "$BLAS_ENV" == "accelerate" ]]; then
export BLASOPT="-framework Accelerate"
export BLAS_LIB=${BLASOPT}
export LAPACK_LIB=${BLASOPT}
export BLAS_SIZE=4
2023-11-14 16:47:18 -08:00
elif [[ "$BLAS_ENV" == lib*openblas* ]] || [[ "$BLAS_ENV" == "brew_openblas" ]]; then
2023-11-15 10:18:22 -08:00
if [[ "$BLAS_ENV" == *openblas64* ]]; then
2023-11-14 16:47:18 -08:00
myob="openblas64"
else
myob="openblas"
fi
if [[ "$BLAS_ENV" == "brew_openblas" ]]; then
2023-11-14 22:06:36 -08:00
if [ -z "$HOMEBREW_PREFIX" ] ; then
HOMEBREW_PREFIX=/usr/local
fi
2023-11-14 16:47:18 -08:00
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openblas/lib/pkgconfig
fi
export BLASOPT=$(pkg-config --libs $myob)
export LAPACK_LIB=$BLASOPT
2021-02-23 09:06:53 -08:00
fi
if [[ "$BLAS_SIZE" == "4" ]]; then
export SCALAPACK_SIZE=4
2021-02-23 09:06:53 -08:00
export USE_64TO32=y
fi
if [[ -z "$USE_INTERNALBLAS" ]]; then
if [[ "$SCALAPACK_ENV" == "off" ]]; then
unset BUILD_SCALAPACK
unset SCALAPACK
unset SCALAPACK_SIZE
else
if [[ -z "$SCALAPACK" ]] ; then
export BUILD_SCALAPACK="y"
2021-02-23 09:06:53 -08:00
if [[ -z "$SCALAPACK_SIZE" ]] ; then
export SCALAPACK_SIZE=8
fi
2021-10-13 15:10:02 -07:00
#elpa
GFORTRAN_EXTRA=$(echo $FC | cut -c 1-8)
2022-01-17 21:00:21 -08:00
if [[ ${FC} == gfortran ]] || [[ ${GFORTRAN_EXTRA} == gfortran ]] ; then
# if [[ ${FC} == gfortran ]] ; then
2022-10-09 13:04:48 -07:00
if [[ "$MPI_IMPL" == "mpich" ]]; then
export MPICH_FC=$FC
2025-10-28 10:13:38 -07:00
export OMPI_FC=$FC
2025-10-17 09:58:26 -07:00
# if [[ "$arch" != "aarch64" ]]; then
# export BUILD_MPICH=1
# fi
2022-10-09 13:04:48 -07:00
fi
2022-01-17 21:23:31 -08:00
if [[ `${CC} -dM -E - < /dev/null 2> /dev/null | grep -c clang` == 0 ]] && [[ `${CC} -dM -E - < /dev/null 2> /dev/null | grep -c GNU` > 0 ]] && [[ "$(expr `${CC} -dumpversion | cut -f1 -d.` \> 7)" == 1 ]]; then
2022-01-17 22:53:40 -08:00
if [[ "$os" == "Linux" ]] && [[ "$arch" == "x86_64" ]]; then
2022-01-17 21:00:21 -08:00
if [[ ! -z "$BUILD_OPENBLAS" ]]; then
# if [[ "$SCALAPACK_SIZE" == "8" ]]; then
2022-04-28 14:49:28 -07:00
export BUILD_ELPA=1
# fi
2022-01-17 20:31:40 -08:00
fi
2021-10-13 15:10:02 -07:00
fi
fi
fi
else
unset BUILD_SCALAPACK
fi
fi
fi
2021-02-23 09:06:53 -08:00
#summary
echo "from nwchem.bashrc"
echo "BLAS_SIZE = " "$BLAS_SIZE"
echo "SCALAPACK_SIZE = " "$SCALAPACK_SIZE"
2021-10-13 15:10:02 -07:00
if [[ ! -z "$USE_64TO32" ]]; then
echo "USE_64TO32 = " "$USE_64TO32"
fi
if [[ ! -z "$BUILD_ELPA" ]]; then
echo "BUILD_ELPA = " "$BUILD_ELPA"
fi
echo "BUILD_MPICH = " "$BUILD_MPICH"
2022-09-12 11:22:06 -07:00
export NWCHEM_EXECUTABLE=$TRAVIS_BUILD_DIR/.cachedir/binaries/$NWCHEM_TARGET/nwchem_"$arch"_`echo $NWCHEM_MODULES|sed 's/ /-/g'`_"$MPI_IMPL"_"$FC"
2022-09-06 17:26:21 -07:00
2022-09-07 14:52:47 -07:00
if [[ "$FC" == "gfortran" ]]; then
if [[ "$($FC -dM -E - < /dev/null 2> /dev/null | grep __GNUC__ |cut -c 18-)" -lt 9 ]]; then
2022-09-06 17:26:21 -07:00
#disable xtb if gfortran version < 9
2022-09-07 14:52:47 -07:00
unset USE_TBLITE
export NWCHEM_MODULES=$(echo $NWCHEM_MODULES |sed 's/xtb//')
fi
2022-09-06 17:26:21 -07:00
fi
2022-12-15 18:15:21 -08:00
if [[ "$USE_LIBXC" == "-1" ]]; then
unset USE_LIBXC
export LIBXC_LIB=/usr/lib/x86_64-linux-gnu
export LIBXC_INCLUDE=/usr/include
fi
2024-02-22 17:31:14 -08:00
#export PYTHONVERSION=$(python -V| cut -d ' ' -f 2 |cut -d . -f 1-2)