Skip to content

Exercise 3: Creating and Running Jobs on the Cluster

In this exercise, we will refer to the examples provided in the chapter on running jobs on the cluster.

a) Command srun

Run the following jobs:

  • Four instances of the hostname program on a single compute node using the reservation fri. Set the job name to my_job. Use the srun command.
  • Two instances of the program hostname on each of the two compute nodes in the reservation fri. Set the memory per CPU to 10 MB. Use the srun command.

b) Commands sbatch and scancel

Using the sbatch command, run the following jobs:

  • Run four instances of the program hostname on a single node using the sbatch command. Follow the provided example.
  • Run an instance of the program sleep 600 using the sbatch command. The program will wait for 600 seconds after and exit without any output. Use the fri reservation. Use the provided example script as a base and adjust the time limit accordingly. Wait for the job to start running (status R), then cancel it prematurely using the scancel command.

Hint

To cancel the execution of a job, we will need the job ID, which is displayed by the sbatch command or can be obtained using the squeue command.