From c9f6877d12369ddae0826cb3b4db890799ff809f Mon Sep 17 00:00:00 2001 From: Henry Fricke Date: Thu, 30 Jul 2026 10:18:30 -0600 Subject: [PATCH] submitting_sbatch_jobs.md --- README.md | 2 +- submitting_sbatch_jobs.md | 32 +++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d1d6624b..841efcf7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Quickbytes are tutorials designed to help CARC users. * [SSH keys and Config file](https://github.com/UNM-CARC/QuickBytes/blob/table-of-contents-readme/ssh_keygen_config.md) * [Transferring data](https://github.com/UNM-CARC/QuickBytes/blob/master/transfer_data.md) * [PBS/TORQUE](https://github.com/UNM-CARC/QuickBytes/blob/master/pbs-torque.md) - * [Submitting Slurm Scripts with SBatch](https://github.com/UNM-CARC/QuickBytes/blob/master/submitting_sbtach_jobs.md) + * [Submitting Slurm Scripts with SBatch](https://github.com/UNM-CARC/QuickBytes/blob/master/submitting_sbatch_jobs.md) * [Check running jobs](https://github.com/UNM-CARC/QuickBytes/blob/master/checking_on_running_jobs.md) * [Managing modules](https://github.com/UNM-CARC/QuickBytes/blob/master/module_management.md) * [Intro to Slurm](https://github.com/UNM-CARC/QuickBytes/blob/master/Intro_to_slurm.md) diff --git a/submitting_sbatch_jobs.md b/submitting_sbatch_jobs.md index 7da5031e..c533a361 100644 --- a/submitting_sbatch_jobs.md +++ b/submitting_sbatch_jobs.md @@ -176,26 +176,36 @@ salloc: Granted job allocation 156469 salloc: Nodes easley004 are ready for job ``` -Once on the node, load your modules and run your script normally: +Once on the node, load your modules and run your script. Note that plain `bash helloworld_parallel.sh` would only ever run the script once, regardless of how many tasks you requested — to actually run it across all 8 tasks you need to launch it with `mpirun`: ```bash module load openmpi -bash helloworld_parallel.sh +mpirun -np 8 bash $PWD/helloworld_parallel.sh ``` ``` -Hello World from host easley004 -Hello World from host easley004 -Hello World from host easley004 -Hello World from host easley004 -Hello World from host easley004 -Hello World from host easley004 -Hello World from host easley004 -Hello World from host easley004 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 +Job 1035500 running on easley031 +Hello World from host easley031 ``` +`helloworld_parallel.sh` here is the same kind of script as `hello.sh` above, printing a hello message with `$SLURM_JOB_ID` and the hostname. An absolute path (`$PWD/helloworld_parallel.sh`) is used since `mpirun` doesn't necessarily preserve your current directory across every task. + When you are finished, type `exit` to release the node back to the pool. > **Note:** CARC recommends submitting jobs via `sbatch` wherever possible, as job submission will catch errors in resource requests before the job runs. Reserve interactive sessions for debugging and development. -*This quickbyte was validated on 6/17/2026* +*This quickbyte was validated on 7/30/2026*