Difference between revisions of "Biocomputingpage"

From CsWiki
Jump to: navigation, search
Line 1: Line 1:
<html>
+
How to set up a unix account:
 +
To obtain a unix user name and password, create an account by registering at https://registrar.cs.huji.ac.il/account.
  
<head>
+
Connecting to the hm server:
<meta http-equiv=Content-Type content="text/html; charset=windows-1255">
+
Before connecting to the hm server, an SSH connection needs to be set up. Instructions for set-up can be found at http://wiki.cs.huji.ac.il/wiki/Connecting_from_outside.
<meta name=Generator content="Microsoft Word 15 (filtered)">
+
<style>
+
<!--
+
/* Font Definitions */
+
@font-face
+
{font-family:"Cambria Math";
+
panose-1:2 4 5 3 5 4 6 3 2 4;}
+
@font-face
+
{font-family:Calibri;
+
panose-1:2 15 5 2 2 2 4 3 2 4;}
+
@font-face
+
{font-family:"Segoe UI";
+
panose-1:2 11 5 2 4 2 4 2 2 3;}
+
/* Style Definitions */
+
p.MsoNormal, li.MsoNormal, div.MsoNormal
+
{margin-top:0cm;
+
margin-right:0cm;
+
margin-bottom:8.0pt;
+
margin-left:0cm;
+
text-align:right;
+
line-height:107%;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:11.0pt;
+
font-family:"Calibri",sans-serif;}
+
p.MsoCommentText, li.MsoCommentText, div.MsoCommentText
+
{mso-style-link:"Comment Text Char";
+
margin-top:0cm;
+
margin-right:0cm;
+
margin-bottom:8.0pt;
+
margin-left:0cm;
+
text-align:right;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:10.0pt;
+
font-family:"Calibri",sans-serif;}
+
a:link, span.MsoHyperlink
+
{color:#0563C1;
+
text-decoration:underline;}
+
a:visited, span.MsoHyperlinkFollowed
+
{color:#954F72;
+
text-decoration:underline;}
+
pre
+
{mso-style-link:"HTML Preformatted Char";
+
margin:0cm;
+
margin-bottom:.0001pt;
+
font-size:10.0pt;
+
font-family:"Courier New";}
+
p.MsoCommentSubject, li.MsoCommentSubject, div.MsoCommentSubject
+
{mso-style-link:"Comment Subject Char";
+
margin-top:0cm;
+
margin-right:0cm;
+
margin-bottom:8.0pt;
+
margin-left:0cm;
+
text-align:right;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:10.0pt;
+
font-family:"Calibri",sans-serif;
+
font-weight:bold;}
+
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
+
{mso-style-link:"Balloon Text Char";
+
margin:0cm;
+
margin-bottom:.0001pt;
+
text-align:right;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:9.0pt;
+
font-family:"Segoe UI",sans-serif;}
+
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
+
{margin:0cm;
+
margin-bottom:.0001pt;
+
text-align:right;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:11.0pt;
+
font-family:"Calibri",sans-serif;}
+
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
+
{margin-top:0cm;
+
margin-right:36.0pt;
+
margin-bottom:8.0pt;
+
margin-left:0cm;
+
text-align:right;
+
line-height:107%;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:11.0pt;
+
font-family:"Calibri",sans-serif;}
+
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
+
{margin-top:0cm;
+
margin-right:36.0pt;
+
margin-bottom:0cm;
+
margin-left:0cm;
+
margin-bottom:.0001pt;
+
text-align:right;
+
line-height:107%;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:11.0pt;
+
font-family:"Calibri",sans-serif;}
+
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
+
{margin-top:0cm;
+
margin-right:36.0pt;
+
margin-bottom:0cm;
+
margin-left:0cm;
+
margin-bottom:.0001pt;
+
text-align:right;
+
line-height:107%;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:11.0pt;
+
font-family:"Calibri",sans-serif;}
+
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
+
{margin-top:0cm;
+
margin-right:36.0pt;
+
margin-bottom:8.0pt;
+
margin-left:0cm;
+
text-align:right;
+
line-height:107%;
+
direction:rtl;
+
unicode-bidi:embed;
+
font-size:11.0pt;
+
font-family:"Calibri",sans-serif;}
+
span.HTMLPreformattedChar
+
{mso-style-name:"HTML Preformatted Char";
+
mso-style-link:"HTML Preformatted";
+
font-family:"Courier New";}
+
span.CommentTextChar
+
{mso-style-name:"Comment Text Char";
+
mso-style-link:"Comment Text";}
+
span.CommentSubjectChar
+
{mso-style-name:"Comment Subject Char";
+
mso-style-link:"Comment Subject";
+
font-weight:bold;}
+
span.BalloonTextChar
+
{mso-style-name:"Balloon Text Char";
+
mso-style-link:"Balloon Text";
+
font-family:"Segoe UI",sans-serif;}
+
.MsoPapDefault
+
{margin-bottom:8.0pt;
+
line-height:107%;}
+
@page WordSection1
+
{size:595.3pt 841.9pt;
+
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
+
div.WordSection1
+
{page:WordSection1;}
+
/* List Definitions */
+
ol
+
{margin-bottom:0cm;}
+
ul
+
{margin-bottom:0cm;}
+
-->
+
</style>
+
  
</head>
+
Every time you connect to the system, you will need to use a One-Time password (OTP) in addition to your unix (IDng) password. Instructions for obtaining OTPs can be found at http://wiki.cs.huji.ac.il/wiki/Password_and_OTP.
  
<body lang=EN-US link="#0563C1" vlink="#954F72">
+
It is helpful to set up an FTP connection for easy file transfer between your desktop computer and the server. To do this with MobaXterm:
 +
Create a new SFTP session by clicking on 'Session' and then 'SFTP'. Fill in the basic settings so that remote host = localhost, username = <your unix user name>, and the port = 9001. For example:
  
<div class=WordSection1 dir=RTL>
+
 
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
You will then need to create an SSH tunnel by clicking on 'Tunneling' and then 'New SSH Tunnel', and fill in the fields (using your unix user name) as follows:
embed'><u>How to set up a unix account:</u></p>
+
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>To obtain a unix user name and password, create an account by
+
registering at <a href="https://registrar.cs.huji.ac.il/account">https://registrar.cs.huji.ac.il/account</a>.</p>
+
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Before you start the transfer you will need to:
embed'> </p>
+
1 - start the tunnel by clicking on 'Tunneling' and press  the  button
 +
2- provide an OTP to open the tunnel
 +
3- start the FTP connection by double clicking on the SFTP session
 +
4- enter your unix password
 +
The connection will eventually time out (you will see that the button will no longer be pressed) after which you will need to re-do steps 1-4 to re-open it.
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Basic linux commands:
embed'><u>Connecting to the hm server:</u></p>
+
For an introduction to some basic linux commands, take a look at the Intro_hm_cluster.pptx presentation.
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Understanding the file system:
embed'>Before connecting to the hm server, an SSH connection needs to be set
+
The file system is divided into two main directories – icore and lustre.  
up. Instructions for set-up can be found at <a
+
Your icore directory can be found in /cs/icore/<your unix user name>. Icore is backed up with snapshots so a few previous versions of all files will be saved even after they are modified/deleted (assuming that the file system is up and running), however it has limited space. Icore should be used mainly to store your scripts. You should keep a copy of your scripts on Git, which allows you to save different versions. To use Git to back up scripts, see here.  
href="http://wiki.cs.huji.ac.il/wiki/Connecting_from_outside">http://wiki.cs.huji.ac.il/wiki/Connecting_from_outside</a>.
+
Your lustre directory can be found in /mnt/lustre/hms-01/fs01/<your unix user name>. Lustre should be used mainly to store the data that you are currently working on as it is meant for quick and efficient computations. IMPORTANT: lustre is not backed up! This means that files on lustre that are accidentally deleted will be lost forever, so please be sure to back up all important files (e.g. on an external hard drive).
</p>
+
There are graphical interfaces that can make navigating the file system easier. For example, the nautilus file manager (can be opened with the command 'nautilus >& /dev/null &') and gedit text editor ('gedit >& /dev/null &'). For more information, take a look at the Intro_hm_cluster.pptx presentation.
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Using slurm on the hm cluster:
embed'> </p>
+
The hm cluster currently has 44 nodes on which jobs can run. Slurm is a job scheduler that decides which node(s) a job will run on based on the job's requested resources (e.g. number of cpus, amount of memory, etc…), the availability of idle nodes, and the priority of the user which depends on how many jobs were run in the past.
 +
All jobs should be submitted as sbatch scripts to slurm where they will be queued and will start running as soon as all of their requested resources become available.
 +
Some resource arguments that most users will want to tweak are:
 +
Argument Default value Maximum value Description Notes
 +
-c, --cpus-per-task 2 32 number of cpus for job Maximum depends on CPU used in cluster, hm I-CORE cluster is 32.
 +
--mem 50MB ~64GB or ~128GB memory allocation for job Depends on memory of nodes, we have nodes with 64GB and 128GB of memory, you can't request all the memory since some is needed for the OS, if you want it all and don't care which node you can use: MaxMemPerNode. See below for more details.
 +
-t, --time 2 hours 31 days time limit for job Currently 31 days may be reverted to 21 days later.
 +
-N, --nodes 1 44 number of nodes to run job on Currently 44, may be increased in the future, either due to additional hardware purchases or reassigning of submit/test hosts to 'active duty' compute nodes.
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
For more information on all sbatch arguments, e.g., the proper format for writing time limits, etc…, read the sbatch manual.
embed'>Every time you connect to the system, you will need to use a One-Time
+
password (OTP) in addition to your unix (IDng) password. Instructions for
+
obtaining OTPs can be found at <a
+
href="http://wiki.cs.huji.ac.il/wiki/Password_and_OTP">http://wiki.cs.huji.ac.il/wiki/Password_and_OTP</a>.</p>
+
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Submitting a job to the slurm queue:
embed'> </p>
+
There are 2 general ways to submit jobs using sbatch:
 +
1. one-liner
 +
Resources can be requested as arguments on the command line, for example:
 +
sbatch -N 2 --mem 8GB --wrap script.sh
 +
The above command will submit script.sh as a job to slurm with two nodes and 8GB of RAM requested. The --wrap argument is needed so that the script (or command) is wrapped in an sbatch script.
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
To run a command with arguments, you need to enclose the command and its arguments in quotes, for example:
embed'>It is helpful to set up an FTP connection for easy file transfer between
+
your desktop computer and the server. To do this with MobaXterm: </p>
+
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
sbatch –o output.txt --wrap 'head -n 20 file.txt'
embed'>Create a new SFTP session by clicking on 'Session' and then 'SFTP'. Fill
+
in the basic settings so that remote host = localhost, username = <your unix
+
user name>, and the port = 9001. For example:</p>
+
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The above code will submit the command 'head -n 20 file.txt' as a job to slurm and will write the output of the command (the first 20 lines of file.txt) to the file output.txt.
embed'> </p>
+
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
2. sbatch script (recommended)
embed'><img border=0 width=554 height=437 id="Picture 1"
+
Resources can be requested by adding special argument comments to bash scripts. These start with #SBATCH and then contain the sbatch argument, and will be parsed by sbatch until the script starts, so an #SBATCH argument written after the first command of the script will be ignored by sbatch. Here is an example of a bash script called my-sbatch-script.sh with sbatch arguments:
src="wikiWebF_files/image001.jpg"> </p>
+
#!/bin/bash
 +
#SBATCH --mem 10GB
 +
echo "hello world"  
 +
# The following line will not be parsed by sbatch
 +
#SBATCH --time 10
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The above script can then be submitted to the slurm queue from the command line as follows:
embed'> </p>
+
sbatch my-sbatch-script.sh
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
my-sbatch-script.sh will be submitted as a job to the slurm queue with 10GB of RAM requested. The time limit for the job will be the default two hours since the time parameter will not be parsed by sbatch as it is written after a command in the script.
embed'>You will then need to create an SSH tunnel by clicking on 'Tunneling'
+
and then 'New SSH Tunnel', and fill in the fields (using your unix user name)
+
as follows:</p>
+
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Requesting resources:
embed'> </p>
+
Make sure that your job does not request more resources than the maximum (please refer to table above). Jobs that request more than the maximum number of resources will not run.
 +
Requests should be kept to as close to the needs of your job as possible for two main reasons:
 +
1- jobs are prioritized in the queue mainly based on requested resources, meaning that the more resources requested, the longer the job will take to start running since it needs to wait for all resources to become available
 +
2- while a job is running, all of its allocated resources will be unavailable to other users even if the job is not using them
 +
Requesting multiple nodes:
 +
Requesting multiple nodes for a specific job does not automatically divide the job among the nodes. There are a few ways to use multiple nodes simultaneously in order to save computation time:  
 +
1- using mpirun
 +
2- using srun
 +
3- using an outer submit script – this is recommended as it is the simplest method 
 +
1- using mpirun:
 +
If you know that you are running a program that depends on OpenMPI, you can use mpirun to run the program on multiple nodes in parallel – see the mpi manual for more information.
 +
2- using srun:
 +
Srun can be used within an sbatch script to utilize a subset of the total requested resources. It can be used to run a command using multiple nodes in parallel which is most useful if you want to run a script/command on many files at the same time, each as its own job on one node, for example:
 +
#!/bin/bash
 +
#SBATCH -N 5
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
files=(file0 file1 file2 file3 file4)
embed'><img border=0 width=553 height=359 id="Picture 2"
+
src="wikiWebF_files/image002.jpg"></p>
+
  
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
for i in {0..4}
embed'> </p>
+
do
 +
srun -N 1 –o output.$i.txt head –n 20 ${files[$i]} &
 +
done
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The above script will allocate five nodes as requested, and then will send five jobs to the slurm queue at the same time, each running on one node. The output of each job (the first twenty lines of the corresponding file) will be printed in the output.{i}.txt file. If you submit the above script as a job without using the srun command, for example:
embed'>Before you start the transfer you will need to: </p>
+
#!/bin/bash
 +
#SBATCH -N 5
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
files=(file0 file1 file2 file3 file4)
embed'>1 - start the tunnel by clicking on 'Tunneling' and press  the <img
+
border=0 width=23 height=25 id="Picture 3" src="wikiWebF_files/image003.png"> button
+
</p>
+
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
for i in {0..4}
embed'>2- provide an OTP to open the tunnel </p>
+
do
 +
head –n 20 ${files[$i]} &
 +
done
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Once the above job starts running, it will hold five nodes unavailable to other users as requested, but it will only run on one node.
embed'>3- start the FTP connection by double clicking on the SFTP session </p>
+
3- using an outer submit script:
 +
The simplest way to run a script/command on many files at the same time, each as its own job on one node, is by using a for loop in a script that submits all of the jobs at once. For example:
 +
#!/bin/bash
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
files=(file0 file1 file2 file3 file4)
embed'>4- enter your unix password </p>
+
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
for file in ${files[*]}
embed'>The connection will eventually time out (you will see that the <img
+
do
border=0 width=23 height=25 id="Picture 4" src="wikiWebF_files/image003.png"> button
+
sbatch head.sh $file
will no longer be pressed) after which you will need to re-do steps 1-4 to
+
done
re-open it. </p>
+
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The above script loops through all files in the list 'files' and submits the script head.sh (with 'file' as an argument) as an sbatch job. The head.sh script will contain the sbatch arguments needed to run on one file. For example:
embed'> </p>
+
#!/bin/bash
 +
