没有cudnn,当前不支持Conv2D for GPU

时间:2018-09-17 17:53:17

标签: tensorflow cudnn

我正在测试使用tf.nn.conv2d的TensorFlow程序,但发生如下错误:

2018-09-18 01:33:54.908161: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-09-18 01:33:54.987724: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-09-18 01:33:54.988106: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties: 
name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.695
pciBusID: 0000:01:00.0
totalMemory: 7.92GiB freeMemory: 7.44GiB
2018-09-18 01:33:54.988122: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2018-09-18 01:33:55.193045: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-18 01:33:55.193076: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971]      0 
2018-09-18 01:33:55.193082: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0:   N 
2018-09-18 01:33:55.193257: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7173 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1278, in _do_call
    return fn(*args)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1263, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.UnimplementedError: Conv2D for GPU is not currently supported without cudnn
     [[Node: Conv2D = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](gradients/Conv2D_grad/Conv2DBackpropFilter-0-TransposeNHWCToNCHW-LayoutOptimizer, Variable/read)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "facerec.py", line 77, in <module>
    l, _ = sess.run([loss, train], feed_dict={x:imag, y:ans})
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 877, in run
    run_metadata_ptr)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1100, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1272, in _do_run
    run_metadata)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1291, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnimplementedError: Conv2D for GPU is not currently supported without cudnn
     [[Node: Conv2D = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](gradients/Conv2D_grad/Conv2DBackpropFilter-0-TransposeNHWCToNCHW-LayoutOptimizer, Variable/read)]]

Caused by op 'Conv2D', defined at:
  File "facerec.py", line 31, in <module>
    l1 = tf.nn.relu(tf.nn.conv2d(x, kcore1, [1, 1, 1, 1], 'SAME', False)+bias1)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 956, in conv2d
    data_format=data_format, dilations=dilations, name=name)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
    return func(*args, **kwargs)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
    op_def=op_def)
  File "/home/jzsb/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1717, in __init__
    self._traceback = tf_stack.extract_stack()

UnimplementedError (see above for traceback): Conv2D for GPU is not currently supported without cudnn
     [[Node: Conv2D = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](gradients/Conv2D_grad/Conv2DBackpropFilter-0-TransposeNHWCToNCHW-LayoutOptimizer, Variable/read)]]

我肯定会确认之前已经安装了cuDNN。

jzsb@jzsb-tf:~/PycharmProjects/untitled$ ls -las /usr/local/cuda/include/*dnn*
100 -r--r--r-- 1 root root 100962 8月  15 01:08 /usr/local/cuda/include/cudnn.h
jzsb@jzsb-tf:~/PycharmProjects/untitled$ ls -las /usr/local/cuda/lib64/*dnn*
     0 lrwxrwxrwx 1 root root        13 8月  15 01:09 /usr/local/cuda/lib64/libcudnn.so -> libcudnn.so.7
     0 lrwxrwxrwx 1 root root        17 8月  15 01:09 /usr/local/cuda/lib64/libcudnn.so.7 -> libcudnn.so.7.2.1
281260 -rwxr-xr-x 1 root root 288007984 8月  15 01:09 /usr/local/cuda/lib64/libcudnn.so.7.2.1
278240 -rw-r--r-- 1 root root 284914492 8月  15 01:09 /usr/local/cuda/lib64/libcudnn_static.a

我的tensorflow版本是1.10,请告诉我如何解决此问题,谢谢。

1 个答案:

答案 0 :(得分:0)

您可以为 GPU 和 CPU 安装最新版本的 Tensorflow 以及相应的 cuDNN 和 CUDA 版本,这将解决问题。

有关 Tensorflow GPU 安装和设置(例如驱动程序和 PATH)的详细信息,您可以按照 this 文档进行操作。

有关具有特定版本的 Tensorflow、Python、cuDNN、CUDA 等的 Table 的详细信息,您可以按照 this 文档进行操作。