quickstart

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
quickstart [2023/09/11 19:23] docuadminquickstart [2025/05/08 19:43] (current) docuadmin
Line 35: Line 35:
   * Name (''-J'') A name for the job    * Name (''-J'') A name for the job 
  
-A complete list of parameters that ''srun'' accepts is available in the [[https://slurm.schedmd.com/srun.html|''srun'' manpage].+A complete list of parameters that ''srun'' accepts is available in the [[https://slurm.schedmd.com/srun.html|manpage]] for ''srun''.
  
-As an example, consider this command. It will print the date, wait 5 seconds, then print the date again.+====== Run an Interactive Job on a Compute Node ====== 
 + 
 +Running an interactive job on a compute node is the preferred method of testing jobs and scripts. Doing so avoids running resource-intensive workloads on the master (or login) node. 
 +To start a job with an interactive shell on a compute node you can use this command: 
 + 
 +    srun -N 1 -n 1 --pty /bin/bash 
 + 
 +====== Basic job submission ====== 
 + 
 +Consider this command. If you enter this command on the command line of a Terminal, it will print the date, wait 5 seconds, then print the date again. 
 +    
     $ date; sleep 5; date;     $ date; sleep 5; date;
  
-To execute this job on the cluster, we would turn this command in to a very simple script:+To execute this simple series of commands you can create a very simple script:
    
-File `date.sub`:+File ''date.sub'':
  
     #!/bin/bash     #!/bin/bash
Line 48: Line 58:
     sleep 5     sleep 5
     date     date
-  
-Once the script is created it can submitted to the scheduler. But we also need to tell the scheduler what resources are needed and how long the job will likely take. This information can be passed to Moab directly in the `msub` command or it can be placed in the script itself. 
  
-The job can be submitted to the scheduler adding flags to the `msub` command to request one node, one core, and specify a duration (i.e. walltime) of 6 seconds   +The commands are now in a format that can be submitted to the scheduler to be run as a job on the cluster. But we also need to tell the scheduler what resources are neededThis information can be passed to SLURM directly in the ''srun'' command or it can be placed in the script itself.
  
-    $ msub -l nodes=1:ppn=1,walltime=00:06 date.sub+The job can be submitted to the scheduler by adding flags to the ''sbatch'' command to request one node and one task per node   
  
-To place this request in the script itself, we modify the script to include an additional line with the resources request:+    $ sbatch -J SleepJob -N 1 --tasks-per-node=1 date.sub &
  
-File `date.sub`:+To place the resource request in the script itself, we modify the script to include additional lines for SLURM: 
 + 
 +File ''date.sub'':
  
     #!/bin/bash     #!/bin/bash
-    #PBS -l nodes=1:ppn=1,walltime=02:00+    #SBATCH -1 
 +    #SBATCH --tasks-per-node=1 
 +    #SBATCH -J SleepJob
          
     date     date
Line 66: Line 78:
     date     date
  
-Then the job is submitted with `msub`:+Then the job is submitted with ''sbatch'':
  
-    $ msub date.sub+    $ sbatch date.sub
    
-The ''msub'' command will return a number for your job, the JOBID.  Now that the job is in the queue, you can check the status of the job using the ''showq'' command or the ''checkjob'' command:+The ''srun'' command will return a number for your job, the JOBID.  Now that the job is in the queue, you can check the status of the job using the ''squeue'' command:
  
-    $ showq+    $ squeue --job <JOBID>
 -or- -or-
 +    $ squeue -n <Job name if specified upon submission>
 +
 +
 +====== Next Steps ======
  
-    $ checkjob JOBID+A step-by-step tutorial for creating and submitting a job using Open OnDemand is available here.
  
-Refer to the [[http://docs.adaptivecomputing.com/9-1-3/suite/help.htm#topics/moabWorkloadManager/moabCommands/user-cmds.html%3FTocPath%3DMoab%2520Workload%2520Manager%7CChapter%25203%253A%2520Scheduler%2520Commands%7C_____6|Moab Documentation]] for complete list of parameters that can be fed to the scheduler.+Comprehensive [[https://slurm.schedmd.com/documentation.html|documentation]] for SLURM, including various [[https://slurm.schedmd.com/tutorials.html|tutorials]] is available on the Schedmd.com website.