[Put a knife, TensorFlow] Cudnn error report under Ubuntu system

import tensorflow as tf  
import numpy as np  
      
      
input_data = tf.Variable( np.random.rand(10, 6, 6 ,3), dtype = np.float32 )  
filter_data = tf.Variable( np.random.rand(2, 2, 3, 10), dtype = np.float32)  
y = tf.nn.conv2d(input_data, filter_data, strides = [1, 1, 1, 1], padding = 'SAME')  
output,argmax = tf.nn.max_pool_with_argmax(input = y, ksize = [1, 2, 2, 1], strides = [1, 1, 1, 1], padding = 'SAME')  
      
with tf.Session() as sess:  
	sess.run(tf.global_variables_initializer())
	print (sess.run (argmax))
	print(sess.run(tf.shape(argmax)))

After setting up the system, I tried to run the above code and got an error:

I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:126] Couldn't open CUDA library libcudnn.so.5. LD_LIBRARY_PATH: /usr/local/cuda-8.0/lib64:/usr/local/cuda-8.0/lib:
I tensorflow/stream_executor/cuda/cuda_dnn.cc:3517] Unable to load cuDNN DSO
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
···
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: 
name: Tesla K40m
major: 3 minor: 5 memoryClockRate (GHz) 0.745
pciBusID 0000:82:00.0
Total memory: 11.17GiB
Free memory: 2.08GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla K40m, pci bus id: 0000:82:00.0)
F tensorflow/stream_executor/cuda/cuda_dnn.cc:222] Check failed: s.ok() could not find cudnnCreate in cudnn DSO; dlerror: /usr/local/python3/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so: undefined symbol: cudnnCreate
Aborted (core dumped)

Error code cc:222, Baidu found that the libcudnn.so.5 file is missing. According to the solution provided by other bloggers, it is to establish a soft connection between libcudnn.so.7 and 5 in the new version of cudnn, command:

ln -s libcudnn.so.7 libcudnn.so.5

I found that it still didn't work. Later, I found out that it was because the version of cudnn was too high (the 7.x version I installed, I can't remember), and I downloaded cudnn v5.1 to solve the problem.

Record it here for easy reference when configuring the environment in the future

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324888180&siteId=291194637