{"id":77,"date":"2019-03-06T11:21:53","date_gmt":"2019-03-06T16:21:53","guid":{"rendered":"http:\/\/psycomp.utsc.utoronto.ca\/support\/?page_id=77"},"modified":"2019-06-21T22:02:13","modified_gmt":"2019-06-22T02:02:13","slug":"sge-to-slurm-conversion","status":"publish","type":"page","link":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/resources\/sge-to-slurm-conversion\/","title":{"rendered":"SGE to SLURM conversion"},"content":{"rendered":"<p><strong>Sun Grid Engine<\/strong> (<strong>SGE<\/strong>) and <strong>SLURM<\/strong> job scheduler concepts are quite similar. Below is a table of some common SGE commands and their SLURM equivalents.<\/p>\r\n\r\n<p>Some common commands and flags in SGE and SLURM with their respective equivalents:<\/p>\r\n<p> <\/p>\r\n<table><tbody><tr><td><strong>User Commands<\/strong><\/td>\r\n\t\t\t<td><strong>SGE<\/strong><\/td>\r\n\t\t\t<td><strong>SLURM<\/strong><\/td>\r\n\t\t<\/tr><tr><td><strong>Interactive login<\/strong><\/td>\r\n\t\t\t<td>qlogin<\/td>\r\n\t\t\t<td>\r\n\t\t\t\t<pre>\r\nsrun --pty bash or srun -p \"partition name\" --time=4:0:0 --pty bash. For a quick dev node, just run \"sdev\"<\/pre>\r\n\t\t\t<\/td>\r\n\t\t<\/tr><tr><td><strong>Job submission<\/strong><\/td>\r\n\t\t\t<td>qsub [script_file]<\/td>\r\n\t\t\t<td>sbatch [script_file]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job deletion<\/strong><\/td>\r\n\t\t\t<td>qdel [job_id]<\/td>\r\n\t\t\t<td>scancel [job_id]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job status by job<\/strong><\/td>\r\n\t\t\t<td>qstat -u \\* [-j job_id]<\/td>\r\n\t\t\t<td>squeue [job_id]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job status by user<\/strong><\/td>\r\n\t\t\t<td>qstat [-u user_name]<\/td>\r\n\t\t\t<td>\r\n\t\t\t\t<p>squeue -u [user_name]<\/p>\r\n\t\t\t<\/td>\r\n\t\t<\/tr><tr><td><strong>Job hold<\/strong><\/td>\r\n\t\t\t<td>qhold [job_id]<\/td>\r\n\t\t\t<td>scontrol hold [job_id]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job release<\/strong><\/td>\r\n\t\t\t<td>qrls [job_id]<\/td>\r\n\t\t\t<td>scontrol release [job_id]<\/td>\r\n\t\t<\/tr><tr><td><strong>Queue list<\/strong><\/td>\r\n\t\t\t<td>qconf -sql<\/td>\r\n\t\t\t<td>squeue<\/td>\r\n\t\t<\/tr><tr><td><strong>List nodes<\/strong><\/td>\r\n\t\t\t<td>qhost<\/td>\r\n\t\t\t<td>sinfo -N OR scontrol show nodes<\/td>\r\n\t\t<\/tr><tr><td><strong>Cluster status<\/strong><\/td>\r\n\t\t\t<td>qhost -q<\/td>\r\n\t\t\t<td>sinfo<\/td>\r\n\t\t<\/tr><tr><td><strong>GUI<\/strong><\/td>\r\n\t\t\t<td>qmon<\/td>\r\n\t\t\t<td>sview<\/td>\r\n\t\t<\/tr><tr><td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t<\/tr><tr><td><strong>Environmental<\/strong><\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t<\/tr><tr><td><strong>Job ID<\/strong><\/td>\r\n\t\t\t<td>$JOB_ID<\/td>\r\n\t\t\t<td>$SLURM_JOBID<\/td>\r\n\t\t<\/tr><tr><td><strong>Submit directory<\/strong><\/td>\r\n\t\t\t<td>$SGE_O_WORKDIR<\/td>\r\n\t\t\t<td>$SLURM_SUBMIT_DIR<\/td>\r\n\t\t<\/tr><tr><td><strong>Submit host<\/strong><\/td>\r\n\t\t\t<td>$SGE_O_HOST<\/td>\r\n\t\t\t<td>$SLURM_SUBMIT_HOST<\/td>\r\n\t\t<\/tr><tr><td><strong>Node list<\/strong><\/td>\r\n\t\t\t<td>$PE_HOSTFILE<\/td>\r\n\t\t\t<td>$SLURM_JOB_NODELIST<\/td>\r\n\t\t<\/tr><tr><td><strong>Job Array Index<\/strong><\/td>\r\n\t\t\t<td>$SGE_TASK_ID<\/td>\r\n\t\t\t<td>$SLURM_ARRAY_TASK_ID<\/td>\r\n\t\t<\/tr><tr><td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t<\/tr><tr><td><strong>Job Specification<\/strong><\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t<\/tr><tr><td><strong>Script directive<\/strong><\/td>\r\n\t\t\t<td>#$<\/td>\r\n\t\t\t<td>#SBATCH<\/td>\r\n\t\t<\/tr><tr><td><strong>queue<\/strong><\/td>\r\n\t\t\t<td>-q [queue]<\/td>\r\n\t\t\t<td>-p [queue]<\/td>\r\n\t\t<\/tr><tr><td><strong>count of nodes<\/strong><\/td>\r\n\t\t\t<td>N\/A<\/td>\r\n\t\t\t<td>-N [min[-max]]<\/td>\r\n\t\t<\/tr><tr><td><strong>CPU count<\/strong><\/td>\r\n\t\t\t<td>-pe [PE] [count]<\/td>\r\n\t\t\t<td>-n [count]<\/td>\r\n\t\t<\/tr><tr><td><strong>Wall clock limit<\/strong><\/td>\r\n\t\t\t<td>-l h_rt=[seconds]<\/td>\r\n\t\t\t<td>-t [min] OR -t [days-hh:mm:ss]<\/td>\r\n\t\t<\/tr><tr><td><strong>Standard out file<\/strong><\/td>\r\n\t\t\t<td>-o [file_name]<\/td>\r\n\t\t\t<td>-o [file_name]<\/td>\r\n\t\t<\/tr><tr><td><strong>Standard error file<\/strong><\/td>\r\n\t\t\t<td>-e [file_name]<\/td>\r\n\t\t\t<td>e [file_name]<\/td>\r\n\t\t<\/tr><tr><td><strong>Combine STDOUT &amp; STDERR files <\/strong><\/td>\r\n\t\t\t<td>-j yes<\/td>\r\n\t\t\t<td>(use -o without -e)<\/td>\r\n\t\t<\/tr><tr><td><strong>Copy environment<\/strong><\/td>\r\n\t\t\t<td>-V<\/td>\r\n\t\t\t<td>&#8211;export=[ALL | NONE | variables]<\/td>\r\n\t\t<\/tr><tr><td><strong>Event notification<\/strong><\/td>\r\n\t\t\t<td>-m abe<\/td>\r\n\t\t\t<td>&#8211;mail-type=[events]<\/td>\r\n\t\t<\/tr><tr><td><strong>send notification email<\/strong><\/td>\r\n\t\t\t<td>-M [address]<\/td>\r\n\t\t\t<td>&#8211;mail-user=[address]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job name<\/strong><\/td>\r\n\t\t\t<td>-N [name]<\/td>\r\n\t\t\t<td>&#8211;job-name=[name]<\/td>\r\n\t\t<\/tr><tr><td><strong>Restart job<\/strong><\/td>\r\n\t\t\t<td>-r [yes|no]<\/td>\r\n\t\t\t<td>&#8211;requeue OR &#8211;no-requeue (NOTE:<br \/>\r\n\t\t\t\tconfigurable default)<\/td>\r\n\t\t<\/tr><tr><td><strong>Set working directory<\/strong><\/td>\r\n\t\t\t<td>-wd [directory]<\/td>\r\n\t\t\t<td>&#8211;workdir=[dir_name]<\/td>\r\n\t\t<\/tr><tr><td><strong>Resource sharing<\/strong><\/td>\r\n\t\t\t<td>-l exclusive<\/td>\r\n\t\t\t<td>&#8211;exclusive OR&#8211;shared<\/td>\r\n\t\t<\/tr><tr><td><strong>Memory size<\/strong><\/td>\r\n\t\t\t<td>-l mem_free=[memory][K|M|G]<\/td>\r\n\t\t\t<td>&#8211;mem=[mem][M|G|T] OR &#8211;mem-per-cpu=<br \/>\r\n\t\t\t\t[mem][M|G|T]<\/td>\r\n\t\t<\/tr><tr><td><strong>Charge to an account<\/strong><\/td>\r\n\t\t\t<td>-A [account]<\/td>\r\n\t\t\t<td>&#8211;account=[account]<\/td>\r\n\t\t<\/tr><tr><td><strong>Tasks per node<\/strong><\/td>\r\n\t\t\t<td>(Fixed allocation_rule in PE)<\/td>\r\n\t\t\t<td>&#8211;tasks-per-node=[count]<\/td>\r\n\t\t<\/tr><tr><td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t\t<td>&#8211;cpus-per-task=[count]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job dependancy<\/strong><\/td>\r\n\t\t\t<td>-hold_jid [job_id | job_name]<\/td>\r\n\t\t\t<td>&#8211;depend=[state:job_id]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job project<\/strong><\/td>\r\n\t\t\t<td>-P [name]<\/td>\r\n\t\t\t<td>&#8211;wckey=[name]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job host preference<\/strong><\/td>\r\n\t\t\t<td>-q [queue]@[node] OR -q<br \/>\r\n\t\t\t\t[queue]@@[hostgroup]<\/td>\r\n\t\t\t<td>&#8211;nodelist=[nodes] AND\/OR &#8211;exclude=<br \/>\r\n\t\t\t\t[nodes]<\/td>\r\n\t\t<\/tr><tr><td><strong>Quality of service<\/strong><\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t\t<td>&#8211;qos=[name]<\/td>\r\n\t\t<\/tr><tr><td><strong>Job arrays<\/strong><\/td>\r\n\t\t\t<td>-t [array_spec]<\/td>\r\n\t\t\t<td>&#8211;array=[array_spec] (Slurm version 2.6+)<\/td>\r\n\t\t<\/tr><tr><td><strong>Generic Resources<\/strong><\/td>\r\n\t\t\t<td>-l [resource]=[value]<\/td>\r\n\t\t\t<td>&#8211;gres=[resource_spec]<\/td>\r\n\t\t<\/tr><tr><td><strong>Lincenses<\/strong><\/td>\r\n\t\t\t<td>-l [license]=[count]<\/td>\r\n\t\t\t<td>&#8211;licenses=[license_spec]<\/td>\r\n\t\t<\/tr><tr><td><strong>Begin Time<\/strong><\/td>\r\n\t\t\t<td>-a [YYMMDDhhmm]<\/td>\r\n\t\t\t<td>&#8211;begin=YYYY-MM-DD[THH:MM[:SS]]<\/td>\r\n\t\t<\/tr><\/tbody><\/table><p> <\/p>\r\n<table><tbody><tr><th><strong>SGE<\/strong><\/th>\r\n\t\t\t<th><strong>SLURM<\/strong><\/th>\r\n\t\t<\/tr><\/tbody><tbody><tr><td>qstat<br \/><blockquote>qstat -u username<br \/>\r\n\t\t\t\t\tqstat -f<\/blockquote>\r\n\t\t\t<\/td>\r\n\t\t\t<td>squeue<br \/><blockquote>squeue -u username<br \/>\r\n\t\t\t\t\tsqueue -al<\/blockquote>\r\n\t\t\t<\/td>\r\n\t\t<\/tr><tr><td>qsub<br \/><blockquote>qsub -N jobname<br \/>\r\n\t\t\t\t\tqsub -l h_rt=24:00:00<br \/>\r\n\t\t\t\t\tqsub -pe dmp4 16<br \/>\r\n\t\t\t\t\tqsub -l mem=4G<br \/>\r\n\t\t\t\t\tqsub -o filename<br \/>\r\n\t\t\t\t\tqsub -e filename<br \/>\r\n\t\t\t\t\tqsub -l scratch_free=20G<\/blockquote>\r\n\t\t\t<\/td>\r\n\t\t\t<td>sbatch<br \/><blockquote>sbatch -J jobname<br \/>\r\n\t\t\t\t\tsbatch -t 24:00:00<br \/>\r\n\t\t\t\t\tsbatch -p node -n 16<\/blockquote>\r\n\t\t\t\t<blockquote>sbatch &#8211;mem=4000<br \/>\r\n\t\t\t\t\tsbatch -o filename<br \/>\r\n\t\t\t\t\tsbatch -e filename<\/blockquote>\r\n\t\t\t<\/td>\r\n\t\t<\/tr><tr><td># Interactive run, one core<\/td>\r\n\t\t\t<td># Interactive run, one core<\/td>\r\n\t\t<\/tr><tr><td>qrsh -l h_rt=8:00:00<\/td>\r\n\t\t\t<td>salloc -t 8:00:00<br \/>\r\n\t\t\t\tinteractive -p core -n 1 -t 8:00:00<\/td>\r\n\t\t<\/tr><tr><td><br \/>\r\n\t\t\t\tqdel<\/td>\r\n\t\t\t<td><br \/>\r\n\t\t\t\tscancel<\/td>\r\n\t\t<\/tr><\/tbody><\/table><p> <\/p>\r\n<p> <\/p>\r\n<table><tbody><tr><th><strong>SGE for a single-core application<\/strong><\/th>\r\n\t\t\t<th><strong>SLURM for a single-core application<\/strong><\/th>\r\n\t\t<\/tr><\/tbody><tbody><tr><td>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<pre>\r\n<span>#!\/bin\/bash<\/span>\r\n<span>#<\/span>\r\n<span>#<\/span>\r\n<span>#$ -N test<\/span>\r\n<span>#$ -j y<\/span>\r\n<span>#$ -o test.output<\/span>\r\n<span>#$ -cwd<\/span>\r\n<span>#$ -M $USER@stanford.edu<\/span>\r\n<span>#$ -m bea<\/span>\r\n<span># Request 5 hours run time<\/span>\r\n<span>#$ -l h_rt=5:0:0<\/span>\r\n<span>#$ -P your_project_id_here<\/span>\r\n<span>#<\/span>\r\n<span>#$ -l mem=4G<\/span>\r\n<span># <\/span>\r\n \r\n<span>&lt;<\/span>call your app here<span>&gt;<\/span><\/pre>\r\n\t\t\t\t<\/div>\r\n\t\t\t<\/td>\r\n\t\t\t<td>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<pre>\r\n<span>#!\/bin\/bash -l<\/span>\r\n<span># NOTE the -l flag!<\/span>\r\n<span>#<\/span>\r\n<span>#SBATCH -J tes<\/span>t\r\n<span>#SBATCH -o test.\"%j\".out<\/span>\r\n<span>#SBATCH -e test.\"%j\".err<\/span>\r\n<span># Default in slurm<\/span>\r\n<span>#SBATCH --mail-user $USER@stanford.edu<\/span>\r\n<span>#SBATCH --mail-type=ALL<\/span>\r\n<span># Request 5 hours run time<\/span>\r\n<span>#SBATCH -t 5:0:0<\/span>\r\n<span>#SBATCH --mem=4000<\/span>\r\n<span>#SBATCH -p normal<\/span>\r\n\r\n \r\n<span>&lt;<\/span>load modules, call your app here<span>&gt;<\/span><\/pre>\r\n\t\t\t\t<\/div>\r\n\t\t\t<\/td>\r\n\t\t<\/tr><tr><td> <\/td>\r\n\t\t\t<td> <\/td>\r\n\t\t<\/tr><\/tbody><\/table><p>Comparison of some parallel environments set by sge and slurm<\/p>\r\n<table><tbody><tr><th><strong>SGE<\/strong><\/th>\r\n\t\t\t<th><strong>SLURM<\/strong><\/th>\r\n\t\t<\/tr><\/tbody><tbody><tr><td>$JOB_ID<\/td>\r\n\t\t\t<td>$SLURM_JOB_ID<\/td>\r\n\t\t<\/tr><tr><td>$NSLOTS<\/td>\r\n\t\t\t<td>$SLURM_NPROCS<\/td>\r\n\t\t<\/tr><\/tbody><\/table><p> <\/p>\r\n<p> <\/p>","protected":false},"excerpt":{"rendered":"<p>Sun Grid Engine (SGE) and SLURM job scheduler concepts are quite similar. Below is a table of some common SGE commands and their SLURM equivalents. Some common commands and flags in SGE and SLURM with their respective equivalents: User Commands &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/resources\/sge-to-slurm-conversion\/\"> <span class=\"screen-reader-text\">SGE to SLURM conversion<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":50,"menu_order":100,"comment_status":"closed","ping_status":"closed","template":"full-width-page.php","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-77","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/pages\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":11,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/pages\/77\/revisions"}],"predecessor-version":[{"id":861,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/pages\/77\/revisions\/861"}],"up":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/pages\/50"}],"wp:attachment":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/media?parent=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}