These are the currently available examples from the LSF Introduction Guide.
We want to compile and run a Fortran program in a job. The program itself
is in the file 'program.f', and we estimate it will take about 2000 CPU-seconds
(30 minutes) for the program to complete. We will put our intructions in
the file job.
#BSUB-q S # Job queue #BSUB-o job.output # output is sent to file job.output #BSUB-J fortran # name of the job #BSUB-c 30 # Time limit in minutes # My instructions # Changing to the directory where my program is cd cd programs # Compilation of the program in Fortran 90 (use f77 for Fortran 77) f90 -O3 -fastsse -o run program.f # And we run it; output is redirected to the file 'data/output' run data/file1 > data/output # Show the size of the outputfile, and remove the executable ls -l data/output rm run
We simply enter the command
bsub < job
When the job is launched correctly, the system will reply with something
similar to
Job <1303> is submitted to queue <S>
To follow the progress of your job, you can use the command
bjobs, like in
bjobs -u all.
Or you can use the command bpeek to examine the current output
of a specific job. Once the job is finished, it will disappear from the RUN
queue. You will find the result in the file job.output.
We want to run a Matlab program in a job. The Matlab commands are in the
file 'matlab.in', and we estimate it will take about 50000 CPU-seconds (834
minutes) for the program to complete. As it is not too urgent, we will tell
LSF to start the job next Friday evening (2nd of next month in our case)
at 10 PM. The job queue will be SMP1 as our CPU time is too high
for the S queue and we don't need any higher queues as we will be using
only one processor. We will put our job instructions in the file
matlab.job. Important: if you run a matlab
program in background or a job, add a
quit command at the end of your matlab instructions;
otherwise your matlab program will start looping until a time-limit is exceeded.
#BSUB-q SMP1 # Job queue #BSUB-o matlab.out # Output file for Matlab #BSUB-J Matlab # name of the job #BSUB-c 834 # Time limit in minutes # My instructions # Changing to the directory where my program is cd cd matlab-dir # Run our Matlab program; we will also 'time' it # output from the matlab instruction will be matlab.out time matlab < matlab.in > matlab.out
We simply enter the command
bsub < matlab.job
When the job is launched correctly, the system will reply with something similar to
Job <1303> is submitted to queue
<SMP1>
To follow the progress of your job, you can use the command
bjobs, like in bjobs -u
all.
Or you can use the command bpeek to examine the current output
of a specific job. Once the job is finished, it will disappear from the RUN
queue. You will find the result in the file matlab.out.
#BSUB-q SMP1 # Job queue #BSUB-o matlab.out # output of job is saved in matlab.out #BSUB-J Matlab # name of the job #BSUB-a "friday 10pm" # starting time of the job #BSUB-c 834 # Time limit in minutes # My instructions # Changing to the directory where my program is cd cd matlab-dir # setting the graphical environment display # this is OPTIONAL; do not use it if you do not # want graphical output on an Xterminal # setenv DISPLAY my-xterminal:0 # And run our Matlab program; we will also 'time' it # output from the matlab instruction will be matlab.out # the matlab instructions are not in a file this time, # but in the matlab.job file itself time matlab << EOF > matlab.out matlab-command-1 matlab-command-2 matlab-command-3 matlab-command-4 ... quit EOF
We will be running a Mathematica job and display its graphical result on
my Xterminal. As I want the results fast, I'm going to run it in S queue
as it only is a "short" job and normally would have been run interactively.
I'm putting the job instructions in the file math.job.
#BSUB-q S # Job queue #BSUB-o math.out # save the little output we have in math.out #BSUB-J Mathematica # name of the job #BSUB-c 10 # Time limit in minutes # My instructions # Changing to the directory where my program is cd cd math-dir # And run our Mathematica program; output will be on stdout math < math.infile
We simply enter the command
bsub < math.job
When the job is launched correctly, the system will reply with something
similar to
Job <1303> is submitted to queue <S>
To follow the progress of your job, you can use the command
bjobs, like in bjobs -u
all.
Or you can use the command bpeek to examine the current output
of a specific job. Once the job is finished, it will disappear from the RUN
queue. You will find the result in the file matlab.out.
We will be running a Gaussian program. As Gaussian jobs are usually quite
large, we'll be running it in the SMP8 queue (the one advised for Gaussian
jobs). Because a Gaussian job can
create very large temporary files, we will also be running this job
in a /work directory of our own. The job instructions are put in the file
gaussian.job.
#BSUB -q SMP8 #BSUB -o output_file #BSUB -J Gaussian # # Define the Guassian environment variables # G03ROOT=/bfucc/PRD_G03_E01/g03 GAUSS_EXEDIR=$G03ROOT/exe GAUSS_ARCHDIR=$HOME/g03 GMAIN=$GAUSS_EXEDIR LD_LIBRARY_PATH=$GAUSS_EXEDIR PATH=$GAUSS_EXEDIR:$PATH export G03ROOT GAUSS_EXEDIR GAUSS_ARCHDIR PATH GMAIN LD_LIBRARY_PATH #
# Change to my temporary directory in /work and copy my input files to it # cd /work/username/gaussian cp $HOME/mygaussdir/gaussian.inputfile . # # Run the job with the instructions in gaussian.inputfile # time g03 < gaussian.inputfile
We simply enter the command
bsub < gaussian.job
When the job is launched correctly, the system will reply with something
similar to
Job <1303> is submitted to queue <SMP8>
To follow the progress of your job, you can use the command
bjobs, like in bjobs -u
all.
Or you can use the command bpeek to examine the current output
of a specific job. Once the job is finished, it will disappear from the RUN
queue. You will find the result in the file output_file.