#SBATCH –o output.txt
 +
#SBATCH –N 1
 +
file=$1 #first argument from outer script
 +
head –n 20 $file
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The head.sh script will be run as a job on one node (based on the sbatch arguments written in the script) on each of the 5 files in parallel.
embed'><u>Basic linux commands:</u></p>
+
Requesting multiple cpus:
 +
If you are running a program that supports multithreading, you can request multiple cpus (up to the maximum) and then run the program while specifying the number of cpus you want it to use as a parameter. For example:
 +
#!/bin/bash
 +
#SBATCH –c 32 #request 32 cpus
 +
#SBATCH –o output.txt
 +
sample=$1
 +
bowtie2 -p 32 -x $genome -U $sample -S $sam >& bowtie2.log
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The above script can be submitted as a job that will run bowtie2 using 32 cpus on 'sample' (with the bowtie2 output saved in the file bowtie2.log).
embed'>For an introduction to some basic linux commands, take a look at the
+
Intro_hm_cluster.pptx presentation.</p>
+
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Requesting memory:
embed'><u><span style='text-decoration:none'> </span></u></p>
+
If the amount of memory requested is not enough for the job, it will be killed with an error message that the job exceeded the memory limit and you will need to increase the memory request. There is currently no simple method to know how much memory a job will need before it runs. Once an sbatch job is running you can check its accounting information with the 'sacct' command.
 +
