In this exercise, we will submit and observe the outcomes of a few trivial jobs in order to become more familiar with Slurm job dependencies.

  1. Log on to Stampede2 or Frontera (or a different Slurm cluster) and create a simple batch script that will sleep for two minutes, as shown below. You can call it "sleep.sh". Edit the --mail-user line with your e-mail address. If you need to specify an account from among several that are available to you, remove one of the hashes from the -A line, and enter your account name there.
  2. Create a simple bash script done.sh that does nothing except echo a statement.
  3. Submit the sleep job, and examine the terminal output from sbatch. Make note of the job ID, as you will use it immediately in the next step.
    login1.stampede2(1009)$ sbatch sleep.sh
    
    -----------------------------------------------------------------
                Welcome to the Stampede2 Supercomputer                 
    -----------------------------------------------------------------
    
    No reservation for this job
    --> Verifying valid submit host (login1)...OK
    --> Verifying valid jobname...OK
    --> Enforcing max jobs per user...OK
    [...]
    Submitted batch job 8071232
  4. Immediately after sbatch queues the sleep job, submit the dependent job. Use the command-line argument --dependency=after: to specify it as dependent on the job you just submitted:
  5. Now look at the status of your jobs in the queue. If you submitted the dependent job soon enough, you may see them both concurrently executing in the queue:
  6. Now examine the output files. They will be named <slurm-jobId>.out.
Info: "after" dependency

Notice that the dependent job ran after the main job started, but before it ended. This is allowable under the semantics of the "after" dependency. In the dependencies page, "after" means the job may begin after the dependent job(s) have started executing. Using this, jobs may be ordered with respect to their starting times.

This is exactly what happened in this scenario: the main job started, then the dependent job started, and finally the main job finished.

On your own, repeat the exercise, but this time change the command-line argument to --dependency=after: when submitting the dependent job. This specifies that the dependent job will launch only after the main job terminates. Verify that this is the observed behavior.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement