File: //usr/lib/python3.6/site-packages/glances/plugins/__pycache__/glances_gpu.cpython-36.opt-1.pyc
3
Eo�c[, � @ s� d Z ddlmZmZ ddlmZ ddlmZ yddlj Z
W n6 ek
rp Z zdZ
ejdje�� W Y ddZ[X nX dZ
d d
dd�d
ddd�gZG dd� de�Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )z(GPU plugin (limited to NVIDIA chipsets).� )� nativestr�
to_fahrenheit)�logger)�
GlancesPluginNTz6Missing Python Lib ({}), Nvidia GPU plugin is disabledF�procz
GPU processor�%)�name�descriptionZy_unit�memzMemory consumptionc sp e Zd ZdZd� fdd� Zdd� Zdd� Zejej d d
� ��Z
� fdd�Zdd
d�Zdd� Z
� fdd�Z� ZS )�PluginzqGlances GPU plugin (limited to NVIDIA chipsets).
stats is a list of dictionaries with one entry per GPU
Nc s( t t| �j||g d� | j� d| _dS )zInit the plugin.)�args�configZstats_init_valueTN)�superr �__init__�init_nvidiaZ
display_curse)�selfr r
)� __class__� �!/usr/lib/python3.6/glances_gpu.pyr ( s zPlugin.__init__c C sP t r
d| _ytj� t� | _d| _W n$ tk
rH tjd� d| _Y nX | jS )zInit the NVIDIA API.FTz pynvml could not be initialized.) �import_error_tag�
nvml_ready�pynvmlZnvmlInit�get_device_handles�device_handles� Exceptionr �debug)r r r r r 2 s
zPlugin.init_nvidiac C s dS )zReturn the key of the list.�gpu_idr )r r r r �get_keyA s zPlugin.get_keyc C s>