For more information, read the CS slurm wiki.
 +
FAQs
 +
1.  How do I check the status of my job?
 +
By running the command 'squeue –u username' with your username you will see all of your submitted jobs and their status (ST column). PD means your job is pending in the queue waiting to start, and R means it is running. For a list of all status codes, read the 'JOB STATE CODES' section of the squeue manual.
 +
2.  How do I cancel a job?
 +
Jobs can be cancelled by running the command 'scancel jobid' where the jobid is the number that slurm assigned your job when it was submitted which you can see by running 'squeue –u username' and looking at the JOBID column.
 +
3.  Why is my job taking so long to start running?
 +
Jobs are prioritized in the slurm queue mainly based on the amount of resources requested. The more resources your job requests, the longer it will take to start running.
 +
4.  How much memory/cpus did my job actually use?
 +
When a job is running, you can use the following commands to see its accounting information:
 +
sacct – see the sacct manual for more details
 +
sstat – see the sstat manual for more details
 +
5.  Can I submit a job and tell it to run at a later time?
 +
You can tell a job what time you want it to start running with the parameter --begin:
 +
#SBATCH --begin HH:MM MM/DD/YY
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
Alternatively, you can add dependencies to your jobs so that, for example, job #2 will not start until job #1 satisfies the provided condition, by using the job id. This can be done in a bash script:
embed'><u>Understanding the file system:</u></p>
+
#!/bin/bash
 +
jobid1=$(sbatch job1.sh)
 +
