Collects and returns Information on available GPUs.
The information returned from this module provides information for both Nvidia and AMD GPUs. However, the information available for Nvidia is far more thorough than what is available for AMD, where we need to plug into plaidML to pull stats. The quality of this data will vary depending on the OS’ particular OpenCL implementation.
Holds information and statistics about the GPU(s) available on the currently running system.
Parameters: log (bool, optional) – 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
List of available devices for use in faceswap’s command line arguments
The number of GPU devices discovered on the system.
Trueif all GPU devices have been explicitly disabled otherwise
Obtain statistics for the GPU with the most available free VRAM.
Returns: The dictionary contains the following data:card_id (int): The index of the card as pertaining to
device (str): The name of the device
free (float): The amount of available VRAM on the GPU
total (float): the total amount of VRAM on the GPU
If a GPU is not detected then the card_id is returned as
-1and the amount of free and total RAM available is fixed to 2048 Megabytes.
Return type: dict
GPU Stats that are required for system information logging.
The dictionary contains the following data:
vram (list): the total amount of VRAM in Megabytes for each GPU as pertaining to
driver (str): The GPU driver version that is installed on the OS
devices (list): The device name of each GPU on the system as pertaining to
devices_active (list): The device name of each active GPU on the system as pertaining to
Add any explicitly selected GPU devices to the global list of devices to be excluded from use by Faceswap.
Parameters: devices (list) – list of indices corresponding to the GPU devices connected to the computer