Slurm Generic Resource (GRES) Plugin API

Overview

This document describes Slurm generic resource (GRES) plugins and the API that defines them.
このドキュメントでは、Slurm汎用リソース(GRES)プラグインとそれらを定義するAPIについて説明します。
It is intended as a resource to programmers wishing to write their own Slurm GRES plugins.
これは、独自のSlurmGRESプラグインを作成したいプログラマー向けのリソースとして意図されています。

Slurm GRES plugins must conform to the Slurm Plugin API with the following specifications:
Slurm GRESプラグインは、次の仕様のSlurmプラグインAPIに準拠している必要があります。

const char *plugin_type="major/minor"

major must be gres.
メジャーはグレスでなければなりません。
minor can be any suitable name representing the GRES type of the plugin.
minorは、プラグインのGRESタイプを表す任意の適切な名前にすることができます。

const char *plugin_name

Some descriptive name for the plugin.
プラグインのわかりやすい名前。
There is no requirement with respect to its format.
そのフォーマットに関する要件はありません。

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.
指定されている場合、このプラグインのビルドに使用されたSlurmのバージョンを識別し、異なるバージョンのSlurmからプラグインをロードしようとするとエラーが発生します。
If not specified, then the plugin may be loaded 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コマンドおよびデーモンによってロードされる可能性があります。ただし、これにより、プラグイン関数への引数の変更またはプラグインによって使用される他のSlurm関数の変更により、障害の診断が困難になる場合があります。

We include samples in the Slurm distribution for:
Slurmディストリビューションには次のサンプルが含まれています。

  • gpu — Manage GPUs (Graphics Processing Units).
    gpu — GPU(グラフィックスプロセッシングユニット)を管理します。
  • mps — Manage MPS (CUDA Multi-Process Service).
    mps — MPS(CUDAマルチプロセスサービス)を管理します。

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.
ここにグローバル初期化を配置します。

Arguments: None.

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.
ここで割り当てられたストレージをすべてクリアします。

Arguments: None.

Returns: None.

Note: init() and fini() are not the same as those described in the dlopen(3) system library.
注:init()およびfini()は、dlopen(3)システムライブラリで説明されているものと同じではありません。
The C run-time system co-opts those symbols for its own initialization.
Cランタイムシステムは、独自の初期化のためにこれらのシンボルを採用します。
The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().
システム_init()はSlurm init()の前に呼び出され、Slurm fini()はシステムの_fini()の前に呼び出されます。

int node_config_load(List gres_conf_list, node_config_load_t *config)

Description:
This function is called by the slurmd daemon after the slurm.conf and gres.conf files have been read.
この関数は、slurm.confファイルとgres.confファイルが読み取られた後にslurmdデーモンによって呼び出されます。
It can be used to validate or infer the system configuration by testing the actual hardware resources available or just confirm that an entry for the resource was included in the gres.conf file.
使用可能な実際のハードウェアリソースをテストすることでシステム構成を検証または推測したり、リソースのエントリがgres.confファイルに含まれていることを確認したりするために使用できます。

Arguments:
gres_conf_list (input/output) a list of configuration records generated by reading the slurm.conf and gres.conf files
config (input) Additional data.
gres_conf_list(入力/出力)slurm.confおよびgres.confファイルを読み取ることによって生成された構成レコードのリストconfig(入力)追加データ。
Contains fields cpu_cnt and xcpuinfo_mac_to_abs.
フィールドcpu_cntおよびxcpuinfo_mac_to_absが含まれます。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

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

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.
この関数は、ジョブ資格情報を取得した後にslurmdデーモンによって呼び出され、その資格情報のGRES状態情報に基づいてジョブの環境変数を設定するために使用できます。

Arguments:
job_env_ptr (input/output) pointer to the job's environment variable structure.
job_env_ptr(入力/出力)ジョブの環境変数構造へのポインター。

gres_ptr (input) pointer to the job's GRES allocation information.
gres_ptr(入力)ジョブのGRES割り当て情報へのポインター。

node_inx (input) zero origin node index, used to interpret node-specific GRES data.
node_inx(入力)ゼロオリジンノードインデックス。ノード固有のGRESデータを解釈するために使用されます。