sbatch –-dependency afterok:jobid1 job2.sh
  
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
The above script submits job1.sh as a job and saves jobid in the variable jobid1. It then submits job2.sh as a job only once job1 finishes running with an exit code of 0 as defined by the condition 'afterok'. For more information on possible conditions, etc… please refer to the sbatch manual.
embed'>The file system is divided into two main directories – icore and lustre.
+
</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Your icore directory can be found in <i>/cs/icore/<your unix user
+
name>. </i>Icore is backed up with snapshots so a few previous versions of
+
all files will be saved even after they are modified/deleted (assuming that the
+
file system is up and running), however it has limited space. <b>Icore should
+
be used mainly to store your scripts.</b> You should keep a copy of your
+
scripts on Git, which allows you to save different versions. To use Git to back
+
up scripts, see <a href="http://wiki.cs.huji.ac.il/wiki/Github">here</a>. </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Your lustre directory can be found in <i>/mnt/lustre/hms-01/fs01/<your
+
unix user name></i>. <b>Lustre should be used mainly to store the data</b>
+
that you are currently working on as it is meant for quick and efficient
+
computations. <b>IMPORTANT:</b> <b>lustre is not backed up! </b>This means that
+
files on lustre that are accidentally deleted will be lost forever, so please <b>be
+
sure to back up all important files </b>(e.g. on an external hard drive). </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>There are graphical interfaces that can make navigating the file system
+
easier. For example, the nautilus file manager (can be opened with the command
+
'nautilus >& /dev/null &') and gedit text editor ('gedit >&
+
/dev/null &'). For more information, take a look at the
+
Intro_hm_cluster.pptx presentation.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u><span style='text-decoration:none'> </span></u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u>Using slurm on the hm cluster:</u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The hm cluster currently has 44 nodes on which jobs can run. Slurm is a
+
job scheduler that decides which node(s) a job will run on based on the job's
+
requested resources (e.g. number of cpus, amount of memory, etc…), the
+
availability of idle nodes, and the priority of the user which depends on how
+
many jobs were run in the past. </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>All jobs should be submitted as sbatch scripts to slurm where they will
+
be queued and will start running as soon as all of their requested resources
+
become available.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Some resource arguments that most users will want to tweak are:</p>
+
 
+
<div align=left dir=ltr>
+
 
+
<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width=0
+
style='width:357.95pt;border-collapse:collapse;border:none'>
+
<tr>
+
  <td width=88 valign=top style='width:66.75pt;border:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'><b>Argument
+
  </b></p>
+
  </td>
+
  <td width=75 valign=top style='width:57.55pt;border:solid windowtext 1.0pt;
+
  border-left:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'><b>Default
+
  value</b></p>
+
  </td>
+
  <td width=88 valign=top style='width:66.6pt;border:solid windowtext 1.0pt;
+
  border-left:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'><b>Maximum
+
  value</b></p>
+
  </td>
+
  <td width=94 valign=top style='width:71.2pt;border:solid windowtext 1.0pt;
+
  border-left:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'><b>Description</b></p>
+
  </td>
+
  <td width=133 valign=top style='width:95.85pt;border:solid windowtext 1.0pt;
+
  border-left:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'><b>Notes</b></p>
+
  </td>
+
</tr>
+
<tr>
+
  <td width=88 valign=top style='width:66.75pt;border:solid windowtext 1.0pt;
+
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>-c,
+
  --cpus-per-task</p>
+
  </td>
+
  <td width=75 valign=top style='width:57.55pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>2</p>
+
  </td>
+
  <td width=88 valign=top style='width:66.6pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>32</p>
+
  </td>
+
  <td width=94 valign=top style='width:71.2pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>number
+
  of cpus for job</p>
+
  </td>
+
  <td width=133 valign=top style='width:95.85pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>Maximum
+
  depends on CPU used in cluster, hm I-CORE cluster is 32.</p>
+
  </td>
+
</tr>
+
<tr>
+
  <td width=88 valign=top style='width:66.75pt;border:solid windowtext 1.0pt;
+
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>--mem</p>
+
  </td>
+
  <td width=75 valign=top style='width:57.55pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>50MB</p>
+
  </td>
+
  <td width=88 valign=top style='width:66.6pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>~64GB or
+
  ~128GB</p>
+
  </td>
+
  <td width=94 valign=top style='width:71.2pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>memory
+
  allocation for job</p>
+
  </td>
+
  <td width=133 valign=top style='width:95.85pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>Depends
+
  on memory of nodes, we have nodes with 64GB and 128GB of memory, you can't
+
  request all the memory since some is needed for the OS, if you want it all
+
  and don't care which node you can use: MaxMemPerNode. See below for more
+
  details.</p>
+
  </td>
+
</tr>
+
<tr>
+
  <td width=88 valign=top style='width:66.75pt;border:solid windowtext 1.0pt;
+
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>-t,
+
  --time</p>
+
  </td>
+
  <td width=75 valign=top style='width:57.55pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>2 hours</p>
+
  </td>
+
  <td width=88 valign=top style='width:66.6pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>31 days</p>
+
  </td>
+
  <td width=94 valign=top style='width:71.2pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>time
+
  limit for job</p>
+
  </td>
+
  <td width=133 valign=top style='width:95.85pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>Currently
+
  31 days may be reverted to 21 days later.</p>
+
  </td>
+
</tr>
+
<tr>
+
  <td width=88 valign=top style='width:66.75pt;border:solid windowtext 1.0pt;
+
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>-N,
+
  --nodes</p>
+
  </td>
+
  <td width=75 valign=top style='width:57.55pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>1</p>
+
  </td>
+
  <td width=88 valign=top style='width:66.6pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>44</p>
+
  </td>
+
  <td width=94 valign=top style='width:71.2pt;border-top:none;border-left:none;
+
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>number
+
  of nodes to run job on</p>
+
  </td>
+
  <td width=133 valign=top style='width:95.85pt;border-top:none;border-left:
+
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
+
  padding:0cm 5.4pt 0cm 5.4pt'>
+
  <p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
  text-align:left;line-height:normal;direction:ltr;unicode-bidi:embed'>Currently
+
  44, may be increased in the future, either due to additional hardware
+
  purchases or reassigning of submit/test hosts to 'active duty' compute nodes.</p>
+
  </td>
+
</tr>
+
</table>
+
 
+
</div>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>For more information on all sbatch arguments, e.g., the proper format
+
for writing time limits, etc…, read the <a
+
href="https://slurm.schedmd.com/sbatch.html">sbatch manual</a>.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u><span style='text-decoration:none'> </span></u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u>Submitting a job to the slurm queue:</u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>There are 2 general ways to submit jobs using sbatch:</p>
+
 
+
<p class=MsoListParagraph dir=LTR style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>1.<span style='font:7.0pt "Times New Roman"'>      
+
</span><span dir=LTR></span>one-liner</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Resources can be requested as arguments on the command line, for
+
example:</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;line-height:107%;font-family:"Courier New";
+
color:#222222'>sbatch -N 2 --mem 8GB --wrap script.sh</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'>The above command will submit <i>script.sh</i> as a job to slurm with
+
two nodes and 8GB of RAM requested. The --wrap argument is needed so that the
+
script (or command) is wrapped in an sbatch script.</p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-top:0cm;margin-right:0cm;margin-bottom:
+
0cm;margin-left:18.0pt;margin-bottom:.0001pt;text-align:left;line-height:normal;
+
background:white;direction:ltr;unicode-bidi:embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'>To run a command with arguments, you need to enclose the command and its
+
arguments in quotes, for example:</p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-top:0cm;margin-right:0cm;margin-bottom:
+
0cm;margin-left:18.0pt;margin-bottom:.0001pt;text-align:left;line-height:normal;
+
background:white;direction:ltr;unicode-bidi:embed'> </p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>sbatch –o output.txt --wrap 'head -n 20 file.txt'</span></pre><pre
+
dir=LTR style='text-indent:18.0pt;background:white'><span style='color:#222222'> </span></pre><pre
+
dir=LTR style='background:white'><span style='font-size:11.0pt;font-family:
+
"Calibri",sans-serif'>The above code will submit the command 'head -n 20 file.txt' as a job to slurm and will write the output of the command (the first 20 lines of <i>file.txt</i>) to the file <i>output.txt</i>. </span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='margin-left:90.0pt;text-align:left;
+
direction:ltr;unicode-bidi:embed'> </p>
+
 
+
<p class=MsoListParagraph dir=LTR style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>2.<span style='font:7.0pt "Times New Roman"'>      
+
</span><span dir=LTR></span>sbatch script (recommended)</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Resources can be requested by adding special argument comments to bash
+
scripts. These start with #SBATCH and then contain the sbatch argument, and
+
will be parsed by sbatch until the script starts, so an #SBATCH argument
+
written after the first command of the script will be ignored by sbatch. Here
+
is an example of a bash script called <i>my-sbatch-script.sh</i> with sbatch
+
arguments:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH --mem 10GB</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>echo "hello world" </span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'># The following line will not be parsed by sbatch</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH --time 10</span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='margin-left:90.0pt;text-align:left;
+
direction:ltr;unicode-bidi:embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The above script can then be submitted to the slurm queue from the
+
command line as follows:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>sbatch my-sbatch-script.sh</span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='margin-left:18.0pt;text-align:left;
+
direction:ltr;unicode-bidi:embed'><i> </i></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><i>my-sbatch-script.sh</i> will be submitted as a job to the slurm queue
+
with 10GB of RAM requested. The time limit for the job will be the default two
+
hours since the time parameter will not be parsed by sbatch as it is written
+
after a command in the script.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u><span style='text-decoration:none'> </span></u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u>Requesting resources:</u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Make sure that your job does not request more resources than the maximum
+
(please refer to table above). <b>Jobs that request more than the maximum
+
number of resources will not run.</b></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><b>Requests should be kept to as close to the needs of your job as
+
possible</b> for two main reasons: </p>
+
 
+
<p class=MsoListParagraphCxSpFirst dir=LTR style='margin-top:0cm;margin-right:
+
0cm;margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>1-<span style='font:7.0pt "Times New Roman"'>     
+
</span><span dir=LTR></span>jobs are prioritized in the queue mainly based on
+
requested resources, meaning that the more resources requested, the longer the
+
job will take to start running since it needs to wait for all resources to become
+
available</p>
+
 
+
<p class=MsoListParagraphCxSpLast dir=LTR style='margin-top:0cm;margin-right:
+
0cm;margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>2-<span style='font:7.0pt "Times New Roman"'>     
+
</span><span dir=LTR></span> while a job is running, all of its allocated
+
resources will be unavailable to other users even if the job is not using them</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><b>Requesting multiple nodes:</b></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Requesting multiple nodes for a specific job does <b>not</b>
+
automatically divide the job among the nodes. There are a few ways to use
+
multiple nodes simultaneously in order to save computation time: </p>
+
 
+
<p class=MsoListParagraphCxSpFirst dir=LTR style='margin-top:0cm;margin-right:
+
0cm;margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>1-<span style='font:7.0pt "Times New Roman"'>     
+
</span><span dir=LTR></span>using mpirun</p>
+
 
+
<p class=MsoListParagraphCxSpMiddle dir=LTR style='margin-top:0cm;margin-right:
+
0cm;margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>2-<span style='font:7.0pt "Times New Roman"'>     
+
</span><span dir=LTR></span>using srun </p>
+
 
+
<p class=MsoListParagraphCxSpLast dir=LTR style='margin-top:0cm;margin-right:
+
0cm;margin-bottom:8.0pt;margin-left:36.0pt;text-align:left;text-indent:-18.0pt;
+
direction:ltr;unicode-bidi:embed'>3-<span style='font:7.0pt "Times New Roman"'>     
+
</span><span dir=LTR></span>using an outer submit script – this is recommended
+
as it is the simplest method  </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>1- using mpirun:</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>If you know that you are running a program that depends on OpenMPI, you
+
can use mpirun to run the program on multiple nodes in parallel – see the <a
+
href="https://www.mpi-forum.org/docs/">mpi manual</a> for more information.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>2- using srun:</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Srun can be used within an sbatch script to utilize a subset of the
+
total requested resources. It can be used to run a command using multiple nodes
+
in parallel which is most useful if you want to run a script/command on many
+
files at the same time, each as its own job on one node, for example:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH -N 5</span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'> </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>files=(file0
+
file1 file2 file3 file4)</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'> </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>for
+
i in {0..4}</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>do    </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;text-indent:36.0pt;line-height:normal;background:white;
+
direction:ltr;unicode-bidi:embed'><span style='font-size:10.0pt;font-family:
+
"Courier New";color:#222222'>srun -N 1 –o output.$i.txt head –n 20 ${files[$i]}
+
&</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>done</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The above script will allocate five nodes as requested, and then will
+
send five jobs to the slurm queue at the same time, each running on one node.
+
The output of each job (the first twenty lines of the corresponding file) will
+
be printed in the <i>output.{i}.txt</i> file. If you submit the above script as
+
a job without using the srun command, for example:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH -N 5</span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'> </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>files=(file0
+
file1 file2 file3 file4)</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'> </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>for
+
i in {0..4}</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>do</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;text-indent:36.0pt;line-height:normal;background:white;
+
direction:ltr;unicode-bidi:embed'><span style='font-size:10.0pt;font-family:
+
"Courier New";color:#222222'>head –n 20 ${files[$i]} &</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>done</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Once the above job starts running, it will hold five nodes unavailable
+
to other users as requested, but it will only run on one node.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>3- using an outer submit script: </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The simplest way to run a script/command on many files at the same time,
+
each as its own job on one node, is by using a for loop in a script that
+
submits all of the jobs at once. For example:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'> </span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>files=(file0
+
file1 file2 file3 file4)</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'> </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>for
+
file in ${files[*]}</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>do</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;text-indent:36.0pt;line-height:normal;background:white;
+
direction:ltr;unicode-bidi:embed'><span style='font-size:10.0pt;font-family:
+
"Courier New";color:#222222'>sbatch head.sh $file </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>done</span></p>
+
 
