{"id":75,"date":"2016-06-07T23:40:52","date_gmt":"2016-06-08T03:40:52","guid":{"rendered":"http:\/\/williamkennerly.com\/blog\/?p=75"},"modified":"2016-06-07T23:40:52","modified_gmt":"2016-06-08T03:40:52","slug":"writing-scripts-to-submit-jobs-on-comet-using-the-slurm-queue-manager","status":"publish","type":"post","link":"http:\/\/williamkennerly.com\/blog\/writing-scripts-to-submit-jobs-on-comet-using-the-slurm-queue-manager\/","title":{"rendered":"Writing scripts to submit jobs on comet using the slurm queue manager"},"content":{"rendered":"<p>Comet is a huge cluster of thousands of computing nodes, and the queue manager software called &#8220;slurm&#8221; is what handles all the requests, directs each job to a specific node(s), and then lets you know when its done. In a prior post I showed the <a href=\"http:\/\/williamkennerly.com\/blog\/running-a-job-on-comet-using-the-queue-manager-called-slurm\/\">basic slurm commands to submit a job and check the queue<\/a>.<\/p>\n<p>You also need to write a special linux bash script that contains a bunch of slurm configurations, and also the linux commands to actually run your calculation. \u00a0This is easiest show by example, and I&#8217;ll show two: \u00a0one for a Gaussian job, and another for an AMBER job.<\/p>\n<blockquote><p><code><br \/>\n#!\/bin\/bash<br \/>\n#SBATCH -t 10:00:00<br \/>\n#SBATCH --job-name=\"gaussian\"<br \/>\n#SBATCH --output=\"gaussian.%j.%N.out\"<br \/>\n#SBATCH --partition=batch<br \/>\n#SBATCH --nodes=1<br \/>\n#SBATCH --ntasks-per-node=1<br \/>\n#SBATCH --export=ALL<\/code><\/p>\n<p><code><br \/>\nnprocshared=1<br \/>\njobfile=YOURINPUTFILE \u00a0#assumes you use a gjf extension (which is added below)<br \/>\njobfile=$jobfile.gjf<br \/>\noutputfile=$jobfile.out<\/code><\/p>\n<p><code>export GAUSS_SCRDIR=\/scratch\/$USER\/$SLURM_JOBID<br \/>\n. \/etc\/profile.d\/modules.sh<br \/>\nmodule load gaussian<br \/>\nexe=`which g09`<br \/>\nexport OMP_NUM_THREADS=$nprocshared<br \/>\n\/usr\/bin\/time $exe &lt; $jobfile &gt; $outputfile<\/code><\/p><\/blockquote>\n<p>If you copy this file exactly and then modify just the important parts, you can submit your own Gaussian jobs quickly. \u00a0 But its worth knowing what these commands do. \u00a0All the SBATCH commands are slurm settings. \u00a0Most important is the line with the &#8220;t&#8221; flag which sets the wall time you think the job will require. \u00a0(&#8220;Wall time&#8221; means the same thing as &#8220;real time&#8221;, as if you were watching the clock on your wall.) \u00a0If your job winds up going longer than your set wall time, then slurm will automatically cancel your job even if it didn&#8217;t finish&#8212;so don&#8217;t underestimate. \u00a0 The other important slurm flags are for &#8220;nodes&#8221; and &#8220;n-tasks-per-node&#8221;, which set how many nodes you want the job to use, and how many processors (cores) per node you want your job to use, respectively. \u00a0For Gaussian jobs, you always want to use nodes=1. \u00a0You can start with tasks-per-node=1, and then try and increase it up to 12 (the max for comet) to see if your calculation can take advantage of any of Gaussian&#8217;s parallel processing algorithms. \u00a0(You would also need to add a <code>%nprocshared=8<\/code> line to the .gjf file. \u00a0It doesn&#8217;t always work that well, meaning your simply wasting processing time that we have to pay for.)<\/p>\n<p>The commands at the bottom are bash linux commands that set up some important variables, including the stem of the filename for your Gaussian job file. \u00a0Eventually the script then loads the Gaussian module, and with the last line, submits your job.<\/p>\n<p>If you&#8217;re using AMBER for molecular dynamics simulations, here&#8217;s a simple slurm script you can copy:<\/p>\n<blockquote><p><code>#!\/bin\/bash -l<br \/>\n#SBATCH -t 01:10:00<br \/>\n#SBATCH --job-name=\"amber\"<br \/>\n#SBATCH --output=\"oamber.%j\"<br \/>\n#SBATCH --error=\"eamber.%j\"<br \/>\n#SBATCH --partition=\"compute\"<br \/>\n#SBATCH --nnodes=1<br \/>\n#SBATCH --ntasks-per-node=1<br \/>\n#SBATCH --no-requeue<br \/>\n#SBATCH --mail-type=END<br \/>\n#SBATCH --mail-user=username@skidmore.edu<\/code><\/p>\n<p><code>module load amber<\/code><\/p>\n<p><code>ibrun sander.MPI -np 1 -O -i equil4.in -p 2mlt.top -c 2mlt_equil3.crd -r 2mlt_equil4.crd -ref 2mlt_equil3.crd -x 2mlt_equil4.trj -o mdout<\/code><\/p><\/blockquote>\n<p>The SBATCH commands do the same job of configuring slurm, though the &#8220;mail-type&#8221; and &#8220;mail-user&#8221; options show how you can have slurm email you when a job finishes. In this example, the last <code>ibrun<\/code> command is the one that actually runs AMBER (a sander job) and sets up all of its settings, input files, output files, and other necessities. Those must be changed for each new job.<\/p>\n<p>Here is some specific information and examples for <a href=\"https:\/\/portal.xsede.org\/sdsc-comet#running\">comet at the San Diego Supercomputer Center<\/a>, as well as a complete list of <a href=\"http:\/\/slurm.schedmd.com\/sbatch.html\">all the slurm options you can use<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Comet is a huge cluster of thousands of computing nodes, and the queue manager software called &#8220;slurm&#8221; is what handles all the requests, directs each job to a specific node(s), and then lets you know when its done. In a &hellip; <a href=\"http:\/\/williamkennerly.com\/blog\/writing-scripts-to-submit-jobs-on-comet-using-the-slurm-queue-manager\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[3,2],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-computing","tag-comet","tag-slurm"],"_links":{"self":[{"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":6,"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":88,"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/posts\/75\/revisions\/88"}],"wp:attachment":[{"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/williamkennerly.com\/blog\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}