Skip to content

Commit

Permalink
Trim env files by declaring common variables
Browse files Browse the repository at this point in the history
(cherry picked from commit 325891d)
  • Loading branch information
DavidHuber-NOAA committed Jun 25, 2024
1 parent 3ebb2b9 commit f722cdb
Show file tree
Hide file tree
Showing 8 changed files with 325 additions and 635 deletions.
70 changes: 20 additions & 50 deletions env/AWSPW.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export NTHSTACK=1024000000
ulimit -s unlimited
ulimit -a

# Calculate common variables
nth_max=$((npe_node_max / npe_node))
NTHREADSmax=$((nth:-${nth_max}))
NTHREADS1=$((nth:-1))
[[ ${NTHREADSmax} -gt ${nth_max} ]] && NTHREADSmax=${nth_max}
[[ ${NTHREADS1} -gt ${nth_max} ]] && NTHREADS1=${nth_max}
APRUN="${launcher} -n ${npe}"

if [[ "${step}" = "fcst" ]] || [[ "${step}" = "efcs" ]]; then

ppn="npe_node_${RUN}"
Expand All @@ -34,81 +42,43 @@ if [[ "${step}" = "fcst" ]] || [[ "${step}" = "efcs" ]]; then

elif [[ "${step}" = "post" ]]; then

nth_max=$((npe_node_max / npe_node))

export NTHREADS_NP=${nth_np:-1}
[[ ${NTHREADS_NP} -gt ${nth_max} ]] && export NTHREADS_NP=${nth_max}
export APRUN_NP="${launcher} -n ${npe}"
export NTHREADS_NP=${NTHREADS1}
export APRUN_NP="${APRUN}"

export NTHREADS_DWN=${nth_dwn:-1}
[[ ${NTHREADS_DWN} -gt ${nth_max} ]] && export NTHREADS_DWN=${nth_max}
export APRUN_DWN="${launcher} -n ${npe_dwn}"

elif [[ "${step}" = "ecen" ]]; then

nth_max=$((npe_node_max / npe_node))

export NTHREADS_ECEN=${nth:-${nth_max}}
[[ ${NTHREADS_ECEN} -gt ${nth_max} ]] && export NTHREADS_ECEN=${nth_max}
export APRUN_ECEN="${launcher} -n ${npe}"
export NTHREADS_ECEN=${NTHREADSmax}
export APRUN_ECEN="${APRUN}"

export NTHREADS_CHGRES=${nth_chgres:-12}
[[ ${NTHREADS_CHGRES} -gt ${npe_node_max} ]] && export NTHREADS_CHGRES=${npe_node_max}
export APRUN_CHGRES="time"

export NTHREADS_CALCINC=${nth_calcinc:-1}
[[ ${NTHREADS_CALCINC} -gt ${nth_max} ]] && export NTHREADS_CALCINC=${nth_max}
export APRUN_CALCINC="${launcher} -n ${npe}"
export APRUN_CALCINC="${APRUN}"

elif [[ "${step}" = "esfc" ]]; then

nth_max=$((npe_node_max / npe_node))

export NTHREADS_ESFC=${nth:-${nth_max}}
[[ ${NTHREADS_ESFC} -gt ${nth_max} ]] && export NTHREADS_ESFC=${nth_max}
export APRUN_ESFC="${launcher} -n ${npe}"
export NTHREADS_ESFC=${NTHREADSmax}
export APRUN_ESFC="${APRUN}"

export NTHREADS_CYCLE=${nth_cycle:-14}
[[ ${NTHREADS_CYCLE} -gt ${npe_node_max} ]] && export NTHREADS_CYCLE=${npe_node_max}
export APRUN_CYCLE="${launcher} -n ${npe}"
export APRUN_CYCLE="${APRUN}"

elif [[ "${step}" = "epos" ]]; then

nth_max=$((npe_node_max / npe_node))

export NTHREADS_EPOS=${nth:-${nth_max}}
[[ ${NTHREADS_EPOS} -gt ${nth_max} ]] && export NTHREADS_EPOS=${nth_max}
export APRUN_EPOS="${launcher} -n ${npe}"

elif [[ "${step}" = "postsnd" ]]; then

export CFP_MP="YES"

nth_max=$((npe_node_max / npe_node))

export NTHREADS_POSTSND=${nth:-1}
[[ ${NTHREADS_POSTSND} -gt ${nth_max} ]] && export NTHREADS_POSTSND=${nth_max}
export APRUN_POSTSND="${launcher} -n ${npe}"

export NTHREADS_POSTSNDCFP=${nth_postsndcfp:-1}
[[ ${NTHREADS_POSTSNDCFP} -gt ${nth_max} ]] && export NTHREADS_POSTSNDCFP=${nth_max}
export APRUN_POSTSNDCFP="${launcher} -n ${npe_postsndcfp} ${mpmd_opt}"

elif [[ "${step}" = "awips" ]]; then

nth_max=$((npe_node_max / npe_node))

export NTHREADS_AWIPS=${nth:-2}
[[ ${NTHREADS_AWIPS} -gt ${nth_max} ]] && export NTHREADS_AWIPS=${nth_max}
export APRUN_AWIPSCFP="${launcher} -n ${npe} ${mpmd_opt}"

export NTHREADS_EPOS=${NTHREADSmax}
export APRUN_EPOS="${APRUN}"

elif [[ "${step}" = "fit2obs" ]]; then

nth_max=$((npe_node_max / npe_node))

export NTHREADS_FIT2OBS=${nth:-1}
[[ ${NTHREADS_FIT2OBS} -gt ${nth_max} ]] && export NTHREADS_FIT2OBS=${nth_max}
export MPIRUN="${launcher} -n ${npe}"
export NTHREADS_FIT2OBS=${NTHREADS1}
export MPIRUN="${APRUN}"

fi
8 changes: 8 additions & 0 deletions env/GAEA.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ export mpmd_opt="--multi-prog --output=mpmd.%j.%t.out"
ulimit -s unlimited
ulimit -a

# Calculate common variables
nth_max=$((npe_node_max / npe_node))
NTHREADSmax=$((nth:-${nth_max}))
NTHREADS1=$((nth:-1))
[[ ${NTHREADSmax} -gt ${nth_max} ]] && NTHREADSmax=${nth_max}
[[ ${NTHREADS1} -gt ${nth_max} ]] && NTHREADS1=${nth_max}
APRUN="${launcher} -n ${npe}"

if [[ "${step}" = "fcst" ]]; then

ppn="npe_node_${RUN}"
Expand Down
Loading

0 comments on commit f722cdb

Please sign in to comment.