+
<p class=MsoNormal dir=LTR style='margin-bottom:0cm;margin-bottom:.0001pt;
+
text-align:left;line-height:normal;background:white;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'> </span></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The above script loops through all files in the list 'files' and submits
+
the script <i>head.sh</i> (with 'file' as an argument) as an sbatch job. The <i>head.sh</i>
+
script will contain the sbatch arguments needed to run on one file. For
+
example:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH –o output.txt</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH –N 1</span></pre>
+
 
+
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>file=$1
+
#first argument from outer script</span></p>
+
 
+
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><span style='font-size:10.0pt;font-family:"Courier New";color:#222222'>head
+
–n 20 $file</span></p>
+
 
+
<p class=MsoNoSpacing dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The <i>head.sh</i> script will be run as a job on one node (based on the
+
sbatch arguments written in the script) on each of the 5 files in parallel. </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> <b>Requesting multiple cpus:</b></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>If you are running a program that supports multithreading, you can
+
request multiple cpus (up to the maximum) and then run the program while
+
specifying the number of cpus you want it to use as a parameter. For example:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH –c 32 #request 32 cpus</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>#SBATCH –o output.txt</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>sample=$1</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>bowtie2 -p 32 -x $genome -U $sample -S $sam >& bowtie2.log</span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>The above script can be submitted as a job that will run bowtie2 using
+
32 cpus on 'sample' (with the bowtie2 output saved in the file <i>bowtie2.log</i>).</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><b> </b></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><b>Requesting memory:</b></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>If the amount of memory requested is not enough for the job, it will be
+
killed with an error message that the job exceeded the memory limit and you
+
will need to increase the memory request. There is currently no simple method
+
to know how much memory a job will need before it runs. Once an sbatch job is
+
running you can check its accounting information with the 'sacct' command. </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>For more information, read the <a
+
href="http://wiki.cs.huji.ac.il/wiki/Slurm">CS slurm wiki</a>.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'><u>FAQs </u></p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>1.  How do I check the status of my job?</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>By running the command 'squeue –u username' with your username you will
+
see all of your submitted jobs and their status (ST column). PD means your job
+
is pending in the queue waiting to start, and R means it is running. For a list
+
of all status codes, read the 'JOB STATE CODES' section of the <a
+
href="https://slurm.schedmd.com/squeue.html">squeue manual</a>.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>2.  How do I cancel a job?</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Jobs can be cancelled by running the command 'scancel jobid' where the
+
jobid is the number that slurm assigned your job when it was submitted which
+
you can see by running 'squeue –u username' and looking at the JOBID column.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>3.  Why is my job taking so long to start running?</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>Jobs are prioritized in the slurm queue mainly based on the amount of
+
resources requested. The more resources your job requests, the longer it will
+
take to start running.</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>4.  How much memory/cpus did my job actually use? </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>When a job is running, you can use the following commands to see its
+
accounting information:</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>sacct – see the <a href="https://slurm.schedmd.com/sacct.html">sacct
+
manual</a> for more details</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>sstat – see the <a href="https://slurm.schedmd.com/sstat.html">sstat
+
manual</a> for more details</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>5.  Can I submit a job and tell it to run at a later time?</p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'>You can tell a job what time you want it to start running with the
+
parameter --begin:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#SBATCH --begin HH:MM MM/DD/YY</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'> </span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> Alternatively, you can add dependencies to your jobs so that, for
+
example, job #2 will not start until job #1 satisfies the provided condition,
+
by using the job id. This can be done in a bash script:</p>
+
 
