# SLURM Generic Resource (GRES) Plugin API

## Overview

This document describes SLURM generic resource plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own SLURM job submit plugins. This is version 100 of the API.

SLURM generic resource plugins must conform to the SLURM Plugin API with the following specifications:

const char gres_name[]="gres_name"

The gres_name should matc minor in plugin_version described below.

const char plugin_name[]="full text name"

A free-formatted ASCII text string that identifies the plugin.

const char plugin_type[]="major/minor"

The major type must be "gres." The minor type can be any suitable name for the type of accounting package.

const uint32_t plugin_version="version_number"

The version number should be 100.

We include samples in the SLURM distribution for

- gpu—Manage GPUs (Graphics Processing Units).
- nic—Manage NICs (Network Interface Cards, this plugin does nothing today).

## API Functions

All of the following functions are required. Functions which are not implemented must be stubbed.

int node_config_load(List gres_conf_list)

Description:
This function is called by the slurmd daemon after the slurm.conf and gres.conf files have been read. It can be used to validate the configuration by testing the actual hardware resources available or just confirm that an entry for the resource was included in the gres.conf file.

Arguments:
gres_conf_list (input/output) a list of configuration records generated by reading the slurm.conf and gres.conf files

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void job_set_env(char ***job_env_ptr, void *gres_ptr)

Description:
This function is called by the slurmd daemon after the getting a job credential and can be used to set environment variables for the job based upon GRES state information in that credential.

Arguments:
job_env_ptr (input/output) pointer to the job's environment variable structure.
gres_ptr (input) pointer to the job's GRES allocation information.

void step_set_env(char ***job_env_ptr, void *gres_ptr)

Description:
This function is called by the slurmd daemon after the getting a job step credential and can be used to set environment variables for the job step based upon GRES state information in that credential.

Arguments:
job_env_ptr (input/output) pointer to the job step's environment variable structure.
gres_ptr (input) pointer to the step's GRES allocation information.

## Versioning

This document describes version 100 of the SLURM Generic Resource API. Future releases of SLURM may revise this API.

Last modified 27 August 2010