Returns: None.

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.
この関数は、ジョブステップの資格情報を取得した後にslurmdデーモンによって呼び出され、その資格情報のGRES状態情報に基づいてジョブステップの環境変数を設定するために使用できます。

Arguments:
job_env_ptr (input/output) pointer to the job step's environment variable structure.
job_env_ptr(入力/出力)ジョブステップの環境変数構造へのポインター。

gres_ptr (input) pointer to the step's GRES allocation information.
ステップのGRES割り当て情報へのgres_ptr(入力)ポインター。

Returns: None.

void send_stepd(int fd)

Description:
This function is called by the slurmd daemon to send any needed information to the slurmstepd step shepherd.
この関数はslurmdデーモンによって呼び出され、必要な情報をslurmstepdステップシェパードに送信します。

Arguments:
fd (input) file descriptor to write information to.
情報を書き込むfd(入力)ファイル記述子。

Returns: None.

void recv_stepd(int fd)

Description:
This function is called by the slurmstepd step shepherd to read any needed information from the slurmd daemon.
この関数は、slurmstepdステップシェパードによって呼び出され、slurmdデーモンから必要な情報を読み取ります。

Arguments:
fd (input) file descriptor to read information from.
情報を読み取るfd(入力)ファイル記述子。

Returns: None.

int job_info(gres_job_state_t *job_gres_data, uint32_t node_inx, enum gres_job_data_type data_type, void *data)

Description:
This function is used to extract plugin-specific data from the job's GRES data structure.
この関数は、ジョブのGRESデータ構造からプラグイン固有のデータを抽出するために使用されます。
Note that enum gres_job_data_type values GRES_JOB_DATA_COUNT and GRES_JOB_DATA_BITMAP are processed in common code rather than within the plugin and return data types of uint32_t* and bitstr_t**, respectively.
列挙型gres_job_data_type値GRES_JOB_DATA_COUNTおよびGRES_JOB_DATA_BITMAPは、プラグイン内ではなく共通コードで処理され、それぞれuint32_t *およびbitstr_t **のデータ型を返すことに注意してください。

Arguments:
job_gres_data (input) Information about the job's GRES resources.
job_gres_data(入力)ジョブのGRESリソースに関する情報。

node_inx (input) Zero origin index within the job's resource allocation for which data is desired.
node_inx(入力)データが必要なジョブのリソース割り当て内のゼロオリジンインデックス。

data_type (input) Type of information to be gathered from the data structure.
data_type(入力)データ構造から収集される情報のタイプ。

data (output) Pointer to data within job_gres_data.
data(出力)job_gres_data内のデータへのポインター。
No data is copied or needs to be freed.
データがコピーされたり、解放されたりする必要はありません。
Data type depends upon the value of data_type.
データ型はdata_typeの値によって異なります。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

int step_info(gres_step_state_t *step_gres_data, uint32_t node_inx, enum gres_step_data_type data_type, void *data)

Description:
This function is used to extract plugin-specific data from the step's GRES data structure.
この関数は、ステップのGRESデータ構造からプラグイン固有のデータを抽出するために使用されます。
Note that enum gres_job_data_type values GRES_JOB_DATA_COUNT and GRES_JOB_DATA_BITMAP are processed in common code rather than within the plugin and return data types of uint32_t* and bitstr_t**, respectively.
列挙型gres_job_data_type値GRES_JOB_DATA_COUNTおよびGRES_JOB_DATA_BITMAPは、プラグイン内ではなく共通コードで処理され、それぞれuint32_t *およびbitstr_t **のデータ型を返すことに注意してください。

Arguments:
step_gres_data (input) Information about the step's GRES resources.
step_gres_data(入力)ステップのGRESリソースに関する情報。

node_inx (input) Zero origin index within the job's resource allocation for which data is desired.
node_inx(入力)データが必要なジョブのリソース割り当て内のゼロオリジンインデックス。

data_type (input) Type of information to be gathered from the data structure.
data_type(入力)データ構造から収集される情報のタイプ。

