diff --git a/templates/build_icon.sh b/templates/build_icon.sh index 4d7520c2449f2e36c7ae0b8ffb7bd36152094dd3..e1db87552109fb6b78a7b6cb1a300c1a33ab23bd 100644 --- a/templates/build_icon.sh +++ b/templates/build_icon.sh @@ -6,10 +6,9 @@ SPACK_URL=%spack.url% SPACK_BRANCH=%spack.branch% SPACK_COMPILER=%spack.compiler% - # If the workdir directory does not exist create it -if [ ! -d ${WORKDIR} ] ; then - mkdir -p ${WORKDIR} +if [ ! -d ${WORKDIR} ]; then + mkdir -p ${WORKDIR} fi # Go to the working directory @@ -17,7 +16,7 @@ cd ${WORKDIR} # Check if experiment's spack installation already exists, if it doesn't, clone it. SPACK_ENV=spack/share/spack/setup-env.sh -if [ ! -f ${SPACK_ENV} ] ; then +if [ ! -f ${SPACK_ENV} ]; then git clone ${SPACK_URL} -b ${SPACK_BRANCH} #TODO: Would be good to enable the re-utilization of existing spack packages (via packages.yaml or upstreams.yaml) fi @@ -25,29 +24,28 @@ fi # Setup the environment source ${SPACK_ENV} - -if [ $( spack find icon-nwp@${ICON_VERSION} &> /dev/null ; echo $? ) -ne 0 ]; then - echo "Installing icon-nwp@${ICON_VERSION}." - # Compile openmpi with schedulers=slurm - spack install openmpi%${SPACK_COMPILER}+legacylaunchers schedulers=slurm - spack install icon-nwp@${ICON_VERSION}%${SPACK_COMPILER} ^openmpi%${SPACK_COMPILER} +if [ $( + spack find icon-nwp@${ICON_VERSION} &>/dev/null + echo $? +) -ne 0 ]; then + echo "Installing icon-nwp@${ICON_VERSION}." + # Compile openmpi with schedulers=slurm + spack install openmpi%${SPACK_COMPILER}+legacylaunchers schedulers=slurm + spack install icon-nwp@${ICON_VERSION}%${SPACK_COMPILER} ^openmpi%${SPACK_COMPILER} else - echo "icon-nwp@${ICON_VERSION} already installed!" + echo "icon-nwp@${ICON_VERSION} already installed!" fi - # Need to get ECCODES DWD definitions: eccodes_version=$(spack find eccodes | grep eccodes@ | cut -d "@" -f 2) definitions_tar_file=eccodes_definitions.edzw-${eccodes_version}-1.tar.bz2 -if [ ! -f ${definitions_tar_file}]; then +if [ ! -f ${definitions_tar_file} ]; then defs_url=https://opendata.dwd.de/weather/lib/grib/${definitions_tar_file} wget ${defs_url} # Decompress definitions file tar -xf ${definitions_tar_file} # Create a file containing the environment variable that needs to be set in order to use DWD's definitions: - echo "export ECCODES_DEFINITION_PATH=${WORKDIR}/definitions.edzw-${eccodes_version}-1" > eccodes_defs.env + echo "export ECCODES_DEFINITION_PATH=${WORKDIR}/definitions.edzw-${eccodes_version}-1" >eccodes_defs.env fi - -