Difference between revisions of "LSF"

From HPC Wiki
Jump to navigation Jump to search
Line 37: Line 37:
 
| -n <num_procs> || number of processes to execute MPI application with
 
| -n <num_procs> || number of processes to execute MPI application with
 
|}
 
|}
 +
 +
 +
== Jobscript Examples ==
 +
 +
This serial job will run a given executable, in this case "myapp.exe".
 +
<syntaxhighlight lang="zsh">
 +
#!/usr/bin/env zsh
 +
 +
### Job name
 +
#BSUB -J MYJOB
 +
 +
### File where the output should be written
 +
#BSUB -o MYJOB_OUTPUT.txt
 +
 +
### Time your job needs to execute, e. g. 1 h 20 min
 +
#BSUB -W 1:20
 +
 +
### Memory your job needs, e. g. 1000 MB
 +
#BSUB -M 1000
 +
 +
### Stack limit per process, e. g. 20 MB
 +
#BSUB -S 20
 +
 +
### The last part consists of regular shell commands:
 +
### Change to working directory
 +
cd /home/user/mywork
 +
 +
### Execute your application
 +
myapp.exe
 +
</syntaxhighlight>
 +
 +
 +
This OpenMP job will start the [[Parallel_Programming|parallel program]] "myapp.exe" with 24 threads.
 +
<syntaxhighlight lang="zsh">
 +
#!/usr/bin/env zsh
 +
 +
### Job name
 +
#BSUB -J OMPJOB
 +
 +
### File where the output should be written
 +
#BSUB -o OMPJOB_OUTPUT
 +
 +
### Time your job needs to execute, e. g. 15 min
 +
#BSUB -W 0:15
 +
 +
### Memory your job needs, e. g. 1000 MB
 +
#BSUB -M 1000
 +
 +
### Stack limit per process, e. g. 50 MB
 +
#BSUB -S 50
 +
 +
###
 +
 +
### Change to working directory
 +
cd /home/user/mywork
 +
 +
### Execute your application
 +
myapp.exe
 +
</syntaxhighlight>

Revision as of 15:02, 28 March 2018

#BSUB Usage

If you are writing a jobscript for an LSF batch system, the magic cookie is "#BSUB". To use it, start a new line in your script with "#BSUB". Following that, you can put one of the parameters shown below, where the word written in <...> should be replaced with a value.

Basic settings:

Parameter Function
-J <name> job name
-o <path> path to the file where the job output is written
-e <path> path to the file for the job error output (if not set, it will be written to output file as well)

Requesting resources:

Parameter Function Default
-W <runlimit> runtime limit in the format [hour:]minute; once the time specified is up, the job will be killed by the scheduler 00:15
-M <memlimit> memory limit per process in MB 512
-S <stacklimit> limit of stack size per process in MB 10

Parallel programming (read more here):

Parameter Function
-a openmp start a parallel job for a shared-memory system
-n <num_threads> number of threads to execute OpenMP application with
-a openmpi start a parallel job for a distributed-memory system
-n <num_procs> number of processes to execute MPI application with


Jobscript Examples

This serial job will run a given executable, in this case "myapp.exe".

#!/usr/bin/env zsh

### Job name
#BSUB -J MYJOB

### File where the output should be written
#BSUB -o MYJOB_OUTPUT.txt

### Time your job needs to execute, e. g. 1 h 20 min
#BSUB -W 1:20

### Memory your job needs, e. g. 1000 MB 
#BSUB -M 1000

### Stack limit per process, e. g. 20 MB
#BSUB -S 20

### The last part consists of regular shell commands:
### Change to working directory
cd /home/user/mywork

### Execute your application
myapp.exe


This OpenMP job will start the parallel program "myapp.exe" with 24 threads.

#!/usr/bin/env zsh

### Job name
#BSUB -J OMPJOB

### File where the output should be written
#BSUB -o OMPJOB_OUTPUT

### Time your job needs to execute, e. g. 15 min
#BSUB -W 0:15

### Memory your job needs, e. g. 1000 MB 
#BSUB -M 1000

### Stack limit per process, e. g. 50 MB
#BSUB -S 50

###

### Change to working directory
cd /home/user/mywork

### Execute your application
myapp.exe