diff --git a/env.arolla.sh b/env.arolla.sh index 66b2c26..b5a204d 100644 --- a/env.arolla.sh +++ b/env.arolla.sh @@ -60,6 +60,8 @@ setupDefaults() export BOOST_ROOT=/project/c14/install/kesch/boost/boost_1_67_0/ export BOOST_PATH=${BOOST_ROOT} export BOOST_INCLUDE=${BOOST_ROOT}/include/ + + export YACC="bison -y" # default options if [ -z "${target}" ] ; then @@ -142,8 +144,9 @@ setCppEnvironment() module load cuda92/toolkit/9.2.88 craype-accel-nvidia70 module load boost/1.70.0-gmvolf-18.12-python2 module load /users/jenkins/easybuild/arolla-ln/modules/all/cmake/3.14.5 + export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64" EOF -else + else #Use this modules in case COSMO_TESTENV is set cat > $ENVIRONMENT_TEMPFILE <<- EOF module unuse /apps/arolla/UES/modulefiles @@ -156,8 +159,11 @@ else module load slurm # Gnu env module load PrgEnv-gnu/19.2 + module load cuda10.0/toolkit/10.0.130 + export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64" + EOF -fi + fi #issue with module purge # module purge diff --git a/env.kesch-test.sh b/env.kesch-test.sh index b24cee2..d1e3aee 100644 --- a/env.kesch-test.sh +++ b/env.kesch-test.sh @@ -62,7 +62,6 @@ setupDefaults() export BOOST_PATH=${BOOST_ROOT} export BOOST_INCLUDE=${BOOST_ROOT}/include/ - # default options if [ -z "${target}" ] ; then target="gpu" diff --git a/env.kesch.sh b/env.kesch.sh index c6f65eb..16d8c13 100644 --- a/env.kesch.sh +++ b/env.kesch.sh @@ -62,6 +62,7 @@ setupDefaults() export BOOST_PATH=${BOOST_ROOT} export BOOST_INCLUDE=${BOOST_ROOT}/include/ + export YACC="bison -y" # default options if [ -z "${target}" ] ; then @@ -136,9 +137,10 @@ module load craype-haswell module load cudatoolkit/8.0.61 module load mvapich2gdr_gnu/2.2_cuda_8.0 module load gcc/5.4.0-2.26 -module load cmake +module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.14.5 module load hdf5/1.8.18-gmvolf-17.02 module load git +module load java EOF module purge @@ -226,7 +228,8 @@ module load craype-network-infiniband module load craype-haswell module load CrayCCE/.17.06 module load netCDF-Fortran/4.4.4-CrayCCE-17.06 -module load cmake +module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.14.5 +module load java export GRIBAPI_COSMO_RESOURCES_VERSION=${GRIBAPI_COSMO_RESOURCES_VERSION} EOF else @@ -238,7 +241,8 @@ module load craype-accel-nvidia35 module swap cudatoolkit/8.0.61 module load PrgEnv-CrayCCE/17.06 module load netCDF-Fortran/4.4.4-CrayCCE-17.06 -module load cmake +module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.14.5 +module load java export GRIBAPI_COSMO_RESOURCES_VERSION=${GRIBAPI_COSMO_RESOURCES_VERSION} EOF fi @@ -254,7 +258,8 @@ module load craype-haswell module load craype-network-infiniband module load PrgEnv-gnu/17.02 module load netcdf-fortran/4.4.4-gmvolf-17.02 -module load cmake +module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.14.5 +module load java export GRIBAPI_COSMO_RESOURCES_VERSION=${GRIBAPI_COSMO_RESOURCES_VERSION} EOF module purge @@ -269,7 +274,8 @@ module load craype-haswell module load craype-network-infiniband module load PrgEnv-pgi/18.5 module load netcdf-fortran/4.4.4-pgi-18.5-gcc-5.4.0-2.26 -module load cmake +module load /users/jenkins/easybuild/kesch/modules/all/cmake/3.14.5 +module load java export GRIBAPI_COSMO_RESOURCES_VERSION=${GRIBAPI_COSMO_RESOURCES_VERSION} EOF module purge diff --git a/package_builder/build_claw.sh b/package_builder/build_claw.sh new file mode 100755 index 0000000..9ac7eef --- /dev/null +++ b/package_builder/build_claw.sh @@ -0,0 +1,171 @@ +#!/usr/bin/env bash + +# set default variables + +test -n "${REBUILD}" || REBUILD=YES +test -n "${slave}" || exitError "Error : slave must be defined" + +# hack for tsa +if [ "$slave" == "tsa" ] ; then + export COSMO_TESTENV=ON + slave=arolla +fi + +exitError() +{ + echo "ERROR $1: $3" 1>&2 + echo "ERROR LOCATION=$0" 1>&2 + echo "ERROR LINE=$2" 1>&2 + exit $1 +} + +TEMP=$@ +eval set -- "$TEMP --" +fwd_args="" +compiler_target="all" +while true; do + case "$1" in + --dir|-d) package_basedir=$2; shift 2;; + --idir|-i) install_dir=$2; shift 2;; + --local) install_local="yes"; shift;; + --compiler|-c) compiler_target=$2; shift 2;; + -- ) shift; break ;; + * ) fwd_args="$fwd_args $1"; shift ;; + esac +done + +if [[ -z ${package_basedir} ]]; then + exitError 3221 ${LINENO} "package basedir has to be specified" +fi +if [[ -z ${install_dir} ]]; then + exitError 3225 ${LINENO} "package install dir has to be specified" +fi + +# Setup +echo $@ +base_path=$PWD +setupDefaults + +if [[ ${install_local} == "yes" ]]; then + install_path_prefix_="${base_path}/claw" +else + install_path_prefix_="${install_dir}/claw" +fi + +build_compiler_target() +{ + +export compiler=$1 +local install_path=$2 +echo "Compiling and installing for $compiler (install path: $install_path)" + +install_args="-i ${install_path}/" + +if [ ! -d ${install_dir} ] ; then + mkdir -p ${install_dir} +fi + +setFortranEnvironment + +if [ $? -ne 0 ]; then + exitError 3331 ${LINENO} "Invalid fortran environment" +fi + +writeModuleList ${base_path}/modules.log loaded "FORTRAN MODULES" ${base_path}/modules_fortran.env + +echo "Building for ${compiler} compiler" + +cd $base_path + +if [ "${install_path_prefix_:0:1}" != "/" ]; then + install_path_prefix_=$base_path/$install_path_prefix_ +fi + +export claw_compiler_install=$install_path_prefix_ + +if [[ ! -f $claw_compiler_install/libexec/claw_f_lib.sh || $REBUILD == YES ]]; then + + if [ $REBUILD == YES ] ; then + echo `pwd` + echo "Rebuilding claw-compiler" + echo "rm -rf $claw_compiler_install" + rm -rf $claw_compiler_install + fi + + # Build claw-compiler dependency apache-ant + echo "==============================" + echo "Build claw-compiler dependency: apache-ant" + if [ ! -d ${package_basedir}/hpc-scripts ] ; then + git clone git@github.com:clementval/hpc-scripts.git ${package_basedir}/hpc-scripts + fi + + cd ${package_basedir}/hpc-scripts/cscs + ./install.ant -i ../../ant || error_exit "Error : apach-ant build failed" + + cd ../../ant/apache-ant-1.10.2 + export ANT_HOME=`pwd` + + cd $base_path + + # Build claw-compiler + echo "==============================" + echo "Build claw-compiler" + if [ ! -d ${package_basedir}/claw-compiler ] ; then + git clone git@github.com:claw-project/claw-compiler.git ${package_basedir}/claw-compiler + fi + + cd ${package_basedir}/claw-compiler + + export PATH=$ANT_HOME/bin:$PATH + + # Get OMNI Compiler as submodule + git submodule init + git submodule update + + if [ ! -d build ] ; then + mkdir build + fi + cd build + + if [[ "${slave}" == "kesch" ]] || [[ "${slave}" == "arolla" ]] ; then + cmake -DCMAKE_INSTALL_PREFIX="$claw_compiler_install" .. + elif [[ "${slave}" == "daint" ]] || [[ "${slave}" == "tave" ]]; then + cmake -DCMAKE_INSTALL_PREFIX="$claw_compiler_install" -DOMNI_MPI_CC="MPI_CC=cc" -DOMNI_MPI_FC="MPI_FC=ftn" .. + fi + + # Compile and run unit tests + # make all transformation test && make install + make + make install + + #remove build directories + cd $base_path + cd $package_basedir + rm -rf ant/ claw-compiler/ hpc-scripts/ +else + echo "claw-compiler already installed under $claw_compiler_install" +fi + +if [ $? -ne 0 ]; then + exitError 3333 "Unable to compile claw with ${compiler}" +fi + +cd $base_path + +# Copy module files +cp modules_fortran.env ${install_path}/modules.env +unsetFortranEnvironment + +} + +# Build +if [ "${compiler_target}" != "all" ]; then + if [ "${install_local}" != "yes" ] ; then + install_path_prefix_="${install_path_prefix_}/${compiler_target}" + fi + build_compiler_target "${compiler_target}" "${install_path_prefix_}" +else + for c_ in ${compilers[@]}; do + build_compiler_target "${c_}" "${install_path_prefix_}/$c_/" + done +fi