From 8556541daa79b0180fde48a58a8dcfb2f8c56ea5 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Wed, 25 Oct 2023 16:15:28 -0400 Subject: [PATCH] Fix incorrect usage of CFP on WCOSS2 (#1977) --- ush/run_mpmd.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ush/run_mpmd.sh b/ush/run_mpmd.sh index 352a411312..24cb3f2656 100755 --- a/ush/run_mpmd.sh +++ b/ush/run_mpmd.sh @@ -4,6 +4,9 @@ source "${HOMEgfs}/ush/preamble.sh" cmdfile=${1:?"run_mpmd requires an input file containing commands to execute in MPMD mode"} +# Determine the number of MPMD processes from incoming ${cmdfile} +nprocs=$(wc -l < "${cmdfile}") + # Local MPMD file containing instructions to run in CFP mpmd_cmdfile="${DATA:-}/mpmd_cmdfile" if [[ -s "${mpmd_cmdfile}" ]]; then rm -f "${mpmd_cmdfile}"; fi @@ -19,7 +22,6 @@ if [[ "${launcher:-}" =~ ^srun.* ]]; then # srun-based system e.g. Hera, Orion ((nm=nm+1)) done < "${cmdfile}" - nprocs=$(wc -l < "${mpmd_cmdfile}") set +e # shellcheck disable=SC2086 ${launcher:-} ${mpmd_opt:-} -n ${nprocs} "${mpmd_cmdfile}" @@ -42,7 +44,8 @@ elif [[ "${launcher:-}" =~ ^mpiexec.* ]]; then # mpiexec done < "${cmdfile}" chmod 755 "${mpmd_cmdfile}" - ${launcher:-} "${mpmd_cmdfile}" + # shellcheck disable=SC2086 + ${launcher:-} -np ${nprocs} ${mpmd_opt:-} "${mpmd_cmdfile}" rc=$? if (( rc == 0 )); then out_files=$(find . -name 'mpmd.*.out')