Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
abstract:farber:runjobs:runjobs [2017-12-05 09:01] – sraskar | abstract:farber:runjobs:runjobs [2018-08-09 15:01] (current) – [What is a Job?] anita | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | + | ====== Running applications |
- | ====== Running applications ====== | + | |
- | //This section uses the wiki's [[00_conventions|documentation conventions]].// | + | ====== Introduction |
- | ===== Introduction ===== | + | |
- | The Grid Engine job scheduling system is used to manage and control the computing | + | The Grid Engine job scheduling system is used to manage and control the resources |
- | [[: | + | Without a job scheduler, a cluster user would need to manually search for the resources required by his or her job, perhaps by randomly logging-in to nodes and checking for other users' programs already executing thereon. |
- | In order to schedule any job (interactively or batch) on a cluster, you must set your [[general/userguide/04_compute_environ?&# | + | An outdated but still mostly relevant description of Grid Engine and job scheduling can be found in the first chapter of the [[http://docs.oracle.com/ |
- | See [[general:/ | + | ===== What is a Job? ===== |
- | ===== Runtime environment ===== | + | In this context, a //job// consists of: |
- | Generally, your runtime environment (path, environment variables, etc.) should be the same as your compile-time environment. Usually, the best way to achieve this is to put the relevant VALET commands in shell scripts. You can reuse common sets of commands | + | * a sequence |
+ | * a list of resource requirements and other properties affecting scheduling of the job | ||
+ | * a set of environment variables | ||
- | <note important> | + | For an // |
- | If you are writing | + | |
- | <code bash> | + | |
- | source / | + | |
- | </ | + | |
- | You do not need this command when you | + | |
- | - type commands, or source | + | |
- | - include lines in the file to be submitted | + | |
- | </ | + | |
- | ===== Job scheduling system ===== | + | |
- | A job scheduling system is used to manage | + | By comparison, a // |
- | Each investing-entity' | + | * a //job script// can be reused |
+ | * when resources are granted to the job it will execute immediately (day or night), yielding increased job throughput | ||
- | The standby queues are available for projects requiring more slots than purchased, or to take advantage of idle nodes when a job would have to wait in the owner queue. | + | An individual' |
- | A spillover queue may be available for the case where a job is submitted to the owner queue, and there are standby jobs consuming needed slots. Instead of waiting, the jobs will be sent to the spillover queue to start on a similar idle node. | + | ===== Queues ===== |
- | A spare queue may be on a cluster to make spare nodes available | + | At its most basic, a //queue// represents |
- | Each cluster | + | < |
- | ===== The job queues ===== | + | When submitting a job to Grid Engine, a user can explicitly specify which queue to use: doing so will place that queue' |
- | Each investing-entity on a cluster an //owner queue// that exclusively use the investing-entity' | + | ===== Job scheduling system ===== |
- | There are also node-wise queues, //standby//, // | + | A job scheduling system is used to manage and control the computing resources for all jobs submitted to a cluster. This includes load balancing, limiting resources, reconciling requests for memory |
- | When submitting | + | Each investing-entity' |
- | The queue to which a job is assigned depends primarily on six factors: | + | The standby queues are available for projects requiring more slots than purchased, or to take advantage of idle nodes when a job would have to wait in the owner queue. Other workgroup nodes will be used, so standby jobs have a time limit, and users are limited |
- | * Whether | + | A spillover queue may be available for the case where a job is submitted to the owner queue, and there are standby jobs consuming |
- | * Which parallel environment (e.g., mpi, threads) is needed | + | |
- | * Which or how much of a resource is needed (e.g., max clock time, memory requirements) | + | |
- | * Resources your job will consume (e.g. an entire node, max memory usage) | + | |
- | * Whether the job is non-interactive or interactive | + | |
- | For each investing-entity, | ||
- | ^ <<// | ||
- | ^ '' | ||
- | ^ '' | ||
- | ^ '' | ||
- | ^ '' | ||
- | **Details by cluster** | ||
- | * [[clusters: | + | ==== Grid Engine ==== |
- | * [[clusters: | + | |
+ | The Grid Engine job scheduling system is used to manage and control the computing resources for all jobs submitted to a cluster. This includes load balancing, reconciling requests for memory and processor cores with availability of those resources, suspending and restarting jobs, and managing jobs with different priorities. Grid Engine on Farber is Univa Grid Engine but still referred to as SGE. | ||
+ | In order to schedule any job (interactively or batch) on a cluster, you must set your [[abstract/ | ||
+ | See [[abstract/ | ||
- | ===== Scheduling Jobs ===== | + | ===== Runtime environment |
- | In order to schedule any job (interactively or batch) on a cluster, you must set your [[general/ | + | Generally, your runtime environment |
- | ==== Interactive jobs (qlogin) ==== | + | <note important> |
- | + | If you are writing an executable script that does not have the **-l** option on the **bash** command, and you want to include VALET commands in your script, then you should include | |
- | All interactive jobs should be scheduled to run on the compute nodes, | + | |
- | + | ||
- | An interactive session (job) can often be made non-interactive ([[general: | + | |
- | + | ||
- | // | + | |
- | + | ||
- | Then the non-interactive ([[general: | + | |
- | + | ||
- | == Starting an interactive session == | + | |
- | + | ||
- | Remember | + | |
- | + | ||
- | Type | + | |
<code bash> | <code bash> | ||
- | workgroup -g //investing-entity/ | + | source |
</ | </ | ||
- | + | You do not need this command when you | |
- | Type | + | - type commands, or source |
- | <code bash> | + | - include lines in the file to be submitted |
- | qlogin | + | |
- | </ | + | |
- | + | ||
- | to reserve one scheduling slot and start an interactive shell on one of your workgroup //investing-entity// compute nodes. | + | |
- | + | ||
- | Type | + | |
- | <code bash> | + | |
- | qlogin –pe threads 12 | + | |
- | </ | + | |
- | + | ||
- | to reserve 12 scheduling slots and start an interactive shell on one your workgroup // | + | |
- | + | ||
- | Type | + | |
- | <code bash> | + | |
- | exit | + | |
- | </ | + | |
- | + | ||
- | to terminate the interactive shell and release the scheduling slot(s). | + | |
- | + | ||
- | == Acceptable nodes for interactive sessions == | + | |
- | + | ||
- | Use the login (head) node for interactive program development including Fortran, C, and C++ program compilation. Use Grid Engine (**qlogin**) to start interactive shells on your workgroup // | + | |
- | + | ||
- | ==== Batch jobs (qsub) ==== | + | |
- | + | ||
- | Grid Engine provides | + | |
- | + | ||
- | ^ command ^ Action ^ | + | |
- | | '' | + | |
- | + | ||
- | For example, | + | |
- | + | ||
- | qsub myproject.qs | + | |
- | + | ||
- | or to submit a standby job that waits for idle nodes (up to 240 slots for 8 hours), | + | |
- | + | ||
- | qsub -l standby=1 myproject.qs | + | |
- | + | ||
- | or to submit a standby job that waits for idle 48-core nodes (if you are using a cluster with 48-core nodes like Mills) | + | |
- | + | ||
- | qsub -l standby=1 -q standby.q@@48core myproject.qs | + | |
- | + | ||
- | or to submit a standby job that waits for idle 24-core nodes, (would not be assigned to any 48-core nodes; important for consistency of core assignment) | + | |
- | + | ||
- | qsub -l standby=1 -q standby.q@@24core myproject.qs | + | |
- | + | ||
- | or to submit | + | |
- | + | ||
- | qsub -l standby=1, | + | |
- | + | ||
- | or to submit to the four hour standby queue spanning just the 24-core nodes. | + | |
- | + | ||
- | qsub -l standby=1, | + | |
- | + | ||
- | This file '' | + | |
- | + | ||
- | <note tip> | + | |
- | We strongly recommend that you use a script file that you pattern after the prototypes in **/ | + | |
- | + | ||
- | Reusable job scripts help you maintain a consistent batch environment across runs. The optional **.qs** filename suffix signifies a **q**ueue-**s**ubmission script file. | + | |
</ | </ | ||
- | <note important> | ||
+ | ===== Getting Help ===== | ||
- | === Grid Engine | + | Grid Engine |
- | In every batch session, Grid Engine sets environment variables that are useful within job scripts. Here are some common examples. The rest appear in the ENVIRONMENTAL VARIABLES section of the **qsub**** man** page.//// | ||
- | |||
- | ^ Environment variable ^ Contains ^ | ||
- | | **HOSTNAME** | Name of the execution (compute) node | | ||
- | | **JOB_ID** | Batch job id assigned by Grid Engine | | ||
- | | **JOB_NAME** | Name you assigned to the batch job (See [[# | ||
- | | **NSLOTS** | Number of // | ||
- | | **SGE_TASK_ID** | Task id of an array job sub-task (See [[# | ||
- | | **TMPDIR** | Name of directory on the (compute) node scratch filesystem | | ||
- | |||
- | When Grid Engine assigns one of your job's tasks to a particular node, it creates a temporary work directory on that node's 1-2 TB local scratch disk. And when the task assigned to that node is finished, Grid Engine removes the directory and its contents. The form of the directory name is | ||
- | |||
- | **/ | ||
- | |||
- | For example after '' | ||
<code bash> | <code bash> | ||
- | echo $TMPDIR | + | [traine@farber ~]$ man qstat |
</ | </ | ||
- | to see the name of the node scratch directory for this interactive job. | ||
- | < | ||
- | / | ||
- | </ | ||
- | See [[: | + | to learn more about a Grid Engine command (in this case, '' |
- | Grid Engine uses these environment variables' | + | <code base> |
- | + | [traine@farber ~]$ qstat -help | |
- | ^ File name patter ^ Description ^ | + | usage: qstat [options] |
- | | [$JOB_NAME].o[$JOB_ID] | Default **output** filename | | + | [-cb] view additional binding specific parameters |
- | | [$JOB_NAME].e[$JOB_ID] | **error** filename (when not joined to output) | | + | [-ext] view additional attributes |
- | | [$JOB_NAME].po[$JOB_ID] | Parallel job **output** output (Empty for most queues) | | + | |
- | | [$JOB_NAME].pe[$JOB_ID] | Parallel job **error** filename (Usually empty) | | + | |
- | + | ||
- | + | ||
- | === Command options for qsub === | + | |
- | + | ||
- | The most commonly used **qsub** options fall into two categories: // | + | |
- | + | ||
- | The table below lists **qsub**' | + | |
- | + | ||
- | ^ Option / Argument ^ Function ^ | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | ^ Special notes for IT clusters: ^^ | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | ^ The resource-management options for '' | + | |
- | | '' | + | |
- | | '' | + | |
- | + | ||
- | For example, putting the lines | + | |
- | < | + | |
- | #$ -l h_cpu=1: | + | |
- | #$ –pe threads 12 | + | |
- | </ | + | |
- | in the job script tells Grid Engine to set a hard limit of 1.5 hours on the CPU time resource for the job, and to assign 12 processors for your job. | + | |
- | + | ||
- | Grid Engine tries to satisfy all of the resource-management options you specify in a job script or as qsub command-line options. If there is a queue already defined that accepts jobs having that particular combination of requests, Grid Engine assigns your job to that queue. | + | |
- | + | ||
- | ==== Array jobs ==== | + | |
- | + | ||
- | An [[: | + | |
- | + | ||
- | <note tip> | + | |
- | The '' | + | |
- | + | ||
- | For example, the '' | + | |
- | </ | + | |
- | + | ||
- | The general form of the **qsub** option is: | + | |
- | + | ||
- | -t // | + | |
- | + | ||
- | with a default step_size of 1. For these examples, the option would be: | + | |
- | + | ||
- | -t 2-5000: | + | |
- | + | ||
- | Additional simple how-to examples for [[http:// | + | |
- | + | ||
- | ==== Chaining jobs ==== | + | |
- | + | ||
- | If you have a multiple jobs where you want to automatically run other job(s) after the execution of another job, then you can use chaining. When you chain jobs, remember to check the status of the other job to determine if it successfully completed. This will prevent the system from flooding the scheduler with failed jobs. Here is a simple chaining example with three job scripts '' | + | |
- | + | ||
- | <code - doThing1.qs> | + | |
- | + | ||
- | #$ -N doThing1 | + | |
- | # | + | |
- | # If you want an email message to be sent to you when your job ultimately | + | |
- | # finishes, edit the -M line to have your email address and change the | + | |
- | # next two lines to start with #$ instead of just # | + | |
- | # -m eas | + | |
- | # -M my_address@mail.server.com | + | |
- | # | + | |
- | # Setup the environment; | + | |
- | # line: | + | |
- | + | ||
- | # Now append all of your shell commands necessary to run your program | + | |
- | # after this line: | + | |
- | | + | |
</ | </ | ||
- | <code - doThing2.qs> | + | //This section uses the wiki's [[http://docs-dev.hpc.udel.edu/doku.php#documentation-conventions|documentation conventions]].// |
- | + | ||
- | #$ -N doThing2 | + | |
- | #$ -hold_jid doThing1 | + | |
- | # | + | |
- | # If you want an email message to be sent to you when your job ultimately | + | |
- | # finishes, edit the -M line to have your email address and change the | + | |
- | # next two lines to start with #$ instead of just # | + | |
- | # -m eas | + | |
- | # -M my_address@mail.server.com | + | |
- | # | + | |
- | # Setup the environment; | + | |
- | # line: | + | |
- | + | ||
- | # Now append all of your shell commands necessary to run your program | + | |
- | # after this line: | + | |
- | + | ||
- | # Here is where you should add a test to make sure | + | |
- | # that dotask1 successfully completed before running | + | |
- | # ./dotask2 | + | |
- | # You might check if a specific file(s) exists that you would | + | |
- | # expect after a successful dotask1 run, something like this | + | |
- | # if [ -e dotask1.log ] | + | |
- | # then ./dotask2 | + | |
- | # fi | + | |
- | # If dotask1.log does not exist it will do nothing. | + | |
- | # If you don't need a test, then you would run the task. | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | <code - doThing3.qs> | + | |
- | + | ||
- | #$ -N doThing3 | + | |
- | #$ -hold_jid doThing2 | + | |
- | # | + | |
- | # If you want an email message to be sent to you when your job ultimately | + | |
- | # finishes, edit the -M line to have your email address and change the | + | |
- | # next two lines to start with #$ instead of just # | + | |
- | # -m eas | + | |
- | # -M my_address@mail.server.com | + | |
- | # | + | |
- | # Setup the environment; | + | |
- | # line: | + | |
- | + | ||
- | # Now append all of your shell commands necessary to run your program | + | |
- | # after this line: | + | |
- | # Here is where you should add a test to make sure | + | |
- | # that dotask2 successfully completed before running | + | |
- | # ./dotask3 | + | |
- | # You might check if a specific file(s) exists that you would | + | |
- | # expect after a successful dotask2 run, something like this | + | |
- | # if [ -e dotask2.log ] | + | |
- | # then ./dotask3 | + | |
- | # fi | + | |
- | # If dotask2.log does not exist it will do nothing. | + | |
- | # If you don't need a test, then just run the task. | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | Now submit all three job scripts. In this example, we are using account '' | + | |
- | + | ||
- | < | + | |
- | [(it_css:traine)@mills ~]$ qsub doThing1.qs | + | |
- | [(it_css: | + | |
- | [(it_css: | + | |
- | </code> | + | |
- | + | ||
- | The basic flow is '' | + | |
- | + | ||
- | You might also want to have '' | + | |
- | + | ||
- | < | + | |
- | + | ||
- | #$ -N doThing2 | + | |
- | # | + | |
- | # If you want an email message to be sent to you when your job ultimately | + | |
- | # finishes, edit the -M line to have your email address and change the | + | |
- | # next two lines to start with #$ instead of just # | + | |
- | # -m eas | + | |
- | # -M my_address@mail.server.com | + | |
- | # | + | |
- | # Setup the environment; | + | |
- | # line: | + | |
- | + | ||
- | # Now append all of your shell commands necessary to run your program | + | |
- | # after this line: | + | |
- | ./dotask2 | + | |
- | </ | + | |
- | + | ||
- | <code - doThing3.qs> | + | |
- | + | ||
- | #$ -N doThing3 | + | |
- | #$ -hold_jid doThing1, | + | |
- | # | + | |
- | # If you want an email message to be sent to you when your job ultimately | + | |
- | # finishes, edit the -M line to have your email address and change the | + | |
- | # next two lines to start with #$ instead of just # | + | |
- | # -m eas | + | |
- | # -M my_address@mail.server.com | + | |
- | # | + | |
- | # Setup the environment; | + | |
- | # line: | + | |
- | + | ||
- | # Now append all of your shell commands necessary to run your program | + | |
- | # after this line: | + | |
- | # Here is where you should add a test to make sure | + | |
- | # that dotask1 and dotask2 successfully completed before running | + | |
- | # ./dotask3 | + | |
- | # You might check if a specific file(s) exists that you would | + | |
- | # expect after a successful dotask1 and dotask2 run, something like this | + | |
- | # if [ -e dotask1.log -a -e dotask2.log | + | |
- | # then ./dotask3 | + | |
- | # fi | + | |
- | # If both files do not exist it will do nothing. | + | |
- | # If you don't need a test, then just run the task. | + | |
- | ./dotask3 | + | |
- | </ | + | |
- | + | ||
- | Now submit all three jobs again. However this time '' | + | |
- | before running. | + | |