Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know if tensorflow using cuda and cudnn or not?

I am using Ubuntu 16.04. Here is tensorflow info:

>>> pip show tensorflow-gpu
pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.2.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /home/xxxx/anaconda3/envs/tensorflow/lib/python3.5/site-packages
Requires: markdown, backports.weakref, wheel, bleach, html5lib, protobuf, numpy, six, werkzeug

The cuda info:

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

When I import tensorflow in Python from Ubuntu terminal I get no loading information as below.

>>> import tensorflow
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally

If I run the python program in terminal, I get different information.

2017-06-20 16:08:18.075709: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-20 16:08:18.075733: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-20 16:08:18.075740: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-06-20 16:08:18.075744: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-20 16:08:18.075750: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2017-06-20 16:08:18.260629: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-06-20 16:08:18.261462: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties: 
name: Quadro K620M
major: 5 minor: 0 memoryClockRate (GHz) 1.124
pciBusID 0000:08:00.0
Total memory: 1.96GiB
Free memory: 1.58GiB
2017-06-20 16:08:18.261514: I tensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0 
2017-06-20 16:08:18.261524: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   Y 
2017-06-20 16:08:18.261550: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Quadro K620M, pci bus id: 0000:08:00.0)
2

How do I know if tensorflow is using cuda and cudnn or not? What other information do I need to provide?

like image 796
AZ2016 Avatar asked Jun 20 '17 21:06

AZ2016


People also ask

How do I know if TensorFlow CuDNN is working?

To check if you "see" the CuDNN from your python environment and therewith validate a correct PATH variable, you can try this: import ctypes ctypes. WinDLL("cudnn64_7. dll") # use the file name of your cudnn version here.

How do I know if TensorFlow CUDA is working?

Use tf. test. is_built_with_cuda to validate if TensorFlow was build with CUDA support.

Does TensorFlow use CuDNN?

Based on the information on the Tensorflow website, Tensorflow with GPU support requires a cuDNN version of 8.0. 4. In order to download CuDNN, you have to register to become a member of the NVIDIA Developer Program (which is free).

How do I know if CuDNN is installed?

Step 1: Register an nvidia developer account and download cudnn here (about 80 MB). You might need nvcc --version to get your cuda version. Step 2: Check where your cuda installation is. For most people, it will be /usr/local/cuda/ .


1 Answers

You can check with nvidia-smi if the GPU is used by the python/tensorflow process. If there is no process using the GPU, tensorflow doesn't use cuda and cudnn.

like image 61
Baschdl Avatar answered Nov 07 '22 01:11

Baschdl