First DAIC Job

Submit your first job to DAIC with SLURM and check the results.

Before you begin

You should already be logged in to DAIC. If not, complete First Login.

Submit a simple job

1. Create a working directory

$ mkdir -p ~/my-first-job && cd ~/my-first-job

2. Create a Python script

hello.py

import socket
print(f"Hello from {socket.gethostname()}")

3. Create a SLURM batch script

submit.sh

#!/bin/bash
#SBATCH --account=<your-account>
#SBATCH --partition=all
#SBATCH --time=0:05:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=1G
#SBATCH --output=slurm_%j.out

srun python hello.py

4. Submit the job

$ sbatch submit.sh
Submitted batch job 294

5. Monitor the job

$ squeue -u $USER
  JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
    294       all submit.s  netid01  R       0:02      1 gpu23

6. Check the output

Once completed, view the output file:

$ cat slurm_294.out
Hello from gpu23.ethernet.tudhpc

Request a GPU

To run GPU jobs, add the --gres flag to your batch script:

gpu_submit.sh

#!/bin/bash
#SBATCH --account=<your-account>
#SBATCH --partition=all
#SBATCH --time=0:30:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --gres=gpu:1
#SBATCH --output=slurm_%j.out

srun nvidia-smi
srun python my_gpu_script.py

Next steps