Know your CUDA

Once you know you have a machine with Nvidia GPU in it you can run the command below to learn its status:

$ nvidia-smi
nvidia-smi: command not found

what????  We don’t have it installed in the machine.. Try installing as below:

$ sudo apt-get install nvidia-cuda-toolkit

Now we can try again to check status:

$ nvidia-smi
Fri Nov 11 18:37:47 2016
+———————————————————–+
| NVIDIA-SMI 370.28 Driver Version: 370.28 |
|———————-+————-+———————-+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|=============+======================+======================|
| 0 GRID K520 Off | 0000:00:03.0 Off | N/A |
| N/A 47C P0 1W / 125W | 0MiB / 4036MiB | 0% Default |
+——————–+———————-+———————-+

+——————————————————————–+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|======================================================================|
| No running processes found |
+——————————————————————-+

Above results shows we do have GPU however there is no application running which is using GPU.

Now the question comes what kind of GPU we have?

$ nvidia-smi -L
GPU 0: GRID K520 (UUID: GPU-00613868-702c-d4b0-87f3-8a0232feba7e)

Based on above command we learn more about GPU type. We also know that we just have ONE GPU based on 0 index. Based on GRID K520 we are sure that we have the following GPU in our machine:

Nvidia GRID K520 8GB GDDR5 PCIe gen3 x16 Cloud Gaming Kepler GPU Graphics 900-12055-0020-000

Did you guess which machine is it? It is AWS EC2 Gx type instance.

When a process is using the GPU we can learn which process is using it, stats of usage and process PID as below:

~$ nvidia-smi
Fri Nov 11 18:48:01 2016
+————————————————————–+
| NVIDIA-SMI 370.28 Driver Version: 370.28 |
|——————————-+———–+———————-+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+=======+======================|
| 0 GRID K520 Off | 0000:00:03.0 Off | N/A |
| N/A 51C P0 44W / 125W | 38MiB / 4036MiB | 0% Default |
+——————————-+———+———————-+

+———————————————————-+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=========================================================|
| 0 1332 C java 36MiB |
+——————————————————-+

The most useful command to get specific info about driver use

$ nvidia-smi –help-query-gpu

Example:

$ nvidia-smi –query-gpu=gpu_name,gpu_bus_id,vbios_version –format=csv
name, pci.bus_id, vbios_version
GRID K520, 0000:00:03.0, 80.04.D4.00.03

Enjoy!

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s