perun.backend

Backend module.

Submodules

Attributes

Classes

Backend

Abstract backend class.

HWMonGraceBackend

Hardware Monitoring (hwmon) backend for reading system sensors.

NVMLBackend

NVMLSource class.

PowercapRAPLBackend

Powercap RAPL as a source of cpu and memory devices.

PSUTILBackend

PSUTIL Backend class.

ROCMBackend

ROCMBackend.

Package Contents

class perun.backend.Backend[source]

Abstract backend class.

id: str = 'abstract_backend'
name: str = 'Abstract backend class'
description: str = 'Abstract backend class description'
devices: dict
property metadata: dict

Return backend metadata.

Return type:

dict

abstractmethod availableSensors() → dict[str, tuple][source]

Return a dictionary with all available sensors. Each entry contains the backend id and type of sensor.

Returns:

Dictionary with device ids and measurement unit.

Return type:

dict[tuple[str]]

abstractmethod getSensors(deviceList: set[str]) → list[perun.data_model.sensor.Sensor][source]

Return device objects based on the provided list of device ids.

Parameters:

deviceList (set[str]) – List with wanted device ids

Returns:

List of device objects

Return type:

list[Sensor]

abstractmethod close() → None[source]

Clean up and close backend related activities.

Return type:

None

abstractmethod setup() → None[source]

Perform backend setup.

Return type:

None

class perun.backend.HWMonGraceBackend[source]

Bases: perun.backend.backend.Backend

Hardware Monitoring (hwmon) backend for reading system sensors.

Uses the Linux hwmon sysfs interface to gather power measurements from device subdirectories.

Docs: https://docs.nvidia.com/dccpu/grace-perf-tuning-guide/power-thermals.html

id = 'hwmon-grace'
name = 'Hardware Monitor (Grace)'
description = 'Reads power measurements from hwmon sysfs device subdirectories for Grace systems.'
setup() → None[source]

Initialize hwmon backend and discover available sensors.

Return type:

None

close() → None[source]

Backend shutdown code, closes all open sensor files.

Return type:

None

availableSensors() → dict[str, tuple[str, perun.data_model.sensor.DeviceType, perun.data_model.measurement_type.Unit]][source]

Return string id set of visible devices.

Returns:

Set with visible device ids.

Return type:

set[str]

getSensors(deviceList: set[str]) → list[perun.data_model.sensor.Sensor][source]

Gather device objects based on a set of device ids.

Parameters:

deviceList (set[str]) – Set of device ids.

Returns:

Device objects.

Return type:

list[Sensor]

class perun.backend.NVMLBackend[source]

Bases: perun.backend.backend.Backend

NVMLSource class.

Setups connection to NVML and creates relevant devices

id = 'nvml'
name = 'NVIDIA ML'
description: str = 'Access GPU information from NVML python bindings'
setup() → None[source]

Init pynvml and gather number of devices.

Return type:

None

close() → None[source]

Backend shutdown code.

Return type:

None

availableSensors() → dict[str, tuple][source]

Return a dictionary with all available sensors.

Each entry contains the backend id and type of sensor.

Returns:

Dictionary with device ids and measurement unit.

Return type:

dict[str, tuple]

getSensors(deviceList: set[str]) → list[perun.data_model.sensor.Sensor][source]

Gather sensor object based on a set of device ids.

Parameters:

deviceList (set[str]) – Set containing divice ids.

Returns:

List with Sensor objects.

Return type:

list[Sensor]

class perun.backend.PowercapRAPLBackend[source]

Bases: perun.backend.backend.Backend

Powercap RAPL as a source of cpu and memory devices.

Uses the powercap filesystem files to gather device information and creates metrics for each available device

id = 'powercap_rapl'
name = 'Powercap RAPL'
description = 'Reads energy usage from CPUs and DRAM using Powercap RAPL'
setup() → None[source]

Check Intel RAPL access.

Return type:

None

close() → None[source]

Backend shutdown code (does nothing for intel rapl).

Return type:

None

availableSensors() → dict[str, tuple][source]

Return string id set of visible devices.

Returns:

Set with visible device ids.

Return type:

set[str]

getSensors(deviceList: set[str]) → list[perun.data_model.sensor.Sensor][source]

Gather device objects based on a set of device ids.

Parameters:

deviceList (set[str]) – Set of device ids.

Returns:

Device objects.

Return type:

list[Sensor]

class perun.backend.PSUTILBackend[source]

Bases: perun.backend.backend.Backend

PSUTIL Backend class.

id: str = 'psutil'
name: str = 'PSUTIL'
description: str = 'Obtain hardware data from psutil'
setup() → None[source]

Configure psutil backend.

Return type:

None

close() → None[source]

Close backend.

Return type:

None

availableSensors() → Dict[str, Tuple][source]

Return a dictionary with all available sensors.

Returns:

Dictionary with device ids and measurement unit.

Return type:

Dict[str, Tuple]

getSensors(deviceList: Set[str]) → List[perun.data_model.sensor.Sensor][source]

Return desired device objects.

Parameters:

deviceList (Set[str])

Return type:

List[perun.data_model.sensor.Sensor]

class perun.backend.ROCMBackend[source]

Bases: perun.backend.backend.Backend

ROCMBackend.

Initialises sensors to get data from AMD GPUs.

id = 'amdsmi'
name = 'AMD ROCM'
description: str = 'Access GPU information from amd-smi python bindings.'
setup() → None[source]

Init rocm object.

Return type:

None

close() → None[source]

Backend cleanup.

Return type:

None

availableSensors() → dict[str, tuple][source]

Return a dictionary with all available sensors.

Each entry contains the backend id and type of sensor.

Returns:

Dictionary with device ids and measurement unit.

Return type:

dict[str, tuple]

getSensors(deviceList: set[str]) → list[perun.data_model.sensor.Sensor][source]

Gather sensor object based on a set of device ids.

Parameters:

deviceList (set[str]) – Set containing divice ids.

Returns:

List with Sensor objects.

Return type:

list[Sensor]

perun.backend.available_backends: dict[str, Type[backend.Backend]]