data (output) Pointer to data within step_gres_data.
data(出力)step_gres_data内のデータへのポインター。
No data is copied or needs to be freed.
データがコピーされたり、解放されたりする必要はありません。
Data type depends upon the value of data_type.
データ型はdata_typeの値によって異なります。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

List get_devices(void)

Description:
This function returns the list of GRES devices.
この関数は、GRESデバイスのリストを返します。

Arguments: None.

Returns:
Returns a List of GRES device records of type gres_slurmd_conf_t.
タイプgres_slurmd_conf_tのGRESデバイスレコードのリストを返します。

void step_hardware_init(bitstr_t *usable_gres, char *settings)

Description:
Configure device hardware corresponding to all the GRES devices of the plugin type.
プラグインタイプのすべてのGRESデバイスに対応するデバイスハードウェアを構成します。
The slurmstepd calls this function while privileged and before tasks are forked and executed.
slurmstepdは、特権が与えられている間、およびタスクがフォークされて実行される前に、この関数を呼び出します。
The gres/gpu plugin sets GPU frequencies here.
gres / gpuプラグインはここでGPU周波数を設定します。

Arguments:
usable_gres (input) A bit string specifying all GRES devices of the plugin type allocated to the step.
used_gres(入力)ステップに割り当てられたプラグインタイプのすべてのGRESデバイスを指定するビット文字列。

settings (input) A string containing device hardware settings to be set for all specified hardware devices.
settings(入力)指定されたすべてのハードウェアデバイスに設定されるデバイスハードウェア設定を含む文字列。

Returns: None.

void step_hardware_fini(void)

Description:
Do hardware configuration after the step is finished while privileged.
ステップが終了した後、特権を設定してハードウェア構成を行います。
This is meant to allow Slurm to undo hardware configuration changes performed by step_hardware_init().
これは、Slurmがstep_hardware_init()によって実行されたハードウェア構成の変更を元に戻すことができるようにすることを目的としています。
The slurmstepd calls this function while privileged and after tasks complete.
slurmstepdは、特権が与えられている間、およびタスクが完了した後にこの関数を呼び出します。
The gres/gpu plugin resets GPU frequencies to high here.
gres / gpuプラグインは、ここでGPU周波数を高くリセットします。

Arguments: None.

Returns: None.

gres_epilog_info_t *epilog_build_env(gres_job_state_t *gres_job_ptr)

Description:
Given a job's GRES allocation data, translated that to the data required by epilog_set_env() to set environment variables for the Prolog and Epilog programs.
ジョブのGRES割り当てデータを前提として、それをepilog_set_env()がPrologおよびEpilogプログラムの環境変数を設定するために必要なデータに変換しました。

Arguments:
gres_job_ptr (input) job's GRES allocation data.
gres_job_ptr(入力)ジョブのGRES割り当てデータ。

Returns: Data structure containing the information required by epilog_set_env() to set environment variables for the Prolog and Epilog programs.
戻り値:PrologおよびEpilogプログラムの環境変数を設定するためにepilog_set_env()に必要な情報を含むデータ構造。

void epilog_set_env(char ***epilog_env_ptr, gres_epilog_info_t *epilog_info, int node_inx)

Description:
Set GRES specific environment variables for the Prolog and Epilog programs.
PrologおよびEpilogプログラムのGRES固有の環境変数を設定します。

Arguments:
epilog_env_ptr (input) environment variables set for the Prolog and Epilog programs.
PrologおよびEpilogプログラムに設定されたepilog_env_ptr(入力)環境変数。
This array may be reallocated as needed to contain additional environment variables.
この配列は、追加の環境変数を含めるために必要に応じて再割り当てできます。

epilog_info (input) GRES specific job allocation information.
epilog_info(入力)GRES固有のジョブ割り当て情報。
Built by epilog_build_env().
epilog_build_env()によって構築されます。

node_inx (input) zero-origin index of this node in the job's allocation.
node_inx(入力)ジョブの割り当てにおけるこのノードのゼロオリジンインデックス。
Needed to identify the resources on a specific node allocated to this job.
このジョブに割り当てられた特定のノード上のリソースを識別する必要があります。

Returns: None.

Last modified 5 March 2019