Difference between revisions of "Job submission"

From ScientificComputing
Jump to: navigation, search
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
The three ways to access computing resources are
 +
# [[Job_submission#Basic_job_submission|Submit a job through command line]]
 +
# [[Job_submission#Job_script_and_#BSUB_pragmas|Submit a job through a job bash script using #BSUB pragmas]]
 +
# [[Job_submission#Interactive_session_on_a_compute_node|Get an interactive session on a compute node]]
 +
 
== Basic job submission ==
 
== Basic job submission ==
 
A basic BSUB job submission command consists of three parts:
 
A basic BSUB job submission command consists of three parts:
Line 6: Line 11:
 
| style="width: 50px; background: #BFE5D9; text-align: center;"| bsub  
 
| style="width: 50px; background: #BFE5D9; text-align: center;"| bsub  
 
| style="width: 100px; background: #B2D9EA;text-align: center; "| LSF options
 
| style="width: 100px; background: #B2D9EA;text-align: center; "| LSF options
| style="width: 50px; background: #FFBDAF; text-align: center"| job  
+
| style="width: 50px; background: #FFBDAF; text-align: center"| Job
 +
|}
 +
 
 +
where
 +
{| style="color: black;"
 +
|-
 +
| style="width: 50px; background: #BFE5D9; text-align: center;"| bsub ||    is the LSF submit command.
 +
|-
 +
| style="width: 100px; background: #B2D9EA;text-align: center; "| LSF options ||   are for requesting resources and defining job-related options.
 +
|-
 +
| style="width: 50px; background: #FFBDAF; text-align: center"| Job ||   is a computing job to be submitted.
 
|}
 
|}
  
# The BSUB executable command
 
# LSF options requesting resources and defining job-related options
 
# A job to be submitted
 
  
 
Here is an example:
 
Here is an example:
Line 25: Line 37:
 
  Generic job.
 
  Generic job.
 
  Job <8146539> is submitted to queue <normal.4h>
 
  Job <8146539> is submitted to queue <normal.4h>
# Job type, e.g., Generic Job or MPI Job
+
The output includes
# Job ID, e.g., 8146539
+
# Job type, e.g., Generic Job, MPI Job or Abaqus Job
# The queue, e.g., normal.4h
+
# Unique job ID, e.g., 8146539
 +
# The queue, e.g., normal.4h, normal.24h, or normal.120h
 +
 
  
=== Job ===
+
{|style="color: black;"
 +
|-
 +
| style="width: 150px; color: black;background: #FFBDAF; text-align: center"| '''Job'''
 +
|}
 
A job can be one of the following:
 
A job can be one of the following:
 
{| class="wikitable" | style="background:white;"
 
{| class="wikitable" | style="background:white;"
Line 51: Line 68:
 
|}
 
|}
  
=== LSF options ===
+
 
 +
{|style="color: black;"
 +
|-
 +
| style="width: 150px; color: black;background: #B2D9EA; text-align: center"| '''LSF options'''
 +
|}
 
==== Requesting resources ====
 
==== Requesting resources ====
 
{| class="wikitable" | style="background:white;"
 
{| class="wikitable" | style="background:white;"
Line 106: Line 127:
  
 
== Interactive session on a compute node ==
 
== Interactive session on a compute node ==
To run a quick test or a benchmark, you can request an interactive session on a compute node by using the BSUB option -I, -Ip or -Is, for example:
+
To run a quick test or a benchmark, you can request an interactive session on a compute node by using the BSUB option  
 +
-I, -Ip or -Is
 +
 
 +
For example:
 
  [jarunanp@eu-login-38 ~]$ bsub -n 4 -W 01:00 -Is bash
 
  [jarunanp@eu-login-38 ~]$ bsub -n 4 -W 01:00 -Is bash
 
  Generic job.
 
  Generic job.

Revision as of 08:14, 4 February 2021

The three ways to access computing resources are

  1. Submit a job through command line
  2. Submit a job through a job bash script using #BSUB pragmas
  3. Get an interactive session on a compute node

Basic job submission

A basic BSUB job submission command consists of three parts:

bsub LSF options Job

where

bsub   is the LSF submit command.
LSF options   are for requesting resources and defining job-related options.
Job   is a computing job to be submitted.


Here is an example:

bsub -n 1 -W 4:00 -R "rusage[mem=4096]" "python myscript.py"

When the job is submitted, LSF shows job's information:

$ bsub -n 1 -W 4:00 -R "rusage[mem=4096]" "python myscript.py"
Generic job.
Job <8146539> is submitted to queue <normal.4h>

The output includes

  1. Job type, e.g., Generic Job, MPI Job or Abaqus Job
  2. Unique job ID, e.g., 8146539
  3. The queue, e.g., normal.4h, normal.24h, or normal.120h


Job

A job can be one of the following:

Job Command Examples of job submission command
a single Linux command cmd
a program with its path /path/to/myprogram bsub ./bin/hello
a command or program with its arguments cmd arg1 arg2 bsub echo hello
multiple commands "cmd1 ; cmd2" bsub "date; pwd; ls -l"
piped command "cmd1 | cmd2"
a command with I/O redirection, quote "cmd<in >out" bsub "du -sk /scratch > du.out"
a here document, passed via "<<" << EOF ... EOF
a shell script, passed via "<" < script bsub < hello.sh


LSF options

Requesting resources

Resources Format Default values
Maximum run time -W HH:MM 04:00 (4 hours)
Number of processors -n nprocs 1 processor
Memory -R "rusage[mem=2048]" 1024 MB per core
Scratch space -R "rusage[scratch=10000]"

Other LSF options

-o outfile append job’s standard output to outfile
-e errfile append job’s error messages to errfile
-R "rusage[...]" advanced resource requirement (memory,...)
-J jobname assign a jobname to the job
-w "depcond" wait until dependency condition is satisfied
-Is submit an interactive job with pseudo-terminal
-B /-N send an email when the job begins/ends
-u user@domain use this address instead of username@ethz.ch

LSF submission line advisor can assist your to find LSF options you need.

Job script and #BSUB pragmas

Create a job script called job_script.bsub

#!/bin/bash
#BSUB -n 24                     # 24 cores
#BSUB -W 8:00                   # 8-hour run-time
#BSUB -R "rusage[mem=4000]"     # 4000 MB per core
#BSUB -J analysis1
#BSUB -o analysis1.out
#BSUB -e analysis1.err
#BSUB -N

module load gcc/6.3.0 openmpi/3.0.2
cd /path/to/execution/folder
mpirun myprogram arg1

Submit a job

bsub < job_script.bsub

Interactive session on a compute node

To run a quick test or a benchmark, you can request an interactive session on a compute node by using the BSUB option

-I, -Ip or -Is

For example:

[jarunanp@eu-login-38 ~]$ bsub -n 4 -W 01:00 -Is bash
Generic job.
Job <161197292> is submitted to queue <normal.4h>.
<<Waiting for dispatch ...>>
<<Starting on eu-ms-001-15>>
[jarunanp@eu-ms-001-15 ~]$

Further reading