Difference between revisions of "Jobscript"

From HPC Wiki
Jump to navigation Jump to search
Line 25: Line 25:
 
[[LSF#Job_Submission|LSF]], [[SLURM#Job_Submission|SLURM]], [[Torque#Job_Submission|Torque]].
 
[[LSF#Job_Submission|LSF]], [[SLURM#Job_Submission|SLURM]], [[Torque#Job_Submission|Torque]].
  
Note that all incoming jobs (defined in a jobscript) are added to a queue. When to run a job, is decided by the [[scheduler]]. The waiting time depends on various factors, e. g. the time and memory you asked for in your jobscript. The rule of thumb is: the more resources your job needs, the longer it will be queued.
+
Note that all incoming jobs (defined in a jobscript) are added to a queue. The [[scheduler]] decides at which time a certain job gets executed. The waiting time depends on various factors, e. g. the time and memory you asked for in your jobscript. The rule of thumb is: the more resources your job needs, the longer it will be queued.
  
 
You can always check the current status of your submitted jobs and their ids with shell commands that are also explained on the pages linked above.
 
You can always check the current status of your submitted jobs and their ids with shell commands that are also explained on the pages linked above.
 
  
 
== References ==
 
== References ==
  
 
[[jobscript-examples|Jobscript examples]]
 
[[jobscript-examples|Jobscript examples]]

Revision as of 16:33, 10 April 2018

General

A jobscript can be used to submit the job you wish to execute to a batch system. It is very similar to a sh-file and generally uses the same format, but is more powerful. Besides shell commands, you can use so-called magic cookies, e.g. #BSUB for LSF systems. This allows you to specify a lot of parameters, e.g. the time and memory your application requires or - if your code runs in parallel - the number of compute slots to employ.

Structure

Like a regular sh-file, your jobscript should start with a shebang (#!), e. g. in case you are using zsh:

#!/usr/bin/env zsh

Usually, this first line is followed by several directives using magic cookies, that are explained in more depth in the next section. The third part of a jobscript consists of shell commands, for example, to change to your working directory and to execute your application.

Magic Cookies

The magic cookie differs from scheduler to scheduler. Click here to figure out which one you are going to need. Depending on your batch system, these pages provide more information on how to use magic cookies in your jobscript: LSF, SLURM, Torque.

One advantage of jobscripts is that the parameters that are prefixed with magic cookies are treated like comments. So you can run your jobscript as an sh-file without the scheduler and if that works, still adjust and correct the lines with magic cookies destined for the scheduler.

Job Submission

Depending on your scheduler, proceed to one of the links below to find out how to submit your job to a batch system that controls the resources for computation: LSF, SLURM, Torque.

Note that all incoming jobs (defined in a jobscript) are added to a queue. The scheduler decides at which time a certain job gets executed. The waiting time depends on various factors, e. g. the time and memory you asked for in your jobscript. The rule of thumb is: the more resources your job needs, the longer it will be queued.

You can always check the current status of your submitted jobs and their ids with shell commands that are also explained on the pages linked above.

References

Jobscript examples