TensorFlow: how to verify that it works on the GPU

I am looking for an easy way to verify that my TF graphs are actually running on the GPU.

PS. It would also be nice to verify that the cuDNN library is cuDNN .

+7
gpu tensorflow cudnn
source share
3 answers

There are several ways to view a placement.

+7
source share

When you import TF in Python

 import tensorflow as tf 

You will receive these logs that indicate the use of CUDA libraries

 I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally 

Also, when you create a graph and start a session with log_device_placement in Config Proto, you will get these logs (shows that he found the GPU device):

 I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate (GHz) 1.759 pciBusID 0000:01:00.0 Total memory: 5.93GiB Free memory: 4.94GiB I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: YI tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0) 
+4
source share

There is a related issue with TensorFlow upstream . This basically suggests that the Python API has not yet disclosed such information.

However, the C ++ API. For example. there is tensorflow::KernelsRegisteredForOp() . I wrote a small Python wrapper and then implemented supported_devices_for_op here (in this commit ).

0
source share

All Articles