prep.slurm - UK-FVCOM-Usergroup/uk-fvcom GitHub Wiki

This requires the wrf_ecmwf_metgrid_templates.

#!/bin/bash --login

Do the interpolation of ECMWF-Interim data onto the WRF nested grids. Run

convert_files_ecmwf.slurm before this script.

#SBATCH --nodes=8 #SBATCH --ntasks-per-node=20 #SBATCH --threads-per-core=1 #SBATCH --job-name=prep_wrf #SBATCH --partition=all #SBATCH --time=48:00:00 ##SBATCH --mail-type=ALL #SBATCH --mail-user=pica

set -eu

For metgrid.exe to run in parallel.

np=$SLURM_NTASKS #np=${np:-$(nproc)} if [ -z $np ]; then np=1 fi

module load intel || true module load intel-mpi || true module load hdf5-intelmpi || true module load netcdf-intelmpi || true

Resolve all paths to absolute from relative.

export WORKDIR=$(readlink -f $(pwd))

Set the number of threads to 1

This prevents any system libraries from automatically

using threading.

export OMP_NUM_THREADS=1

Magic stuff from the Atos scripts.

export I_MPI_PIN_PROCS=0-19 export I_MPI_EXTRA_FILESYSTEM=on export I_MPI_EXTRA_FILESYSTEM_LIST=gpfs export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi.so

cd $WORKDIR

namelist=templates/namelist.wps years=(2011) grids=(grids/geo_em.d??.nc)

for year in ${years[@]}; do if [ ! -d ./$year ]; then mkdir ./$year fi

(
    cd $year

    # Link to the model grids.
    for grid in ${grids[@]}; do
        if [ ! -h $(basename $grid) ]; then
            ln -s ../$grid
        fi
    done

    # Do not clobber old namelists.
    if [ -f namelist.wps ]; then
        mv namelist.wps namelist.wps.$$
    fi
    cp ../$namelist namelist.wps

    sed -i 's/2002-'/$year-'/g' namelist.wps
    sed -i 's/2003-'/$(($year + 1))-'/g' namelist.wps

    echo "about to launch srun..."
    srun -K -n $np ../bin/metgrid.exe

    # Tidy up
    rm namelist.wps
    for grid in ${grids[@]}; do
        rm $(basename $grid)
    done
)

done

⚠️ **GitHub.com Fallback** ⚠️