User Tools

Site Tools


torque_slurm_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
torque_slurm_scripts [2020/01/29 18:59]
127.0.0.1 external edit
torque_slurm_scripts [2022/02/02 20:36] (current)
jpummil
Line 1: Line 1:
 ====Slurm Commands and Scripts==== ====Slurm Commands and Scripts====
-Basic torque/slurm commands are:+Basic slurm commands are:
 <csv> <csv>
-torque,                     slurm, use +slurm, use 
-qsub,                       sbatch         ,       submit <job file> +sbatch         ,       submit <job file> 
-qsub -I   ,                  srun            ,      submit interactive job +srun            ,      submit interactive job 
-qstat  ,                     squeue           ,     list all queued jobs +squeue           ,     list all queued jobs 
-qstat -u rfeynman  ,         squeue -u rfeynman  ,  list queued jobs for user rfeynman +squeue -u rfeynman  ,  list queued jobs for user rfeynman 
-qdel        ,                scancel       ,        cancel <job#> +scancel       ,        cancel <job#> 
-shownodes -l -n;qstat -q ,   sinfo         ,        node status;list of queues+sinfo         ,        node status;list of queues
 </csv> </csv>
  
-A basic slurm script looks like:+A basic script in ''slurm'' looks like: 
 <code> <code>
 #!/bin/bash #!/bin/bash
Line 25: Line 26:
 mpirun -np $SLURM_NTASKS -machinefile /scratch/${SLURM_JOB_ID}/machinefile_${SLURM_JOB_ID} ./mympiexe -inputfile MA4um.mph -outputfile MA4um-output.mph mpirun -np $SLURM_NTASKS -machinefile /scratch/${SLURM_JOB_ID}/machinefile_${SLURM_JOB_ID} ./mympiexe -inputfile MA4um.mph -outputfile MA4um-output.mph
 </code> </code>
-and a little more complicated with file moving in and out of a scratch area:+ 
 +and a more complex script with file moving looks like: 
 + 
 <code> <code>
-pinnacle-l1:$ cat script.slurm 
 #!/bin/bash #!/bin/bash
 #SBATCH --job-name=espresso #SBATCH --job-name=espresso
Line 44: Line 47:
 pinnacle-l1:$ pinnacle-l1:$
 </code> </code>
 +
 +See also [ https://hprc.tamu.edu/wiki/TAMU_Supercomputing_Facility:HPRC:Batch_Translation ] [ https://slurm.schedmd.com/rosetta.pdf ] [ https://www.sdsc.edu/~hocks/FG/PBS.slurm.html ]
 +
 +We have a conversion script **/share/apps/bin/pbs2slurm.sh** which should do 95% of the script conversion from old PBS scripts to SLURM scripts. Please report errors by the script so we can improve it. Normally it should be in your path and
 +<code>
 +pbs2slurm.sh <pbs-script-name>
 +</code>
 +will generate the conversion to stdout, thus save with "> newscript.slurm".
 +
 +==Notes:==
 +
 +Leading hash-bang /bin/sh or /bin/bash or /bin/tcsh is optional in torque, required in slurm, pbs2slurm.sh inserts it if not present\\
 +Slurm does not autogenerate an MPI machinefile/hostfile, so the job creates
 +<code>/scratch/${SLURM_JOB_ID}/machinefile_${SLURM_JOB_ID}</code>
 +The generated machinefile differs from torque machinefile in that it has 1 entry per host instead of ''ncores'' entry per host.
 +Slurm does define a variable with the total number of cores ''$SLURM_NTASKS'', good for most MPI jobs that use every core.
 +
torque_slurm_scripts.1580324380.txt.gz · Last modified: 2020/01/29 18:59 by 127.0.0.1