+
<pre dir=LTR style='background:white'><span style='color:#222222'>#!/bin/bash</span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>jobid1=$(sbatch job1.sh)      </span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'>sbatch –-dependency afterok:jobid1 job2.sh    </span></pre><pre
+
dir=LTR style='background:white'><span style='color:#222222'> </span></pre><pre
+
dir=LTR style='background:white'><span style='font-size:11.0pt;font-family:
+
"Calibri",sans-serif'>The above script submits <i>job1.sh</i> as a job and saves jobid in the variable jobid1. It then submits <i>job2.sh</i> as a job only once job1 finishes running with an exit code of 0 as defined by the condition 'afterok'. For more information on possible conditions, etc… please refer to the </span><a
+
href="https://slurm.schedmd.com/sbatch.html"><span style='font-size:11.0pt;
+
font-family:"Calibri",sans-serif'>sbatch manual</span></a><span
+
style='font-size:11.0pt;font-family:"Calibri",sans-serif'>.</span></pre>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
+
embed'> </p>
+
 
+
</div>
+
 
+
 
+
<!-- END: body -->
+
+
<a href=http://www.milonic.com/><font color="#FFFFFF">JavaScript Menu Courtesy of Milonic.com</font></a>
+
</td>
+
    <td valign="top" width="10"><img src="/images/1x1.gif" width="10" height="1" alt=""></td>
+
    <td valign="top">
+
    <!-- INIT: left_body -->
+
   
+
<table border="0" cellpadding="0" cellspacing="0" width="148">
+
      <tr>
+
        <td bgcolor="#3399FF" rowspan="8" width="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
        <td bgcolor="#3399FF" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr><td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td></tr>
+
      <tr>
+
        <td bgcolor="#3399FF" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
 
+
      </tr>
+
      <tr>
+
        <td><p class="menu_right_titolo_gruppo">Site Utility</p></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#3399FF"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
 
+
        <td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#3399FF"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td><p class="menu_right"><img border="0" src="/images/printer_version.gif" width="14" height="10" alt="">
+
          <a href="/en/software/os/i_love_wiki/index.mpl?print=1&">Printer version</a></p><p class="menu_right"><img border="0" src="/images/flag_italy.gif" width="14" height="10" alt="">
+
        <b>
+
 
+
          <a href="/it/software/os/i_love_wiki/index.mpl?">Leggilo in italiano</a></b></p>
+
        <p class="menu_right">
+
        <img border="0" src="/images/stats.gif" width="14" height="10">
+
        <a target="_blank" href="/cgi-bin/perl/awstats/awstats.pl?lang=en">Site stats</a></p>
+
        <p class="menu_right">
+
        <img border="0" src="/images/stats.gif" width="14" height="10">
+
        <a href="/phpBB2/index.php">Read forums</a></p>
+
        <p class="menu_right">
+
        <img border="0" src="/images/sitemap.gif" width="14" height="10">
+
        <a href="/sitemap.mpl">Site map</a></p>
+
        </td>
+
      </tr>
+
    </table>
+
    <br>
+
           
+
        <!-- INIT: Google adSense -->
+
        <table border="0" cellpadding="0" cellspacing="0" width="148">
+
      <tr>
+
        <td bgcolor="#3399FF" rowspan="8" width="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
        <td bgcolor="#3399FF" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr><td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td></tr>
+
      <tr>
+
        <td bgcolor="#3399FF" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
 
+
      </tr>
+
      <tr>
+
        <td><p class="menu_right_titolo_gruppo">Ads by
+
  <font color="#2168E0">G</font><font color="#D8240C">o</font><font color="#F4C513">o</font><font color="#2168E0">g</font><font color="#2C9F2C">l</font><font color="#D70000">e</font></p></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#3399FF"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
 
+
        <td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#3399FF"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td>
+
        <script type="text/javascript"><!--
+
google_ad_client = "pub-6275448308915555";
+
google_ad_width = 120;
+
google_ad_height = 240;
+
google_ad_format = "120x240_as";
+
google_ad_type = "text_image";
+
google_ad_channel ="";
+
google_color_border = "FFFFFF";
+
google_color_bg = "FFFFFF";
+
google_color_link = "CC3300";
+
google_color_url = "CC3300";
+
google_color_text = "000000";
+
//--></script>
+
<script type="text/javascript"
+
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+
</script>
+
        </td>
+
      </tr>
+
    </table> 
+
<!-- END: Google adSense -->
+
<br>
+
            <table border="0" cellpadding="0" cellspacing="0" width="148">
+
      <tr>
+
        <td bgcolor="#dc9529" rowspan="8" width="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
        <td bgcolor="#dc9529" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr><td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td></tr>
+
      <tr>
+
        <td bgcolor="#dc9529" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
 
+
      </tr>
+
      <tr>
+
        <td><p class="menu_right_titolo_gruppo"><font color="#dc9529">
+
<img border="0" src="/images/chat_with_me.gif" width="27" height="16"> Chat with me</font></p></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#dc9529"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
 
+
        <td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#dc9529"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td>
+
     
+
        <p class="menu_right">
+
        My nickname is <b>emi </b>but now I am <font color="#FF00FF"><b>offline</b></font>.
