From 1dfe00b9dbe4c605db767a82eb03d9adc52ba2c1 Mon Sep 17 00:00:00 2001 From: MB <michael.blaschek@univie.ac.at> Date: Fri, 16 Dec 2022 11:26:17 +0100 Subject: [PATCH] WRF bug fixes again --- models/WRF/Makefile | 3 ++- models/WRF/Singularity.dev | 23 +++++++++++++---------- models/WRF/Singularity.sandbox.dev | 2 +- models/WRF/Singularity.wrf | 10 +++++----- models/WRF/scripts/runscript | 11 ++++++++--- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/models/WRF/Makefile b/models/WRF/Makefile index bafb67b..949a6c9 100644 --- a/models/WRF/Makefile +++ b/models/WRF/Makefile @@ -7,6 +7,7 @@ sandbox: @if [ ! -d ./sandbox.wrf.dev ]; then\ echo Building the WRF sandbox;\ make -C ../.. alma8.base;\ + ln -fs ../../containers/alma8.base.sif .;\ sudo singularity build --sandbox sandbox.wrf.dev Singularity.sandbox.dev;\ fi @[ -d ./sandbox.wrf.dev ] && echo Exists: WRF Sandbox || true @@ -16,7 +17,7 @@ wrf.dev: @if [ ! -f ./wrf.dev.sif ]; then\ echo Building the WRF dev;\ make -C ../.. alma8.base;\ - ln -s ../../containers/alma8.base.sif .;\ + ln -fs ../../containers/alma8.base.sif .;\ sudo singularity build wrf.dev.sif Singularity.dev;\ fi @[ -f ./wrf.dev.sif ] && echo Exists: WRF dev || true diff --git a/models/WRF/Singularity.dev b/models/WRF/Singularity.dev index fe2ef87..0aa44f2 100644 --- a/models/WRF/Singularity.dev +++ b/models/WRF/Singularity.dev @@ -9,28 +9,32 @@ baseimage AlmaLinux8 %apprun downloadwrf WRF_VERSION=4.4.1 if [ $# -ne 0 ]; then - WRF_VERSION=1 + 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 %apphelp downloadwrf -This will download the WRF source code from GitHub. Use the Version as a commandline argument. -curl -SL -o WRF-{WRF_VERSION}.tar.gz https://github.com/wrf-model/WRF/releases/download/v{WRF_VERSION}/v{WRF_VERSION}.tar.gz - +[WRF] APP: downloadwrf +[WRF] This will download the WRF source code from GitHub. The version can be specified by an argument. +[WRF] run: singularity run --app downloadwrf 4.4.1 +[WRF] curl -SL -o WRF-{WRF_VERSION}.tar.gz https://github.com/wrf-model/WRF/releases/download/v{WRF_VERSION}/v{WRF_VERSION}.tar.gz +[WRF] %apprun downloadwps WPS_VERSION=4.4 if [ $# -ne 0 ]; then - WPS_VERSION=1 + 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 %apphelp downloadwps -This will download the WPS source code from GitHub. Use the Version as a commandline argument. -curl -SL -o WPS-{WPS_VERSION}.tar.gz https://github.com/wrf-model/WPS/archive/refs/tags/v{WPS_VERSION}.tar.gz - +[WRF] APP: downloadwps +[WRF] This will download the WPS source code from GitHub. The version can be specified by an argument. +[WRF] run: singularity run --app downloadwps 4.4 +[WRF] curl -SL -o WPS-{WPS_VERSION}.tar.gz https://github.com/wrf-model/WPS/archive/refs/tags/v{WPS_VERSION}.tar.gz +[WRF] %post # Every line will be a layer in the container @@ -56,7 +60,7 @@ yum update -y \ libxml2 libxml2-devel perl-XML-LibXML ImageMagick \ python3 python3-pip python3-devel \ tar bash tcsh time which zlib zlib-devel \ - git scl \ + git \ gnupg2 \ hostname \ iproute \ @@ -84,7 +88,6 @@ CNAME=wrf.dev echo "export PS1=\"[IMGW-$CNAME]\w\$ \"" >> /.singularity.d/env/99-zz-custom-env.sh # not sure why that does not happen as default echo "export PKG_CONFIG_PATH=/usr/lib64/openmpi/lib/pkgconfig/" >> $SINGULARITY_ENVIRONMENT -# add App informaiton to runscript %environment export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:/usr/lib64:/lib64:/lib diff --git a/models/WRF/Singularity.sandbox.dev b/models/WRF/Singularity.sandbox.dev index f8d1b1f..5c67239 100644 --- a/models/WRF/Singularity.sandbox.dev +++ b/models/WRF/Singularity.sandbox.dev @@ -1,5 +1,5 @@ Bootstrap: localimage -From: ../../containers/alma8.base.sif +From: alma8.base.sif %labels maintainer IT-IMGW <it.img-wien@univie.ac.at> diff --git a/models/WRF/Singularity.wrf b/models/WRF/Singularity.wrf index b21f2cf..62f467a 100644 --- a/models/WRF/Singularity.wrf +++ b/models/WRF/Singularity.wrf @@ -23,9 +23,9 @@ 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 +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 cd /wrf/WRF \ @@ -74,8 +74,8 @@ Stage: final %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 0f733b6..76d61f7 100644 --- a/models/WRF/scripts/runscript +++ b/models/WRF/scripts/runscript @@ -18,13 +18,18 @@ if [ $# -gt 0 ]; then exec "$@" echo "[WRF] Finished inside the container." else + # Look for apps? + if [ -d /scif/apps ]; then + echo "[WRF] Available Apps: $(ls /scif/apps)" + echo "[WRF] run: singularity run-help --app [] $SINGULARITY_NAME" + fi # interactive - echo "[WRF] Welcome inside an IMGW container!" echo "[WRF] Get help: singularity run-help $SINGULARITY_NAME" echo "[WRF] $WRF_VERSION, $WRF_BUILD_TARGET" echo "[WRF] $WRF_BUILD_TARGET -> /wrf/run" echo "[WRF] exe -> /wrf/bin" - echo "[WRF] Automatic copy of /wrf/run to current directory: ./$(basename $SINGULARITY_CONTAINER) init" - echo "[WRF] e.g. run real.exe from outside: ./$(basename $SINGULARITY_CONTAINER) real.exe" + echo "[WRF] Automatic copy of /wrf/run to current directory: ./$SINGULARITY_NAME init" + echo "[WRF] e.g. run real.exe from outside: ./$SINGULARITY_NAME real.exe" + echo "[WRF][INSIDE] Welcome inside an IMGW container!" exec /.singularity.d/actions/shell "$@" fi \ No newline at end of file -- GitLab