tensorflow无法找到合适的算法进行前向卷积
在上运行PDE示例时 在本地机器的GPU上,我在tensorflow无法找到合适的算法进行前向卷积,tensorflow,Tensorflow,在上运行PDE示例时 在本地机器的GPU上,我在step.run({eps:0.03,阻尼:0.04})的循环中得到以下错误 I tensorflow/core/common_runtime/gpu/gpu_device.cc:755]创建tensorflow设备(/gpu:0)->(设备:0,名称:GeForce GTX 750 Ti,pci总线id:0000:01:00.0) F tensorflow/stream_executor/cuda/cuda_dnn.cc:675]检查失败:状态=
step.run({eps:0.03,阻尼:0.04})的循环中得到以下错误
I tensorflow/core/common_runtime/gpu/gpu_device.cc:755]创建tensorflow设备(/gpu:0)->(设备:0,名称:GeForce GTX 750 Ti,pci总线id:0000:01:00.0)
F tensorflow/stream_executor/cuda/cuda_dnn.cc:675]检查失败:状态==CUDNN_状态_成功(3对0)无法找到适合进行前向卷积的算法
中止(堆芯转储)
当我使用带有tf.device('/CPU:0')的CPU运行代码时:
工作正常。此外,我还使用GPU运行了其他示例
这是他们尚未实现的功能吗?还是我在什么地方出错了
系统信息:
操作系统:Ubuntu 14.04 LTS
图形卡:GeForce GTX 750 Ti
CUDA和cuDNN的安装版本:CUDA 7.5,cuNN v5
我通过从GitHub拉取来安装源代码。有关GitHub问题跟踪器的更多信息:(1)TensorFlow要求(请参阅TensorFlow手册)
TensorFlow Python API支持Python 2.7和Python 3.3+
GPU版本(仅限Linux)与Cuda Toolkit 7.5和cuDNN v4配合使用效果最佳。仅当从源代码处安装时,才支持其他版本(Cuda toolkit>=7.0和cuDNN 6.5(v2)、7.0(v3)、v5)
(2) 凑合
所以
(2-1)拆下cuDNN5
(2-2)安装cuDNN4和设置
(2-3-1)卸载tensorflow
(2-3-2)安装(gpu)tensorflow请在问题正文中包含一个可运行的示例,而不是作为链接。看见
#Import libraries for simulation
import tensorflow as tf
import numpy as np
sess = tf.InteractiveSession()
def make_kernel(a):
"""Transform a 2D array into a convolution kernel"""
a = np.asarray(a)
a = a.reshape(list(a.shape) + [1,1])
return tf.constant(a, dtype=1)
def simple_conv(x, k):
"""A simplified 2D convolution operation"""
x = tf.expand_dims(tf.expand_dims(x, 0), -1)
y = tf.nn.depthwise_conv2d(x, k, [1, 1, 1, 1], padding='SAME')
return y[0, :, :, 0]
def laplace(x):
"""Compute the 2D laplacian of an array"""
laplace_k = make_kernel([[0.5, 1.0, 0.5],
[1.0, -6., 1.0],
[0.5, 1.0, 0.5]])
return simple_conv(x, laplace_k)
# Initial Conditions -- some rain drops hit a pond
N = 500
# Set everything to zero
u_init = np.zeros([N, N], dtype=np.float32)
ut_init = np.zeros([N, N], dtype=np.float32)
# Some rain drops hit a pond at random points
for n in range(40):
a,b = np.random.randint(0, N, 2)
u_init[a,b] = np.random.uniform()
# Parameters:
# eps -- time resolution
# damping -- wave damping
eps = tf.placeholder(tf.float32, shape=())
damping = tf.placeholder(tf.float32, shape=())
# Create variables for simulation state
U = tf.Variable(u_init)
Ut = tf.Variable(ut_init)
# Discretized PDE update rules
U_ = U + eps * Ut
Ut_ = Ut + eps * (laplace(U) - damping * Ut)
# Operation to update the state
step = tf.group(
U.assign(U_),
Ut.assign(Ut_))
# Initialize state to initial conditions
tf.initialize_all_variables().run()
# Run 1000 steps of PDE
nsteps = 1000
for i in range(nsteps):
# Step simulation
step.run({eps: 0.03, damping: 0.04})
# Visualize every 50 steps
if i % 50 == 0:
print("iter = %d, max(U) = %f, min(U) = %f" % \
(i, np.max(U.eval()), np.min(U.eval())))
sess.close()