#!/bin/sh
#PBS -N jgefs_atmos_prdgen_16_35d_c00_00
#PBS -j oe
#PBS -S /bin/bash
#PBS -q dev
#PBS -A GEFS-DEV
#PBS -l walltime=4:30:00
#PBS -l place=vscatter,select=1:ncpus=2:mem=6GB:mpiprocs=2
#PBS -l debug=true

#PBS -V

set -x

cd $PBS_O_WORKDIR

#module purge
export MEMBER=${MEMBER:-c00}

export model=gefs
# to get HOMEgefs
f=lsf_common.sh
if [[ -f "$f" ]]; then
    echo "$f exists."
    source $f
elif [[ -f "../$f" ]]; then
    echo "../$f exists."
    source ../$f
elif [[ -f "../../$f" ]]; then
    echo "../../$f exists."
    source ../../$f
elif [[ -f "../../../$f" ]]; then
    echo "../../../$f exists."
    source ../../../$f
fi
. ${HOMEgefs}/versions/run.ver

module purge
module load envvar/$envvar_ver
module load PrgEnv-intel/$PrgEnv_intel_ver
module load craype/$craype_ver
module load intel/$intel_ver

module load cray-pals/$cray_pals_ver
module load cray-mpich/$cray_mpich_ver

module load prod_util/$prod_util_ver
module load prod_envir/$prod_envir_ver

module load libjpeg/$libjpeg_ver
module load grib_util/$grib_util_ver

module load wgrib2/$wgrib2_ver
module load cfp/$cfp_ver

export USE_CFP=YES

module list

# EXPORT list here
ulimit -s unlimited
ulimit -a

f=lsf_common.sh
if [[ -f "$f" ]]; then
    echo "$f exists."
    source $f
elif [[ -f "../$f" ]]; then
    echo "../$f exists."
    source ../$f
elif [[ -f "../../$f" ]]; then
    echo "../../$f exists."
    source ../../$f
elif [[ -f "../../../$f" ]]; then
    echo "../../../$f exists."
    source ../../../$f
fi

#---
export RUNMEM=ge${MEMBER}

export total_tasks=2
export OMP_NUM_THREADS=1
export taskspernode=2
export FORECAST_SEGMENT=lr

export envir=prod
# CALL executable job script here
${HOMEgefs}/jobs/JGEFS_ATMOS_PRDGEN