Slurm

From UABgrid Documentation
Revision as of 09:00, 1 September 2016 by Puri@uab.edu (Talk | contribs)

Jump to: navigation, search

SLURM is a queue management system and stands for Simple Linux Utility for Resource Management. SLURM was developed at the Lawrence Livermore National Lab and currently runs some of the largest compute clusters in the world. SLURM is now the primary job manager on Cheaha, it replaces SUN Grid Engine (SGE) the job manager used earlier.

SLURM is similar in many ways to GridEngine or most other queue systems. You write a batch script then submit it to the queue manager (scheduler). The queue manager then schedules your job to run on the queue (or partition in SLURM parlance) that you designate. Below we will provide an outline of how to submit jobs to SLURM, how SLURM decides when to schedule your job, and how to monitor progress.


Contents

General SLURM Documentation

The primary source for documentation on SLURM usage and commands can be found at the SLURM site. If you Google for SLURM questions, you'll often see the Lawrence Livermore pages as the top hits, but these tend to be outdated.

A great way to get details on the SLURM commands is the man pages available from the Cheaha cluster. For example, if you type the following command:

man sbatch

you'll get the manual page for the sbatch command.

Logging on and Running Jobs from the command line

Once you've gone through the account setup procedure and obtained a suitable terminal application, you can login to the Cheaha system via ssh

 ssh blazerid@cheaha.rc.uab.edu

Existing users, follow these instructions to add SSH keys for the new system

Cheaha (new hardware) run the CentOS 7 version of the Linux operating system and commands are run under the "bash" shell (the default shell). There are a number of Linux and bash references, cheat sheets and tutorials available on the web.

Typical Workflow

  • Stage data to $USER_SCRATCH (your scratch directory)
  • Determine how to run your code in "batch" mode. Batch mode typically means the ability to run it from the command line without requiring any interaction from the user.
  • Identify the appropriate resources needed to run the job. The following are mandatory resource requests for all jobs on Cheaha:
    • Number of processor cores required by the job
    • Maximum memory (RAM) required per core
    • Maximum runtime
  • Write a job script specifying queuing system parameters, resource requests, and commands to run program
  • Submit script to queuing system (sbatch script.job)
  • Monitor job (squeue)
  • Review the results and resubmit as necessary
  • Clean up the scratch directory by moving or deleting the data off of the cluster

Batch Job

TODO: provide an explanation of what makes a batch job and why use that vs an interactive job

For additional information on the sbatch command execute man sbatch at the command line to view the manual.

Example Batch Job Script

A job consists of resource requests and tasks. The Slurm job scheduler interprets lines beginning with #SBATCH as Slurm arguments. In this example, the job is requesting to run 1 task

#!/bin/bash
#
#SBATCH --job-name=test
#SBATCH --output=res.txt
#SBATCH --ntasks=1
#SBATCH --time=10:00
#SBATCH --mem-per-cpu=100
#SBATCH --partition=short
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=$USER@uab.edu

srun hostname
srun sleep 60

Interactive Session

Login Node (The command-line interface after you login to Cheaha ) is supposed to be used for submitting jobs and/or lighter prep work required for the job scripts. You are not supposed to run heavy computations on the login node. If you have a heavier workload to prepare for a batch job (eg. compiling code or other manipulations of data) or your compute application requires interactive control, you should request a dedicated interactive node for this work.

Interactive resources are requested by submitting an "interactive" job to the scheduler. Interactive jobs will provide you a command line on a compute resource that you can use just like you would the command line on the login node. The difference is that the scheduler has dedicated the requested resources to your job and you can run your interactive commands without having to worry about impacting other users on the login node.

Interactive jobs, that can be run on command line, are requested with the srun command.

srun --ntasks=4 --mem=4096 --time=08:00:00 --partition=medium --job-name=JOB_NAME --pty /bin/bash

This command requests for 4 core (-n) with each having size 4GB for 8 hrs (-t).

More advanced interactive scenarios to support graphical applications are available using VNC or X11 tunneling X-Win32 2014 for Windows

Interactive jobs that requires running a graphical application, are requested with the sinteractive command, via Terminal on your VNC window.

sinteractive --ntasks=4 --mem=4096 --time=08:00:00 --partition=medium --job-name=JOB_NAME 

Job Status

To check your job status, you can use the following command

squeue -u BLAZERID

Following fields are displayed when you run squeue

JOBID - ID assigned to your job by SLURM scheduler
PARTITION - Partition your job gets, depends upon time requested (express(max 2 hrs), short(max 12 hrs), medium(max 50 hrs), long(max 150 hrs), sinteractive(0-2 hrs))
NAME - JOB name given by user
USER - User who started the job
ST - State your job is in. The typical states are PENDING (PD), RUNNING(R), SUSPENDED(S), COMPLETING(CG), and COMPLETED(CD)
TIME - Time for which your job has been running
NODES - Number of nodes your job is running on
NODELIST - Node on which the job is running

