Expand run_mpmd.sh to support multi-core multi-threaded tasks#54
Closed
Expand run_mpmd.sh to support multi-core multi-threaded tasks#54
Conversation
Add table format support for heterogeneous MPMD command files: - is_table_format(): Detects double-quoted table format command files - parse_table_line(): Parses command, ntasks, and nthreads from table lines - run_table_mpmd(): Executes heterogeneous MPMD using colon-separated launcher syntax with per-task wrapper scripts for OMP_NUM_THREADS - Serial mode handles table format by running commands sequentially - Simple format behavior is completely unchanged (backward compatible) - Works with both srun (Slurm) and mpiexec (PALS/Cray) launchers Co-authored-by: DavidHuber-NOAA <69919478+DavidHuber-NOAA@users.noreply.github.com>
- Document that mixed format files are not supported - Add warning when a single entry exceeds total allocated tasks - Add clarifying comments for mpiexec --depth and --cpu-bind depth Co-authored-by: DavidHuber-NOAA <69919478+DavidHuber-NOAA@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Expand run_mpmd.sh to support threaded and multi-core tasks
Expand run_mpmd.sh to support multi-core multi-threaded tasks
Mar 16, 2026
…md-script-threading
…md-script-threading
3e04518 to
8c45a65
Compare
| # Almost works!! launch_args+=" -n ${task_counts[idx]} --env OMP_PLACES=threads --env OMP_PROC_BIND=spread --env OMP_NUM_THREADS=${thread_counts[idx]} --cpu-bind verbose,none ${cmds[idx]}" | ||
| # Test config | ||
| list=$(seq -s, 0 $((task_counts[idx] - 1))) | ||
| if [[ -z "${cpu_list}" ]]; then |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
Suggested change
| if [[ -z "${cpu_list}" ]]; then | |
| if [[ -z "${cpu_list}" ]]; then |
| echo "\"${DATA}/${FCSTEXEC}\"" '"128" "1"' > cmdfile | ||
| echo "\"${HOMEglobal}/dev/scripts/run_date.sh\"" '"1"' '"1"' >> cmdfile | ||
|
|
||
| ${USHglobal}/run_mpmd.sh cmdfile |
| echo "\"${DATA}/${FCSTEXEC}\"" '"128" "1"' > cmdfile | ||
| echo "\"${HOMEglobal}/dev/scripts/run_date.sh\"" '"1"' '"1"' >> cmdfile | ||
|
|
||
| ${USHglobal}/run_mpmd.sh cmdfile |
There was a problem hiding this comment.
[shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
| ${USHglobal}/run_mpmd.sh cmdfile | |
| "${USHglobal}"/run_mpmd.sh cmdfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ush/run_mpmd.shonly supported single-core, single-threaded tasks. This adds a table format for heterogeneous MPMD jobs while preserving full backward compatibility.Table format uses double-quoted columns: command, ntasks, nthreads (columns 2-3 default to 1 if missing):
Format is auto-detected from the first non-empty, non-comment line. Simple (unquoted) command files behave identically to before.
Key additions:
is_table_format()— detects table format by leading double quoteparse_table_line()— extracts command, ntasks, nthreads viaawkrun_table_mpmd()— builds heterogeneous launch commands using colon-separated syntax with per-entry wrapper scripts forOMP_NUM_THREADS-n <ntasks> -c <nthreads> wrapper : ...-np <ntasks> --depth <nthreads> --cpu-bind depth wrapper : ...OMP_NUM_THREADSOMP_NUM_THREADS=1moved from global to simple-format-only scopeResolves NOAA-EMC#3088
Type of change
Change characteristics
How has this been tested?
Checklist
Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.