{"id":305,"date":"2019-06-28T10:14:30","date_gmt":"2019-06-28T14:14:30","guid":{"rendered":"https:\/\/psycomp.utsc.utoronto.ca\/support\/?p=305"},"modified":"2021-01-18T21:10:59","modified_gmt":"2021-01-19T02:10:59","slug":"slurm-example-using-sbatch","status":"publish","type":"post","link":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/2019\/06\/28\/slurm-example-using-sbatch\/","title":{"rendered":"Slurm Example using &#8220;sbatch&#8221;"},"content":{"rendered":"<p><strong><u>Note:<\/u><\/strong> you need to sign into the Psychology cluster (<font color=red>neurocomp0<\/font>) to run the following commands.<\/p>\r\n<p><strong><u>Note:<\/u><\/strong> put two number signs &#8220;##&#8221; at the beginning of a line to comment it out.<\/p>\r\n<p><strong><u>Note:<\/u><\/strong> you&#8217;ll get an email when the job starts and an email when the job finishes if you provide <i>&#8211;mail-user<\/i> (remove a number sign # to uncomment the line first).<\/p>\r\n<pre>\r\n#!\/bin\/bash\r\n#SBATCH --job-name=\"slurmTest\"\r\n#SBATCH --partition=cpu\r\n#SBATCH --nodes=1\r\n#SBATCH --ntasks=2\r\n#SBATCH --cpus-per-task=1\r\n#SBATCH --mem=23000\r\n#SBATCH --output=slurmTest.out\r\n##SBATCH --mail-user=YOUR_EMAIL_ADDRESS\r\n#SBATCH --mail-type=ALL\r\n\r\n##SBATCH --time=00:15:00\r\n##SBATCH --requeue      #Specifies that the job will be requeued after a node failure.The default is that the job will not be requeued.\r\n##SBATCH --checkpoint=1:0:0\r\n\r\nhostname\r\ndate +'%y-%m-%d %H:%M:%S'\r\nwhich python\r\npython --version\r\nmodule load python\r\nwhich python\r\npython --version\r\nmodule unload python\r\nwhich python\r\npython --version\r\ndate +'%y-%m-%d %H:%M:%S'\r\n<\/pre>\r\n<p><strong><u>Note:<\/u><\/strong> this example will ask for \r\n<ul>\r\n<li>1 node (<i>#SBATCH &#8211;nodes=1<\/i>)<\/li>\r\n<li>2 CPU cores (<i>#SBATCH &#8211;ntasks=2<\/i>, <i>#SBATCH &#8211;cpus-per-task=1<\/i>)<\/li>\r\n<li>2.3GB RAM (<i>#SBATCH &#8211;mem=23000<\/i>)<\/li>\r\n<li>redirect standard output \/ error to  &#8220;slurmTest.out&#8221; file (<i>#SBATCH &#8211;output=slurmTest.out<\/i>)<\/li>\r\n<\/ul>\r\n<\/p>\r\n<p>To run the example (SBATCH_EXAMPLE.sh, for example), sign into the head node, open a terminal and run:\r\n<pre>\r\nsbatch SBATCH_EXAMPLE.sh\r\n<\/pre>\r\nHere is an example output:\r\n<pre>\r\nneurocomp2\r\n19-06-28 10:33:57\r\n\/usr\/bin\/python\r\nPython 2.7.15+\r\n\/pkgs\/anaconda3\/bin\/python\r\nPython 3.7.3\r\n\/usr\/bin\/python\r\nPython 2.7.15+\r\n19-06-28 10:33:57\r\n<\/pre>\r\n","protected":false},"excerpt":{"rendered":"<p>Note: you need to sign into the Psychology cluster (neurocomp0) to run the following commands. Note: put two number signs &#8220;##&#8221; at the beginning of a line to comment it out. Note: you&#8217;ll get an email when the job starts &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/2019\/06\/28\/slurm-example-using-sbatch\/\"> <span class=\"screen-reader-text\">Slurm Example using &#8220;sbatch&#8221;<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/comments?post=305"}],"version-history":[{"count":13,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":484,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts\/305\/revisions\/484"}],"wp:attachment":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/media?parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/categories?post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/tags?post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}