+
However you can usually find me on these channels of the
+
<a href="http://www.azzurra.org/">Azzurra</a> networks:</p>
+
<p class="menu_right">
+
        <span style="font-size: 7pt"><a href="irc://irc.azzurra.net/areanetworking">areanetworking</a>,
+
        <a href="irc://irc.azzurra.net/telug">telug</a>,
+
        <a href="irc://irc.azzurra.net/controguerra">controguerra</a>, <a href="irc://irc.azzurra.net/webgui">webgui</a>,
+
        <a href="irc://irc.azzurra.net/geeks">geeks</a>, <a href="irc://irc.azzurra.net/pescaralug">pescaralug</a></span></p>
+
       
+
        </td>
+
      </tr>
+
    </table>
+
       
+
   
+
<br>
+
<table border="0" cellpadding="0" cellspacing="0" width="148">
+
      <tr>
+
        <td bgcolor="#3399FF" rowspan="8" width="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
        <td bgcolor="#3399FF" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr><td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td></tr>
+
      <tr>
+
        <td bgcolor="#3399FF" height="2"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
 
+
      </tr>
+
      <tr>
+
        <td><p class="menu_right_titolo_gruppo">Credits</p></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#3399FF"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
 
+
        <td height="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td height="2" bgcolor="#3399FF"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td>
+
      </tr>
+
      <tr>
+
        <td><p class="menu_right_titolo">
+
<a href="http://www.masonhq.com/">Mason</a>
+
</p>
+
<p class="menu_right">
+
All this website has built using Mason. Without this language derived from Perl,
+
most of the tools used for the manage of this site would never been developed.
+
</p>
+
    <p class="menu_right_titolo">
+
<a href=http://www.milonic.com/>JavaScript Menu</a></p>
+
<p class="menu_right">
+
The great menu at the top of this page.</p>
+
    </td>
+
      </tr>
+
    </table>
+
+
    <!-- END:  left_body -->
+
    </td>
+
    <td valign="top" width="8"><img src="/images/1x1.gif" width="8" height="1" alt=""></td>
+
  </tr>
+
</table>
+
<!-- INIT: Comments -->
+
+
+
<!-- END:  Comments -->
+
<p>
+
<!-- INIT: Google adSense -->
+
<table align="center">
+
<tr><td>
+
<td align="bottom">
+
<script type="text/javascript"><!--
+
google_ad_client = "pub-6275448308915555";
+
google_ad_width = 728;
+
google_ad_height = 90;
+
google_ad_format = "728x90_as";
+
google_ad_type = "text_image";
+
google_ad_channel ="";
+
google_color_border = "4575A3";
+
google_color_bg = "D1E9FF";
+
google_color_link = "0033CC";
+
google_color_url = "CC3300";
+
google_color_text = "000000";
+
//--></script>
+
<script type="text/javascript"
+
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+
</script>
+
</td>
+
</td></tr>
+
</table>
+
<!-- END: Google adSense -->
+
 
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
+
  <tr><td colspan="3" bgcolor="#4575A3" class="linea" HEIGHT="1"><img border="0" src="/images/1x1.gif" width="1" height="1" alt=""></td></tr>
+
  <tr>
+
    <td> Copyright© 1997-2006 Emiliano Bruni</td>
+
<td align="center">Online from 16/08/1998 with <img src="/cgi-bin/c/Count.cgi?ft=0&df=ebruni.it.dat&comma=T&md=8&pad=T&dd=verdana" alt="" align="bottom">
+
visitors</td>
+
    <td align="right">Write me to:
+
    <img border="0" src="/images/mail.gif" width="77" height="10" align="baseline"></td>
+
  </tr>
+
</table>
+
 
+
<pre></pre>
+
</body>
+
</html>
+

Revision as of 08:20, 9 July 2018

How to set up a unix account: To obtain a unix user name and password, create an account by registering at https://registrar.cs.huji.ac.il/account.

Connecting to the hm server: Before connecting to the hm server, an SSH connection needs to be set up. Instructions for set-up can be found at http://wiki.cs.huji.ac.il/wiki/Connecting_from_outside.

Every time you connect to the system, you will need to use a One-Time password (OTP) in addition to your unix (IDng) password. Instructions for obtaining OTPs can be found at http://wiki.cs.huji.ac.il/wiki/Password_and_OTP.

It is helpful to set up an FTP connection for easy file transfer between your desktop computer and the server. To do this with MobaXterm: Create a new SFTP session by clicking on 'Session' and then 'SFTP'. Fill in the basic settings so that remote host = localhost, username = <your unix user name>, and the port = 9001. For example:


You will then need to create an SSH tunnel by clicking on 'Tunneling' and then 'New SSH Tunnel', and fill in the fields (using your unix user name) as follows:


Before you start the transfer you will need to: 1 - start the tunnel by clicking on 'Tunneling' and press the button 2- provide an OTP to open the tunnel 3- start the FTP connection by double clicking on the SFTP session 4- enter your unix password The connection will eventually time out (you will see that the button will no longer be pressed) after which you will need to re-do steps 1-4 to re-open it.

Basic linux commands: For an introduction to some basic linux commands, take a look at the Intro_hm_cluster.pptx presentation.

Understanding the file system: The file system is divided into two main directories – icore and lustre. Your icore directory can be found in /cs/icore/<your unix user name>. Icore is backed up with snapshots so a few previous versions of all files will be saved even after they are modified/deleted (assuming that the file system is up and running), however it has limited space. Icore should be used mainly to store your scripts. You should keep a copy of your scripts on Git, which allows you to save different versions. To use Git to back up scripts, see here. Your lustre directory can be found in /mnt/lustre/hms-01/fs01/<your unix user name>. Lustre should be used mainly to store the data that you are currently working on as it is meant for quick and efficient computations. IMPORTANT: lustre is not backed up! This means that files on lustre that are accidentally deleted will be lost forever, so please be sure to back up all important files (e.g. on an external hard drive). There are graphical interfaces that can make navigating the file system easier. For example, the nautilus file manager (can be opened with the command 'nautilus >& /dev/null &') and gedit text editor ('gedit >& /dev/null &'). For more information, take a look at the Intro_hm_cluster.pptx presentation.

Using slurm on the hm cluster: The hm cluster currently has 44 nodes on which jobs can run. Slurm is a job scheduler that decides which node(s) a job will run on based on the job's requested resources (e.g. number of cpus, amount of memory, etc…), the availability of idle nodes, and the priority of the user which depends on how many jobs were run in the past. All jobs should be submitted as sbatch scripts to slurm where they will be queued and will start running as soon as all of their requested resources become available. Some resource arguments that most users will want to tweak are: Argument Default value Maximum value Description Notes -c, --cpus-per-task 2 32 number of cpus for job Maximum depends on CPU used in cluster, hm I-CORE cluster is 32. --mem 50MB ~64GB or ~128GB memory allocation for job Depends on memory of nodes, we have nodes with 64GB and 128GB of memory, you can't request all the memory since some is needed for the OS, if you want it all and don't care which node you can use: MaxMemPerNode. See below for more details. -t, --time 2 hours 31 days time limit for job Currently 31 days may be reverted to 21 days later. -N, --nodes 1 44 number of nodes to run job on Currently 44, may be increased in the future, either due to additional hardware purchases or reassigning of submit/test hosts to 'active duty' compute nodes.

