#!/bin/sh # common modules to compile GSI/EnKF: # Jet: source /home/rtrr/PARM_EXEC/modulefiles/modulefile.jet.GSI_UPP_WRF # Theia: source /home/rtrr/PARM_EXEC/modulefiles/modulefile.theia.GSI_UPP_WRF # Cheyenne: source /glade/p/ral/jntp/gge/modulefiles/modulefile.cheyenne.GSI_UPP_WRF # # build commands: # cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON path_to_ProdGSI # cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_UTIL_COM=ON -DBUILD_ENKF_PREPROCESS_ARW=ON" # make -j8 # dir_root=$(pwd) if [[ "`grep -i "theia" /etc/hosts | head -n1`" != "" ]] ; then ###theia source /etc/profile.d/modules.sh modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.theia.GSI_UPP_WRF" elif [[ "`grep -i "hera" /etc/hosts | head -n1`" != "" ]] ; then ###hera source /etc/profile.d/modules.sh modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.hera.GSI_UPP_WRF" elif [[ -d /jetmon ]] ; then ### jet source /etc/profile.d/modules.sh modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.jet.GSI_UPP_WRF" elif [[ -d /glade ]] ; then ### cheyenne source /etc/profile.d/modules.sh modulefile="/glade/p/ral/jntp/gge/modulefiles/modulefile.cheyenne.GSI_UPP_WRF" elif [[ -d /work/noaa ]] ; then ### orion modulefile="/work/noaa/comgsi/modulefiles/modulefile.orion.GSI_UPP_WRF" #modulefile="/work/noaa/comgsi/modulefiles/modulefile.intel20" else echo "unknown machine" exit 9 fi if [ ! -f $modulefile ]; then echo "modulefiles $modulefile does not exist" exit 10 fi source $modulefile ## if NETCDF4 is set to 0 or 1, unset it if [[ "$NETCDF4" == "1" ]] || [[ "$NETCDF4" == "0" ]]; then unset NETCDF4 fi set -x rm -rf $dir_root/build mkdir -p $dir_root/build cd $dir_root/build set +x echo "compiled at the node:" >> output.log hostname >> output.log module list >> output.log echo -e "\nThe branch name:" >> output.log git branch | grep "*" >> output.log echo -e "\nThe commit ID:" >> output.log git log -1 | head -n1 >> output.log echo -e "\ngit status:" >> output.log git status >> output.log echo -e "\nCompiling commands:" >> output.log echo " cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON .." >> output.log echo " make -j8" >> output.log cat output.log cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON .. 2>&1 | tee output.cmake make -j 8 2>&1 | tee output.compile ###aftermath commitID=`git log -1 | head -n1 |cut -c8-15` repoName=`git config --get remote.origin.url | cut -d: -f2` datestamp=`date +%Y%m%d` cd bin ln -sf gsi.x gsi.x_${repoName}_${datestamp}_${commitID} ln -sf enkf_wrf.x enkf_wrf.x_${repoName}_${datestamp}_${commitID} ln -sf enspreproc.x enspreproc.x_${repoName}_${datestamp}_${commitID} ###mv $dir_root/build $dir_root/build_$commitID echo -e "\n\nAll build results are at ./build/ \n\n" exit