Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 21 additions & 11 deletions submitting_sbatch_jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*