For more information on all sbatch arguments, e.g., the proper format for writing time limits, etc…, read the sbatch manual.

Submitting a job to the slurm queue: There are 2 general ways to submit jobs using sbatch: 1. one-liner Resources can be requested as arguments on the command line, for example: sbatch -N 2 --mem 8GB --wrap script.sh The above command will submit script.sh as a job to slurm with two nodes and 8GB of RAM requested. The --wrap argument is needed so that the script (or command) is wrapped in an sbatch script.

To run a command with arguments, you need to enclose the command and its arguments in quotes, for example:

sbatch –o output.txt --wrap 'head -n 20 file.txt'

The above code will submit the command 'head -n 20 file.txt' as a job to slurm and will write the output of the command (the first 20 lines of file.txt) to the file output.txt.

2. sbatch script (recommended) Resources can be requested by adding special argument comments to bash scripts. These start with #SBATCH and then contain the sbatch argument, and will be parsed by sbatch until the script starts, so an #SBATCH argument written after the first command of the script will be ignored by sbatch. Here is an example of a bash script called my-sbatch-script.sh with sbatch arguments:

  1. !/bin/bash
  2. SBATCH --mem 10GB

echo "hello world"

  1. The following line will not be parsed by sbatch
  2. SBATCH --time 10

The above script can then be submitted to the slurm queue from the command line as follows: sbatch my-sbatch-script.sh

my-sbatch-script.sh will be submitted as a job to the slurm queue with 10GB of RAM requested. The time limit for the job will be the default two hours since the time parameter will not be parsed by sbatch as it is written after a command in the script.

Requesting resources: Make sure that your job does not request more resources than the maximum (please refer to table above). Jobs that request more than the maximum number of resources will not run. Requests should be kept to as close to the needs of your job as possible for two main reasons: 1- jobs are prioritized in the queue mainly based on requested resources, meaning that the more resources requested, the longer the job will take to start running since it needs to wait for all resources to become available 2- while a job is running, all of its allocated resources will be unavailable to other users even if the job is not using them Requesting multiple nodes: Requesting multiple nodes for a specific job does not automatically divide the job among the nodes. There are a few ways to use multiple nodes simultaneously in order to save computation time: 1- using mpirun 2- using srun 3- using an outer submit script – this is recommended as it is the simplest method 1- using mpirun: If you know that you are running a program that depends on OpenMPI, you can use mpirun to run the program on multiple nodes in parallel – see the mpi manual for more information. 2- using srun: Srun can be used within an sbatch script to utilize a subset of the total requested resources. It can be used to run a command using multiple nodes in parallel which is most useful if you want to run a script/command on many files at the same time, each as its own job on one node, for example:

  1. !/bin/bash
  2. SBATCH -N 5

files=(file0 file1 file2 file3 file4)

for i in {0..4} do srun -N 1 –o output.$i.txt head –n 20 ${files[$i]} & done

The above script will allocate five nodes as requested, and then will send five jobs to the slurm queue at the same time, each running on one node. The output of each job (the first twenty lines of the corresponding file) will be printed in the output.{i}.txt file. If you submit the above script as a job without using the srun command, for example:

  1. !/bin/bash
  2. SBATCH -N 5

files=(file0 file1 file2 file3 file4)

for i in {0..4} do head –n 20 ${files[$i]} & done

Once the above job starts running, it will hold five nodes unavailable to other users as requested, but it will only run on one node. 3- using an outer submit script: The simplest way to run a script/command on many files at the same time, each as its own job on one node, is by using a for loop in a script that submits all of the jobs at once. For example:

  1. !/bin/bash

files=(file0 file1 file2 file3 file4)

for file in ${files[*]} do sbatch head.sh $file done

The above script loops through all files in the list 'files' and submits the script head.sh (with 'file' as an argument) as an sbatch job. The head.sh script will contain the sbatch arguments needed to run on one file. For example:

  1. !/bin/bash
  2. SBATCH –o output.txt
  3. SBATCH –N 1

file=$1 #first argument from outer script head –n 20 $file

The head.sh script will be run as a job on one node (based on the sbatch arguments written in the script) on each of the 5 files in parallel.

Requesting multiple cpus:

If you are running a program that supports multithreading, you can request multiple cpus (up to the maximum) and then run the program while specifying the number of cpus you want it to use as a parameter. For example:

  1. !/bin/bash
  2. SBATCH –c 32 #request 32 cpus
  3. SBATCH –o output.txt

sample=$1 bowtie2 -p 32 -x $genome -U $sample -S $sam >& bowtie2.log

The above script can be submitted as a job that will run bowtie2 using 32 cpus on 'sample' (with the bowtie2 output saved in the file bowtie2.log).

Requesting memory: If the amount of memory requested is not enough for the job, it will be killed with an error message that the job exceeded the memory limit and you will need to increase the memory request. There is currently no simple method to know how much memory a job will need before it runs. Once an sbatch job is running you can check its accounting information with the 'sacct' command. For more information, read the CS slurm wiki. FAQs 1. How do I check the status of my job? By running the command 'squeue –u username' with your username you will see all of your submitted jobs and their status (ST column). PD means your job is pending in the queue waiting to start, and R means it is running. For a list of all status codes, read the 'JOB STATE CODES' section of the squeue manual. 2. How do I cancel a job? Jobs can be cancelled by running the command 'scancel jobid' where the jobid is the number that slurm assigned your job when it was submitted which you can see by running 'squeue –u username' and looking at the JOBID column. 3. Why is my job taking so long to start running? Jobs are prioritized in the slurm queue mainly based on the amount of resources requested. The more resources your job requests, the longer it will take to start running. 4. How much memory/cpus did my job actually use? When a job is running, you can use the following commands to see its accounting information: sacct – see the sacct manual for more details sstat – see the sstat manual for more details 5. Can I submit a job and tell it to run at a later time? You can tell a job what time you want it to start running with the parameter --begin:

  1. SBATCH --begin HH:MM MM/DD/YY
Alternatively, you can add dependencies to your jobs so that, for example, job #2 will not start until job #1 satisfies the provided condition, by using the job id. This can be done in a bash script:
  1. !/bin/bash

jobid1=$(sbatch job1.sh) sbatch –-dependency afterok:jobid1 job2.sh

The above script submits job1.sh as a job and saves jobid in the variable jobid1. It then submits job2.sh as a job only once job1 finishes running with an exit code of 0 as defined by the condition 'afterok'. For more information on possible conditions, etc… please refer to the sbatch manual.