61 lines
1.8 KiB
Markdown
61 lines
1.8 KiB
Markdown
# Slurm Examples
|
|
|
|
## Single core based job examples
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
#SBATCH --partition=hourly # Using 'hourly' will grant higher priority
|
|
#SBATCH --ntasks-per-core=2 # Request the max ntasks be invoked on each core
|
|
#SBATCH --hint=multithread # Use extra threads with in-core multi-threading
|
|
#SBATCH --time=00:30:00 # Define max time job will run
|
|
#SBATCH --output=myscript.out # Define your output file
|
|
#SBATCH --error=myscript.err # Define your error file
|
|
|
|
module purge
|
|
module load $MODULE_NAME # where $MODULE_NAME is a software in PModules
|
|
srun $MYEXEC # where $MYEXEC is a path to your binary file
|
|
```
|
|
|
|
## Multi-core based jobs example
|
|
|
|
### Pure MPI
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
#SBATCH --job-name=purempi
|
|
#SBATCH --partition=daily # Using 'daily' will grant higher priority
|
|
#SBATCH --time=24:00:00 # Define max time job will run
|
|
#SBATCH --output=%x-%j.out # Define your output file
|
|
#SBATCH --error=%x-%j.err # Define your error file
|
|
#SBATCH --exclusive
|
|
#SBATCH --nodes=1
|
|
#SBATCH --ntasks=128
|
|
#SBATCH --hint=nomultithread
|
|
##SBATCH --cpus-per-task=1
|
|
|
|
module purge
|
|
module load $MODULE_NAME # where $MODULE_NAME is a software in PModules
|
|
srun $MYEXEC # where $MYEXEC is a path to your binary file
|
|
```
|
|
|
|
### Hybrid
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
#SBATCH --job-name=hybrid
|
|
#SBATCH --partition=daily # Using 'daily' will grant higher priority
|
|
#SBATCH --time=24:00:00 # Define max time job will run
|
|
#SBATCH --output=%x-%j.out # Define your output file
|
|
#SBATCH --error=%x-%j.err # Define your error file
|
|
#SBATCH --exclusive
|
|
#SBATCH --nodes=1
|
|
#SBATCH --ntasks=128
|
|
#SBATCH --hint=multithread
|
|
#SBATCH --cpus-per-task=2
|
|
|
|
module purge
|
|
module load $MODULE_NAME # where $MODULE_NAME is a software in PModules
|
|
srun $MYEXEC # where $MYEXEC is a path to your binary file
|
|
```
|
|
|