High-performance computing
1) Running a job on cluster
qsub shellmatlab.sh
where shellmatlab.sh has
#!/bin/sh
#S -S /bin/sh
# Shell script to call matlab file
# commands to run (here I have some compiled MEX code)
./run_unixfile.sh /opt/matlab2013a
# or directly call matlab .m file
# /opt/matlab/bin/matlab < unixfile.m
# matlab < unixfile.m
date
2) Check status of jobs
qstat
OR
qstat -u <login_name>
3) Resources for Sun Grid Engine at Duke and here
4) Documentation on setting up qsub script (Columbia grid engine)
5) Shell script to launch multiple commands (generate "swarm" of commands) on cluster (also on bitbucket)
7) Options for bsub
A) ssh into cluster
B) ls -al
edit .bashrc file using vi
change text to
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
if [ ! -r ~/.ssh/authorized_keys ] ; then
ssh-keygen -t rsa
cp .ssh/id_rsa.pub .ssh/authorized_keys
fi
module load matlab-2011b
C)
# get a node
bsub -Is -q interact /bin/bash
D)
# start the job
bsub < testmat.lsf
E)
# check status
bjobs -u all
F) kill jobs
bkill 452484
G)
testmat.lsf is here
#!/bin/bash
# enable your environment, which will use .bashrc configuration in your home directory
#BSUB -L /bin/bash
# the name of your job showing on the queue system
#BSUB -J myjob
# the following BSUB line specify the queue that you will use,
# please use bqueues command to check the available queues for each toolbox of matlab
# Bioinformatics toolbox, please use matlabbio queue
# Signal Processing toolbox, please use matlabsig queue
# Image Processing toolbox, please use matlabimg queue
# Wavelet toolbox, please use matlabwav queue
# Matlab DCE, please use matlabdce queue (or matlabdce-short for very small jobs like this one)
# Matlab, Optimization and Statistic, please use matlab queue
#BSUB -q matlabdce-short
# the system output and error message output, %J will show as your jobID
#BSUB -o %J.out
#BSUB -e %J.err
#the CPU number that you will collect (Attention: each node has 2 CPU)
#BSUB -n 1
#when job finish that you will get email notification
#BSUB -u YourEmail@something.org
#BSUB -N
#enter your working directory
cd /PHShome/$USER/
# Finally, Start the program
matlab < myplot.m
# END PROGRAM
H)
myplot.m is
h = figure;
t = 0:pi/20:2*pi;
plot('v6',t,sin(t).*2)
saveas(h,'myFigFile','jpg')
8) More interactive options for cluster
ssh into cluster
# get a node
bsub -Is -q interact /bin/bash
#load modules
module load matlab-2011b
# check available modules
module avail
# check modules loaded
module list
# start interactive session of MATLAB
matlab
9) Module and SLURM commands (courtesy Sam Moskwa)
module avail <>
module load <>
module unload <>
module list # list all loaded modules
module purge # unloads all modules
sbatch myscript.slurm
qsub myscript.pbs
sbatch
squeue -u <userid>
scontrol
slurmtop
scancel <jobid>
sinteractive
qsub
email schelp
job
SLURM systems
#!/bin/bash
#SBATCH –job-name=<name>
#SBATCH --time=6:00:00 # walltime
#SBATCH --nodes=2
#SBATCH --tasks-per-node=8 # tasks are not equal to cores
#SBATCH --output=<filename>
module load something
run_something # runs in the submission directory
quota –sv
10) LSF job scripts for MATLAB (on MATLAB Central)