Device API

Abstract Class

class pyJoules.device.Domain

Identify a domain, a monitorable sub-part of a device

class pyJoules.device.Device

Interface to get energy consumption information about a specific device

static available_domains()

Returns names of the domain that could be monitored on the Device :rtype: List[Domain] :return: a list of domain names :raise NoSuchDeviceError: if the device is not available on this machine

configure(domains=None)

configure the device to return only the energy consumption of the given energy domain when calling the pyJoules.device.Device.get_energy() method

Parameters

domains (Optional[List[Domain]]) – domains to be monitored by the device, if None, all the available domain will be monitored

Raises

NoSuchDomainError – if one given domain could not be monitored on this machine

get_configured_domains()

Get the domains that was passed as argument to the configure function

Returns

A list of Domain

Raises

NotConfiguredDeviceException – if the device was not configured

get_energy()

Get the energy consumption of the device since the last device reset

Return type

List[float]

Returns

a list of each domain power consumption. Value order is the same than the domain order passed as argument to the pyJoules.device.Device.configure() method.

RAPL Device Classes

class pyJoules.device.rapl_device.RaplDevice

Interface to get energy consumption of CPU domains

static available_core_domains()

return a the list of the available energy Core domains

Return type

List[RaplCoreDomain]

static available_domains()

return a the list of the available energy domains

Return type

List[RaplDomain]

static available_dram_domains()

return a the list of the available energy Dram domains

Return type

List[RaplDramDomain]

static available_package_domains()

return a the list of the available energy Package domains

Return type

List[RaplPackageDomain]

static available_uncore_domains()

return a the list of the available energy Uncore domains

Return type

List[RaplUncoreDomain]

configure(domains=None)

configure the device to return only the energy consumption of the given energy domain when calling the pyJoules.device.Device.get_energy() method

Parameters

domains – domains to be monitored by the device, if None, all the available domain will be monitored

Raises

NoSuchDomainError – if one given domain could not be monitored on this machine

get_energy()

Get the energy consumption of the device since the last device reset

Returns

a list of each domain power consumption. Value order is the same than the domain order passed as argument to the pyJoules.device.Device.configure() method.

class pyJoules.device.rapl_device.RaplDomain(socket)
get_domain_name()
Return type

str

Returns

domain name without socket identifier

class pyJoules.device.rapl_device.RaplCoreDomain(socket)
get_domain_name()
Returns

domain name without socket identifier

class pyJoules.device.rapl_device.RaplUncoreDomain(socket)
get_domain_name()
Returns

domain name without socket identifier

class pyJoules.device.rapl_device.RaplDramDomain(socket)
get_domain_name()
Returns

domain name without socket identifier

class pyJoules.device.rapl_device.RaplPackageDomain(socket)
get_domain_name()
Returns

domain name without socket identifier

Nvidia GPU Device Classes

class pyJoules.device.nvidia_device.NvidiaGPUDevice

Interface to get energy consumption of GPUs

static available_domains()

Returns names of the domain that could be monitored on the Device :rtype: List[NvidiaGPUDomain] :return: a list of domain names :raise NoSuchDeviceError: if the device is not available on this machine

configure(domains=None)

configure the device to return only the energy consumption of the given energy domain when calling the pyJoules.device.Device.get_energy() method

Parameters

domains (Optional[List[NvidiaGPUDomain]]) – domains to be monitored by the device, if None, all the available domain will be monitored

Raises

NoSuchDomainError – if one given domain could not be monitored on this machine

get_energy()

Get the energy consumption of the device since the last device reset

Returns

a list of each domain power consumption. Value order is the same than the domain order passed as argument to the pyJoules.device.Device.configure() method.

class pyJoules.device.nvidia_device.NvidiaGPUDomain(device_id)

Exception

exception pyJoules.device.NotConfiguredDeviceException

Exception raised when a user call a device method that need the device to be configured on a non configured device