For more details on squeue, go here.

Updates

20160311 partitions & graphical interactive

Howdy, the new changes are in place. The primary focus of the changes were to:

  1. Change the scheduling algorithm to one that allows jobs to share compute nodes (i.e. Slurm will allocate CPU cores now instead of complete compute nodes).
  2. We added partitions (in SGE they were called queues) with the following characteristics (these may change over time as we tweak things):
    • express (default partition): Priority 2 :: Max Runtime 2 hours
    • short: Priority 2 :: Max Runtime 12 hours
    • medium: Priority 4 :: Max Runtime 50 hours
    • long: Priority 6 :: Max Runtime 159 hours (6 days 6 hours)
    • interactive: Priority 10 :: Max Runtime 2 hours
  3. In order to run a job in a partition other than "express" you'll need to specifically request it using the --partition argument (--time=48:00:00 --partition=medium)
  4. Graphical interactive jobs now work. You can run an interactive job using the sinteractive command, for example:
sinteractive --time=00:05:00 --job-name=sinteractiveTest --ntasks=1 --mem=1024 

More to come and please let us know of any issues or concerns.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
{"cc_re__cc_re__cc_by_sa_3_0": ["\"/w/index.php?title=Slurm&amp;oldid=5224&amp;printable=yes\" rel=\"alternate\">Printable version</a></li>\n\t\t\t<li id=\"t-permalink\"><a href=\"/w/index.php?title=Slurm&amp;oldid=5224\" title=\"Permanent link to this revision of the page\">Permanent link</a></li>\n\t\t</ul>\n\t</div>\n</div>\n\n<!-- /TOOLBOX -->\n\n<!-- LANGUAGES -->\n\n<!-- /LANGUAGES -->\n\t\t\t</div>\n\t\t<!-- /panel -->\n\t\t<!-- footer -->\n\t\t<div id=\"footer\">\n\t\t\t\t\t\t\t<ul id=\"footer-info\">\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-info-copyright\">Content is available under <a class=\"external\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">Creative Commons Attribution Share Alike</a>.</li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<ul id=\"footer-places\">\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-privacy\"><a href=\"/wiki/UABgrid_Documentation:Privacy_policy\" title=\"UABgrid Documentation:Privacy policy\">Privacy policy</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-about\"><a href=\"/wiki/UABgrid_Documentation:About\" title=\"UABgrid Documentation:About\">About UABgrid Documentation</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-disclaimer\"><a href=\"/wiki/UABgrid_Documentation:", "le=\"UABgrid Documentation:Privacy policy\">Privacy policy</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-about\"><a href=\"/wiki/UABgrid_Documentation:About\" title=\"UABgrid Documentation:About\">About UABgrid Documentation</a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li id=\"footer-places-disclaimer\"><a href=\"/wiki/UABgrid_Documentation:General_disclaimer\" title=\"UABgrid Documentation:General disclaimer\">Disclaimers</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t\t<ul id=\"footer-icons\" class=\"noprint\">\n\t\t\t\t\t<li id=\"footer-copyrightico\">\n\t\t\t\t\t\t<a href=\"http://creativecommons.org/licenses/by-sa/3.0/\"><img src=\"/w/skins/common/images/cc-by-sa.png\" alt=\"Creative Commons Attribution Share Alike\" width=\"88\" height=\"31\" /></a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li id=\"footer-poweredbyico\">\n\t\t\t\t\t\t<a href=\"//www.mediawiki.org/\"><img src=\"/w/skins/common/images/poweredby_mediawiki_88x31.png\" alt=\"Powered by MediaWiki\" width=\"88\" height=\"31\" /></a>\n\t\t\t\t\t\t<a href=\"http://dev.uabgrid.uab.edu\"><img src=\"/w/skins/uabvector/powered-by-uabgrid.png\" alt=\"Powered by UABgrid\" height=\"31\" width=\"88\" /></a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n"], "copyright__copyright__copyright": ["", "ours\n  3. In order to run a job in a partition other than \"express\" you'll need to specifically request it using the --partition argument (--time=48:00:00 --partition=medium)\n  4. Graphical interactive jobs now work. You can run an interactive job using the sinteractive command, for example:\nsinteractive --time=00:05:00 --job-name=sinteractiveTest --ntasks=1 --mem=1024 \n\nMore to come and please let us know of any issues or concerns.\n\nPersonal tools\nNamespaces\n\nVariants\nActions\nNavigation\nToolbox", "ours\n  3. In order to run a job in a partition other than \"express\" you'll need to specifically request it using the --partition argument (--time=48:00:00 --partition=medium)\n  4. Graphical interactive jobs now work. You can run an interactive job using the sinteractive command, for example:\nsinteractive --time=00:05:00 --job-name=sinteractiveTest --ntasks=1 --mem=1024 \n\nMore to come and please let us know of any issues or concerns.\n\nPersonal tools\nNamespaces\n\nVariants\nActions\nNavigation\nToolbox"]}