Submitting jobs¶
There are two ways you can run your jobs, namely submitting a Slurm script and running a job interactively. Either way, jobs are submitted to CARC by the command sbatch. For more information on available options type man sbatch
Submitting the Slurm Script to the Batch Scheduler¶
In order to run our simple Slurm script, we will need to submit it to the batch scheduler using the command sbatch followed by the name of the script we would like to run. For more information please see our page on writing a Slurm batch script.
In the following example, we submit our simple hello.sbatch script to the batch scheduler using sbatch. Note that it returns the job identifier when the job is successfully submitted. You can use this job identifier to query the status of your job from your shell.
For example:
Interactive Slurm Jobs¶
Normally a job is submitted for execution on a cluster or supercomputer using the command sbatch script.sbatch. CARC recommends that all jobs are submitted this way as job submission fails if there are errors in resources requested. However, at times, such as when debugging, it can be useful to run a job interactively. To run a job in this way type salloc followed by resources requested, and the batch manager will log you into a node where you can directly run your code.
For example, here is the output from an interactive session running our simple helloworld_paralell.sbatch script:
salloc --nodes=1 --ntasks=8 --time=00:05:00
salloc: Granted job allocation 156469
salloc: Nodes easley004 are ready for job
module load openmpi
bash helloworld_parallel.sbatch
Job 156469 running on 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
Hello World from host easley004
helloworld_parallel.sbatch script.
Migrated from UNM-CARC QuickBytes (last source update 2025-12-03). Spotted a problem? Open an issue or pull request.