使用Ubuntu16.04,PyCharm
我使用以下链接安装了python3.5的tensorflow-gpu:http://www.python36.com/install-tensorflow141-gpu/
Tensorflow安装很好。它用测试代码运行。然后我安装了Keras,以便从这里运行代码:https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/5.1-introduction-to-convnets.ipynb
我得到了以下错误:
2018-02-23 11:19:13.457201: i tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892]成功从SysFS读取的NUMA节点有负值(-1),但必须至少有一个NUMA节点,因此返回NUMA节点0 2018-02-23 11:19:13.457535: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030]发现设备0具有属性:名称: GeForce GTX 1060 6GB大调:6小调:1 memoryClockRate(GHz):1.7845 pciBusID: 0000:01:00.0 totalMemory: 5.93GiB freeMemory: 5.65GiB 2018-02-23 11:19:13.457551: i tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (设备: 0,名称: GeForce GTX 1060 6GB,pci总线id: 0000:01:00.0,计算能力: 6.1) 2018-02-23 11:21:22.130004: e tensorflow/stream_executor/cuda/cuda_dnn.cc:378]加载运行时CuDNN库: 7005 (兼容版本7000),但源代码是用6021编译的(兼容版本6000)。如果使用二进制安装,则升级CuDNN库以匹配。如果从源构建,请确保在运行时加载的库与编译配置期间指定的兼容版本匹配。 2018-02-23 11:21:22.130663: failed/core/kernels/conv_ops.cc:667]检查失败:F>parent()->GetConvolveAlgorithms( conv_parameters.ShouldIncludeWinogradNonfusedAlgo(),&algorithms)
Tensorflow-cpu可以很好地处理Keras。我的问题是:
1)使用Keras正确安装tensorflow-gpu需要遵循哪些指令?
2)我能做些什么来消除这些错误?
3)是否有任何通用指令可用于所有平台正确安装带有Keras的tensorflow-gpu?
这里是我创建的一个文件,它展示了如何在Pycharm社区版本中使用tensorflow-gpu运行Keras。VidStream/blob/master/how%20to%20run%20tensorflow-gpu.odt
发布于 2018-02-23 16:50:25
您正在尝试安装以下4个组件:
它们并不总是同步的,从今天起,tensorflow支持cuda 9.1,如果您自己编译它(就像您发布的指南),预构建的二进制文件是用cuda 9.0和cudnn 7编译的。我更喜欢使用它们,所以这就是我正在使用的cuda版本。
您可以这样安装它:
首先,删除现有的cuda安装:
sudo apt-get remove --purge nvidia-*安装ubuntu报头和cuda 9.0:
sudo apt-get install linux-headers-$(uname -r)
CUDA_REPO_PKG=cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
wget -O /tmp/${CUDA_REPO_PKG} http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
rm -f /tmp/${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get install -y cuda-9-0从cuDNN下载nvidia位点 v7.0.5Library,导航到下载的文件夹并安装:
tar -xzvf cudnn-9.0-linux-x64-v7.tgz
sudo cp cuda/include/* /usr/local/cuda/include/
sudo cp cuda/lib64/* /usr/local/cuda/lib64/重新启动计算机并检查nvidia驱动程序的工作情况:
nvidia-smi输出应该如下所示:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.30 Driver Version: 390.30 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 105... Off | 00000000:04:00.0 On | N/A |
| 0% 33C P8 N/A / 120W | 310MiB / 4038MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1307 G /usr/lib/xorg/Xorg 141MiB |
| 0 2684 G compiz 120MiB |
| 0 4078 G ...-token= 45MiB |
+-----------------------------------------------------------------------------+创建一个虚拟环境并在其中安装tensorflow和keras:
sudo apt-get install virtualenv
virtualenv tfenv
source tfenv/bin/activate
pip install tensorflow-gpu
pip install keras发布于 2018-02-27 13:50:49
这个错误是由于cudnn的错误版本造成的。我想你错过了教程中的一些步骤。这个错误Loaded runtime CuDNN library: 7005 (compatibility version 7000) but source was compiled with 6021 (compatibility version 6000). If using a binary install, upgrade your CuDNN library to match. If building from sources, make sure the library loaded at runtime matches a compatible version specified during compile configuration.解释了自己是什么问题。
我的建议是安装cudn7.0.5,如果您已经安装了cuda9.1,那么请从源代码中重新构建并仔细阅读说明,或者如果安装了cuda9.0而不是使用pip3 install tensorflow-gpu。
此外,我可以遵循keras与Cuda9.1一起工作,并成功地测试了您已经尝试并链接到上面的代码。
https://stackoverflow.com/questions/48952526
复制相似问题