# Power Management Plugin Programmer Guide

## Overview

This document describes the Slurm power management plugins and the APIs that defines them. It is intended as a resource to programmers wishing to write their own Slurm power management plugin. This is version 100 of the API.

Slurm power management plugins must conform to the Slurm Plugin API with the following specifications:

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 "power". The minor type can be any suitable name for the type of power management package. The following power management plugins are included in the Slurm distribution

- cray — Use Cray APIs to provide power management.
- none — Can be configured to log calls to its functions, but otherwise does nothing.

const uint32_t plugin_version
If specified, identifies the version of Slurm used to build this plugin and any attempt to load the plugin from a different version of Slurm will result in an error. If not specified, then the plugin may be loadeed by Slurm commands and daemons from any version, however this may result in difficult to diagnose failures due to changes in the arguments to plugin functions or changes in other Slurm functions used by the plugin.

Slurm can be configured to use multiple power management plugins if desired.

## API Functions

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

int init (void)

Description:
Called when the plugin is loaded, before any other functions are called. Put global initialization here.

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void fini (void)

Description:
Called when the plugin is removed. Clear any allocated storage here.

Returns: None.

Note: These init and fini functions are not the same as those described in the dlopen (3) system library. The C run-time system co-opts those symbols for its own initialization. The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().

void power_p_reconfig(void)

Description:
This function is called when updated configuration information should be read.

void power_p_job_resume(struct job_record *job_ptr)

Description:
Note that a previously suspended job is being resumed. Called by the slurmctld daemon.

Arguments:
job_ptr (input) pointer to the job record being resumed.

void power_p_job_start(struct job_record *job_ptr)

Description:
Note that a job has been allocated resources and is about to begin execution. Called by the slurmctld daemon.

Arguments:
job_ptr (input) pointer to the job record being started.

Last modified 27 March 2015