perun.backend

Backend module.

Submodules

Attributes

Classes

Backend

Abstract backend class.

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.

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.

abstractmethod setup() None[source]

Perform backend setup.

class perun.backend.NVMLBackend[source]

Bases: perun.backend.backend.Backend

NVMLSource class.

Setups connection to NVML and creates relevant devices

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

Init pynvml and gather number of devices.

close() None[source]

Backend shutdown code.

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.

close() None[source]

Backend shutdown code (does nothing for intel rapl).

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.

close() None[source]

Close backend.

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.

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.

close() None[source]

Backend cleanup.

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]]