CPUStats

class lib.gpu_stats.cpu.CPUStats(log: bool = True)

Bases: _GPUStats

Holds information and statistics about the CPU on the currently running system.

Notes

The information held here is not useful, but _GPUStats is dynamically imported depending on the backend used, so we need to make sure this class is available for Faceswap run on the CPU Backend.

The base _GPUStats handles the dummying in of information when no GPU is detected.

Parameters:

log (bool) – Whether the class should output information to the logger. There may be occasions where the logger has not yet been set up when this class is queried. Attempting to log in these instances will raise an error. If GPU stats are being queried prior to the logger being available then this parameter should be set to False. Otherwise set to True. Default: True

Attributes Summary

cli_devices

name text string for each GPU

device_count

The number of GPU devices discovered on the system.

exclude_all_devices

True if all GPU devices have been explicitly disabled otherwise False

sys_info

The GPU Stats that are required for system information logging

Methods Summary

exclude_devices(devices)

CPU does not support excluding devices

get_card_most_free()

Obtain statistics for the GPU with the most available free VRAM.

Attributes Documentation

cli_devices

name text string for each GPU

Type:

Formatted index

device_count

The number of GPU devices discovered on the system.

exclude_all_devices

True if all GPU devices have been explicitly disabled otherwise False

sys_info

The GPU Stats that are required for system information logging

Methods Documentation

exclude_devices(devices: list[int]) None

CPU does not support excluding devices

Parameters:
  • excluded (The GPU device IDS to be)

  • devices (list[int])

Return type:

None

get_card_most_free() BiggestGPUInfo

Obtain statistics for the GPU with the most available free VRAM.

Returns:

  • If a GPU is not detected then the card_id is returned as -1 and the amount

  • of free and total RAM available is fixed to 2048 Megabytes.

Return type:

BiggestGPUInfo

exclude_devices(devices: list[int]) None

CPU does not support excluding devices

Parameters:
  • excluded (The GPU device IDS to be)

  • devices (list[int])

Return type:

None