#!/bin/bash

#BSUB -oo _SREFDIR_/run/sref_gfsprep__MEMBER_.log
#BSUB -eo _SREFDIR_/run/sref_gfsprep__MEMBER_.log
#BSUB -J SREF_GFSPREP__MEMBER_
#BSUB -n 54
#BSUB -x
#BSUB -R span[ptile=16]
##BSUB -R span[ptile=4]
##BSUB -R span[ptile=1]
#BSUB -M 600                   #MB for executable
#BSUB -W 00:30
#BSUB -P SREF-T2O
#BSUB -q "dev"

set -aeux

trap 'echo "SREF error _MEMBER_ GFSPREP" >> /gpfs/dell2/ptmp/$LOGNAME/tmpnwprd/jlogfile_sref' INT TERM ERR
echo "SREF started _MEMBER_ GFSPREP" >> /gpfs/dell2/ptmp/$LOGNAME/tmpnwprd/jlogfile_sref

. /usrx/local/prod/lmod/lmod/init/bash
module load lsf/10.1
module load ips/18.0.1.163
module load prod_util/1.1.0
module load grib_util/1.1.0
module load NetCDF/4.5.0
module load EnvVars/1.0.2 settarg/7.7 prod_envir/1.0.2
module load impi/18.0.1
module load CFP/2.0.1
module list

export OMP_NUM_THREADS=1

export RUN_ENVIR=para
export envir=prod
export job=$$

export CONFIG_FILE=_SREFDIR_/parm/sref_para_config_dell

export PDY=_PDY_
export cyc=_CYC_
#export FLENGTH=_FLENGTH_
#export INCR=_INCR_
export MEMBER=_MEMBER_
export MACHINE=_MACHINE_
export N_TASK=$LSB_DJOB_NUMPROC

_SREFDIR_/jobs/JSREF_WRF_GFSPREP

echo "SREF finished _MEMBER_ GFSPREP" >> /gpfs/dell2/ptmp/$LOGNAME/tmpnwprd/jlogfile_sref

#bsub < _SREFDIR_/run/SREF_POST__MODEL___MEMBER_.bsub
#echo "SREF waiting _MODEL_ _MEMBER_ POST" >> /gpfs/dell2/ptmp/$LOGNAME/tmpnwprd/jlogfile_sref

