# Generic Resource (Gres) Scheduling

Beginning in SLURM version 2.2 generic resource (Gres) scheduling is supported through a flexible plugin mechanism. Support is initially provided for Graphics Processing Units (GPUs), although support for any resources is possible though use of a customized plugin.

## Configuration

SLURM supports no generic resourses in the default configuration. One must explicitly specify which resources are to be managed in the slurm.conf configuration file. The configuration parameters of interest are:

- GresPlugins a comma delimited list of generic resource plugins to be used (e.g. GresPlugins=gpus,nic).
- Gres the specific generic resource and their count associated with each node (e.g. NodeName=linux[0-999] Gres=gpu:8,nic:2).

Note that the Gres specification for each node works in the same fashion as the other resources managed. Depending upon the value of the FastSchedule parameter, nodes which are found to have fewer resources than configured will be placed in a DOWN state.

Note that the Gres specification is not supported on BlueGene systems.

## Running Jobs

Jobs will not be allocated any generic resources unless specifically requested at job submit time using the --gres option supported by the salloc, sbatch and srun commands. The option requires an argument specifying which generic resources are required and how many resources. The resource specification is of the form name[:count[*cpu]]. The name is the same name as specified by the GresPlugins and Gres configuration parameters. count specifies how many resources are required and has a default value of 1. *cpu indicates that the resource count specified is per allocated CPU, otherwise the count is per allocated node. For example: sbatch --gres=gpu:2*cpu,nic:1 ....

Jobs will be allocated specific generic resources as needed to satisfy the request. If the job is suspended, those resources typically become available for use by other jobs (plugin dependent).

Job steps can be allocated generic resources from those allocated to the job using the --gres option with the srun command as described above. By default a job step will have access to all generic resources allocated to the job, but lower values may be specified if running more than one job step concurrently. The job step will be allocated specific generic resources and those resources will not be available to other job steps. A simple example is shown below.

    #!/bin/bash
    #
    # gres_test.bash
    # Submit as follows: sbatch --gres=gpu:2 -n4 -N1-1 gres_test.bash
    #
    srun --gres=gpu:1 -n2 --exclusive job_1 &
    srun --gres=gpu:1 -n2 --exclusive job_2 &
    wait

Last modified 26 May 2010