diff --git a/definition-files/runscript b/definition-files/runscript index e57112314385a86de5e5d816804518f4a2ff8430..0cff77c05ababa734cc87839cca1ca52dd0ee55d 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 0aa44f27e2657415a67f4687c44fd9f04da3a7ca..9cacfeb19421ec1a4a0ea8e173373bea894582df 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 62f467ad2b8750391999b157e8b46b0175480d24..9406e9e578afd1cd214758cbfa9a831c39f8ae89 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 03a4a5a94a9b33cddc79b87cff1cf546366fef7b..1b7afdcd25b318195c95233e076df1eb60e8b240 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 76d61f77a6403deef5f72663b30967dc852404d3..fa1fde0f5cf00d00311b4888e1b89c88e496e2f0 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"