From 67d42ce6ef23e33e6d47c5ae7792901ec9c8ba2c Mon Sep 17 00:00:00 2001 From: MB <michael.blaschek@univie.ac.at> Date: Wed, 21 Dec 2022 13:50:07 +0100 Subject: [PATCH] wrf updates --- definition-files/runscript | 11 +++++-- models/WRF/Singularity.dev | 17 ++++++++--- models/WRF/Singularity.wrf | 13 +++++---- ...Singularity.tmp => Singularity.wrf.serial} | 29 ++++++++++++++----- models/WRF/scripts/runscript | 12 ++++---- 5 files changed, 56 insertions(+), 26 deletions(-) rename models/WRF/{Singularity.tmp => Singularity.wrf.serial} (75%) diff --git a/definition-files/runscript b/definition-files/runscript index e571123..0cff77c 100644 --- a/definition-files/runscript +++ b/definition-files/runscript @@ -1,12 +1,17 @@ #!/bin/sh # overwrite any existing runscript -# add IMGW customized PROMPT_COMMAND +# add IMGW customized PROMPT_COMMAND -> PS1 if [ $# -gt 0 ]; then # run cmd line options exec "$@" else # interactive - echo "Welcome inside an IMGW container!" - echo "Get help: singularity run-help $SINGULARITY_NAME" + echo "[OUTSIDE] run: singularity run-help $SINGULARITY_NAME" + # Look for apps? + if [ -d /scif/apps ]; then + echo "[OUTSIDE] Available Apps: $(ls /scif/apps)" + echo "[OUTSIDE] run: singularity run-help --app [] $SINGULARITY_NAME" + fi + echo "[INSIDE] Welcome inside an IMGW container!" exec /.singularity.d/actions/shell "$@" fi \ No newline at end of file diff --git a/models/WRF/Singularity.dev b/models/WRF/Singularity.dev index 0aa44f2..9cacfeb 100644 --- a/models/WRF/Singularity.dev +++ b/models/WRF/Singularity.dev @@ -11,8 +11,13 @@ WRF_VERSION=4.4.1 if [ $# -ne 0 ]; then WRF_VERSION=$1 fi -echo "[WRF.dev] Downloading WRF $WRF_VERSION from github:" -curl -SL -o WRF-${WRF_VERSION}.tar.gz https://github.com/wrf-model/WRF/releases/download/v${WRF_VERSION}/v${WRF_VERSION}.tar.gz +if [ ! -f WRF-${WRF_VERSION}.tar.gz ]; then + echo "[wrf.dev] Downloading WRF $WRF_VERSION from github:" + curl -SL -o WRF-${WRF_VERSION}.tar.gz https://github.com/wrf-model/WRF/releases/download/v${WRF_VERSION}/v${WRF_VERSION}.tar.gz +else + echo "[wrf.dev] Source found: WRF-${WRF_VERSION}.tar.gz" +fi + %apphelp downloadwrf [WRF] APP: downloadwrf @@ -26,8 +31,12 @@ WPS_VERSION=4.4 if [ $# -ne 0 ]; then WPS_VERSION=$1 fi -echo "[WRF.dev] Downloading WPS $WPS_VERSION from github:" -curl -SL -o WPS-${WPS_VERSION}.tar.gz https://github.com/wrf-model/WPS/archive/refs/tags/v${WPS_VERSION}.tar.gz +if [ ! -f WPS-${WPS_VERSION}.tar.gz ]; then + echo "[wrf.dev] Downloading WPS $WPS_VERSION from github:" + curl -SL -o WPS-${WPS_VERSION}.tar.gz https://github.com/wrf-model/WPS/archive/refs/tags/v${WPS_VERSION}.tar.gz +else + echo "[wrf.dev] Source found: WPS-${WPS_VERSION}.tar.gz" +fi %apphelp downloadwps [WRF] APP: downloadwps diff --git a/models/WRF/Singularity.wrf b/models/WRF/Singularity.wrf index 62f467a..9406e9e 100644 --- a/models/WRF/Singularity.wrf +++ b/models/WRF/Singularity.wrf @@ -1,5 +1,5 @@ Bootstrap: localimage -From: wrf.dev +From: wrf.dev.sif Stage: build # Two Stage Build of WRF @@ -12,8 +12,8 @@ Stage: build maintainer IT-IMGW <it.img-wien@univie.ac.at> %files -WRF*.tar.gz /wrf -WPS*.tar.gz /wrf +WRF*.tar.gz /wrf/WRF.tar.gz +WPS*.tar.gz /wrf/WPS.tar.gz %post # Build a WRF release from the sandbox @@ -24,10 +24,11 @@ JASPERLIB=/usr/lib64/ NETCDF=/usr/lib64/openmpi/ mkdir -vp /wrf/WRF /wrf/WPS \ - && cat /wrf/WRF*.tar.gz | tar --no-same-owner --strip-components=1 -zxC /wrf/WRF \ - && cat /wrf/WPS*.tar.gz | tar --no-same-owner --strip-components=1 -zxC /wrf/WPS + && cat /wrf/WRF.tar.gz | tar --no-same-owner --strip-components=1 -zxC /wrf/WRF \ + && cat /wrf/WPS.tar.gz | tar --no-same-owner --strip-components=1 -zxC /wrf/WPS # Build WRF with Option 34 and 1 +# GCC with openmpi cd /wrf/WRF \ && ./configure <<< $'34\r1\r' \ && sed -i -e '/^DM_CC/ s/$/ -DMPI2_SUPPORT/' ./configure.wrf \ @@ -49,7 +50,7 @@ mkdir -p /wrf/run /wrf/bin \ && cp /wrf/WPS/namelist* /wrf/run Bootstrap: localimage -From: wrf.dev +From: wrf.dev.sif Stage: final %files from build diff --git a/models/WRF/Singularity.tmp b/models/WRF/Singularity.wrf.serial similarity index 75% rename from models/WRF/Singularity.tmp rename to models/WRF/Singularity.wrf.serial index 03a4a5a..1b7afdc 100644 --- a/models/WRF/Singularity.tmp +++ b/models/WRF/Singularity.wrf.serial @@ -1,5 +1,5 @@ Bootstrap: localimage -From: sandbox.wrf.dev +From: wrf.dev.sif Stage: build # Two Stage Build of WRF @@ -11,6 +11,10 @@ Stage: build %labels maintainer IT-IMGW <it.img-wien@univie.ac.at> +%files +WRF*.tar.gz /wrf/WRF.tar.gz +WPS*.tar.gz /wrf/WPS.tar.gz + %post # Build a WRF release from the sandbox WRF_BUILD_TARGET=em_real @@ -19,9 +23,14 @@ JASPERINC=/usr/include/jasper/ JASPERLIB=/usr/lib64/ NETCDF=/usr/lib64/openmpi/ +mkdir -vp /wrf/WRF /wrf/WPS \ + && cat /wrf/WRF.tar.gz | tar --no-same-owner --strip-components=1 -zxC /wrf/WRF \ + && cat /wrf/WPS.tar.gz | tar --no-same-owner --strip-components=1 -zxC /wrf/WPS + # Build WRF with Option 34 and 1 +# GCC with openmpi cd /wrf/WRF \ - && ./configure <<< $'34\r1\r' \ + && ./configure <<< $'2\r1\r' \ && sed -i -e '/^DM_CC/ s/$/ -DMPI2_SUPPORT/' ./configure.wrf \ && sed -i '/BUILD_RRTMG_FAST/d' ./configure.wrf \ && /bin/csh ./compile $WRF_BUILD_TARGET 2>&1 | tee compile_wrf_arw_opt34.1.log @@ -41,27 +50,33 @@ mkdir -p /wrf/run /wrf/bin \ && cp /wrf/WPS/namelist* /wrf/run Bootstrap: localimage -From: sandbox.wrf.dev +From: wrf.dev.sif Stage: final %files from build # Copy only executables from WRF to directory /wrf/bin /wrf/bin /wrf/run /wrf/run + # WPS /wrf/WPS/link_grib.csh /wrf/bin /wrf/WPS/ungrib/Variable_Tables /wrf/run + /wrf/WPS/geogrid/GEOGRID* /wrf/run/geogrid/ + /wrf/WPS/geogrid/gribmap.txt /wrf/run/geogrid/ + /wrf/WPS/metgrid/METGRID* /wrf/run/metgrid/ + /wrf/WPS/metgrid/gribmap.txt /wrf/run/metgrid/ + # Log files /wrf/WRF/compile_wrf_arw_opt34.1.log /wrf /wrf/WPS/compile_wps.log /wrf %files - runscript /.singularity.d/runscript - run-help /.singularity.d/runscript.help + ./scripts/runscript /.singularity.d/runscript + ./scripts/run-help /.singularity.d/runscript.help %post # compress gzip -f /wrf/*.log - # remove src tree (is insidie sandbox) - rm -rf /wrf/WRF /wrf/WPS + # remove src tree (is inside sandbox) + # rm -rf /wrf/WRF /wrf/WPS # Strip the binaries to reduce the size of the image find -L /wrf/* -type f -exec readlink -f '{}' \; | \ xargs file -i | \ diff --git a/models/WRF/scripts/runscript b/models/WRF/scripts/runscript index 76d61f7..fa1fde0 100644 --- a/models/WRF/scripts/runscript +++ b/models/WRF/scripts/runscript @@ -6,12 +6,12 @@ if [ $# -gt 0 ]; then echo "[WRF] Copying default run files here" cp -rvu /wrf/run/* . exit 0 - elif [ ! -f namelist.input ]; then - # copy necessary files to current directory - echo "[WRF] Updating default/missing run files here" - cp -rvu /wrf/run/* . - else - echo "[WRF] no automatic copying" + # elif [ ! -f namelist.input ]; then + # # copy necessary files to current directory + # echo "[WRF] Updating default/missing run files here" + # cp -rvu /wrf/run/* . + # else + # echo "[WRF] no automatic copying" fi # run cmd line options echo "[WRF] Executing" -- GitLab