From 54bb59efa44758d0ae41bee887c41d26fbf8ce82 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 5 Jan 2023 20:43:36 -0600 Subject: [PATCH 1/2] Fix post sounding job A few minor errors were blocking the sounding job from completing successfully: - CFP APRUN command was using incorrect number of PEs - Updates were needed to run on Orion. Removed the machine-specific code for Hera and Jet so it runs the same on all machines, while refactoring it to use C-style loop. - Bash base errors (see also #1195), which are now corrected, while refactoring to use C-style loop. Refs #1195 Fixes #1211 --- env/HERA.env | 2 +- env/ORION.env | 2 +- scripts/exgfs_atmos_postsnd.sh | 23 ++++------------------- ush/gfs_bufr.sh | 15 ++++++--------- 4 files changed, 12 insertions(+), 30 deletions(-) diff --git a/env/HERA.env b/env/HERA.env index 0f903611c5e..e8facf076b4 100755 --- a/env/HERA.env +++ b/env/HERA.env @@ -278,7 +278,7 @@ elif [[ "${step}" = "postsnd" ]]; then export NTHREADS_POSTSNDCFP=${nth_postsndcfp:-1} [[ ${NTHREADS_POSTSNDCFP} -gt ${nth_max} ]] && export NTHREADS_POSTSNDCFP=${nth_max} - export APRUN_POSTSNDCFP="${launcher} -n ${npe_postsnd} ${mpmd_opt}" + export APRUN_POSTSNDCFP="${launcher} -n ${npe_postsndcfp} ${mpmd_opt}" elif [[ "${step}" = "awips" ]]; then diff --git a/env/ORION.env b/env/ORION.env index 61f6105eb3b..f311d27e561 100755 --- a/env/ORION.env +++ b/env/ORION.env @@ -276,7 +276,7 @@ elif [[ "${step}" = "postsnd" ]]; then export NTHREADS_POSTSNDCFP=${nth_postsndcfp:-1} [[ ${NTHREADS_POSTSNDCFP} -gt ${nth_max} ]] && export NTHREADS_POSTSNDCFP=${nth_max} - export APRUN_POSTSNDCFP="${launcher} -n ${npe_postsnd} ${mpmd_opt}" + export APRUN_POSTSNDCFP="${launcher} -n ${npe_postsndcfp} ${mpmd_opt}" elif [[ "${step}" = "awips" ]]; then diff --git a/scripts/exgfs_atmos_postsnd.sh b/scripts/exgfs_atmos_postsnd.sh index 114ab4e2344..2f9c0b8334b 100755 --- a/scripts/exgfs_atmos_postsnd.sh +++ b/scripts/exgfs_atmos_postsnd.sh @@ -137,34 +137,19 @@ fi # Create Regional Collectives of BUFR data and # add appropriate WMO Headers. ######################################## -collect=' 1 2 3 4 5 6 7 8 9' -if [ $machine == "HERA" -o $machine == "JET" ]; then -for m in ${collect} -do -sh $USHbufrsnd/gfs_sndp.sh $m -done - -################################################ -# Convert the bufr soundings into GEMPAK files -################################################ -sh $USHbufrsnd/gfs_bfr2gpk.sh - -else rm -rf poe_col -for m in ${collect} -do -echo "sh $USHbufrsnd/gfs_sndp.sh $m " >> poe_col +for (( m = 1; m <10 ; m++ )); do + echo "sh ${USHbufrsnd}/gfs_sndp.sh ${m} " >> poe_col done -mv poe_col cmdfile +nl -n ln -v 0 poe_col > cmdfile cat cmdfile chmod +x cmdfile ${APRUN_POSTSNDCFP} cmdfile -sh $USHbufrsnd/gfs_bfr2gpk.sh -fi +sh "${USHbufrsnd}/gfs_bfr2gpk.sh" ############## END OF SCRIPT ####################### diff --git a/ush/gfs_bufr.sh b/ush/gfs_bufr.sh index 1e8ad8cde0b..65d81ce5213 100755 --- a/ush/gfs_bufr.sh +++ b/ush/gfs_bufr.sh @@ -50,13 +50,12 @@ cat << EOF > gfsparm / EOF -hh=${FSTART} -while (( hh <= FEND )); do - hh2=$(printf %02i ${hh}) - hh3=$(printf %03i ${hh}) +for (( hr = 10#${FSTART}; hr <= 10#${FEND}; hr = hr + 10#${FINT} )); do + hh2=$(printf %02i "${hr}") + hh3=$(printf %03i "${hr}") -#--------------------------------------------------------- -# Make sure all files are available: + #--------------------------------------------------------- + # Make sure all files are available: ic=0 while (( ic < 1000 )); do if [ ! -f "${COMIN}/${RUN}.${cycle}.logf${hh3}.${logfm}" ]; then @@ -71,11 +70,9 @@ while (( hh <= FEND )); do exit 2 fi done -#------------------------------------------------------------------ + #------------------------------------------------------------------ ln -sf "${COMIN}/${RUN}.${cycle}.atmf${hh3}.${atmfm}" "sigf${hh2}" ln -sf "${COMIN}/${RUN}.${cycle}.sfcf${hh3}.${atmfm}" "flxf${hh2}" - - hh=$((hh + FINT)) done # define input BUFR table file. From 42fcc29ebe63eb6afe288cc11554bbfb354aeaa4 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Mon, 9 Jan 2023 11:02:44 -0600 Subject: [PATCH 2/2] Add conditional for CFP CPU number in postsnd The MPMD scripts on slurm machines need to be prefaced with the processor rank(s) to be used, but PBS (WCOSS2) does not recognize the ranks. Added the paradigm of other jobs of using `$CFP_MP` to control whether rank numbers are added, then setting it to "YES" on slurm machines. Refs: #1211 --- env/HERA.env | 2 ++ env/ORION.env | 2 ++ env/S4.env | 2 ++ scripts/exgfs_atmos_postsnd.sh | 6 +++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/env/HERA.env b/env/HERA.env index e8facf076b4..d61c738cd07 100755 --- a/env/HERA.env +++ b/env/HERA.env @@ -270,6 +270,8 @@ elif [[ "${step}" = "init" ]]; then elif [[ "${step}" = "postsnd" ]]; then + export CFP_MP="YES" + nth_max=$((npe_node_max / npe_node_postsnd)) export NTHREADS_POSTSND=${nth_postsnd:-1} diff --git a/env/ORION.env b/env/ORION.env index f311d27e561..a05d1bcec0a 100755 --- a/env/ORION.env +++ b/env/ORION.env @@ -268,6 +268,8 @@ elif [[ "${step}" = "init" ]]; then elif [[ "${step}" = "postsnd" ]]; then + export CFP_MP="YES" + nth_max=$((npe_node_max / npe_node_postsnd)) export NTHREADS_POSTSND=${nth_postsnd:-1} diff --git a/env/S4.env b/env/S4.env index a4a156dd191..25e335e334e 100755 --- a/env/S4.env +++ b/env/S4.env @@ -270,6 +270,8 @@ elif [[ ${step} = "init" ]]; then elif [[ ${step} = "postsnd" ]]; then + export CFP_MP="YES" + npe_node_postsnd=${npe_node_postsnd:-${npe_node_max}} nth_max=$((npe_node_max / npe_node_postsnd)) diff --git a/scripts/exgfs_atmos_postsnd.sh b/scripts/exgfs_atmos_postsnd.sh index 2f9c0b8334b..44676f122ab 100755 --- a/scripts/exgfs_atmos_postsnd.sh +++ b/scripts/exgfs_atmos_postsnd.sh @@ -142,7 +142,11 @@ for (( m = 1; m <10 ; m++ )); do echo "sh ${USHbufrsnd}/gfs_sndp.sh ${m} " >> poe_col done -nl -n ln -v 0 poe_col > cmdfile +if [[ ${CFP_MP:-"NO"} == "YES" ]]; then + nl -n ln -v 0 poe_col > cmdfile +else + mv poe_col cmdfile +fi cat cmdfile chmod +x cmdfile