问题描述
我在我的 Ubuntu 19.04 笔记本电脑上使用 pip install --user tensorflow-gpu
设置了 TensorFlow.CUDA、CUDNN 等所有依赖项均已安装并正常工作.但是,在导入 TensorFlow 并检查 tf.test.is_gpu_available()
时,我还是给出了 False.我已经尝试完全卸载并重新安装 TensorFlow,但没有奏效.tf.test.is_gpu_available()
的输出:
I set up TensorFlow using pip install --user tensorflow-gpu
on my Ubuntu 19.04 laptop. All dependencies like CUDA, CUDNN are installed to and working. But still, when importing TensorFlow and checking tf.test.is_gpu_available()
gives me False. I have tried completely uninstalling and reinstalling TensorFlow, which did not work.Output of tf.test.is_gpu_available()
:
2019-06-27 14:06:18.359739:我tensorflow/core/platform/cpu_feature_guard.cc:142] 你的 CPU 支持此 TensorFlow 二进制文件未编译为使用的说明:AVX2FMA 2019-06-27 14:06:18.611194:我tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU 频率:2194885000 Hz 2019-06-27 14:06:18.621295:我张量流/编译器/xla/service/service.cc:168] XLA 服务 0x19d54e0在平台主机上执行计算.设备:2019-06-2714:06:18.621339:我张量流/编译器/xla/service/service.cc:175]
StreamExecutor 设备 (0): , 2019-06-2714:06:18.742193:我张量流/stream_executor/platform/default/dso_loader.cc:42]成功打开动态库libcuda.so.1 2019-06-2714:06:18.869601:我tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] 成功从 SysFS 读取的 NUMA 节点具有负值 (-1),但必须有至少有一个 NUMA 节点,因此返回 NUMA 节点为零 2019-06-2714:06:18.870469:我tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] 找到设备 0具有属性:名称:GeForce 920M 主要:3 次要:5memoryClockRate(GHz): 0.954 pciBusID: 0000:08:00.0 2019-06-2714:06:18.870675:我tensorflow/stream_executor/platform/default/dso_loader.cc:53] 可以不是 dlopen 库libcudart.so.10.0";dlerror: libcudart.so.10.0:无法打开共享对象文件:没有这样的文件或目录;LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-2714:06:18.870812:我tensorflow/stream_executor/platform/default/dso_loader.cc:53] 可以不是 dlopen 库libcublas.so.10.0";dlerror: libcublas.so.10.0:无法打开共享对象文件:没有这样的文件或目录;LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-2714:06:18.870973:我tensorflow/stream_executor/platform/default/dso_loader.cc:53] 可以不是 dlopen 库libcufft.so.10.0";dlerror: libcufft.so.10.0:无法打开共享对象文件:没有这样的文件或目录;LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-2714:06:18.871111:我tensorflow/stream_executor/platform/default/dso_loader.cc:53] 可以不是 dlopen 库libcurand.so.10.0";dlerror: libcurand.so.10.0:无法打开共享对象文件:没有这样的文件或目录;LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-2714:06:18.871228:我tensorflow/stream_executor/platform/default/dso_loader.cc:53] 可以不是 dlopen 库libcusolver.so.10.0";错误:libcusolver.so.10.0:无法打开共享对象文件:没有这样的文件或目录;LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib642019-06-27 14:06:18.871352:我tensorflow/stream_executor/platform/default/dso_loader.cc:53] 可以不是 dlopen 库libcusparse.so.10.0";错误:libcusparse.so.10.0:无法打开共享对象文件:没有这样的文件或目录;LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib642019-06-27 14:06:20.233321:我张量流/stream_executor/platform/default/dso_loader.cc:42]成功打开动态库libcudnn.so.7 2019-06-2714:06:20.233363:Wtensorflow/core/common_runtime/gpu/gpu_device.cc:1663] 无法 dlopen一些 GPU 库.跳过注册GPU设备... 2019-06-2714:06:20.407248:我tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] 设备将 StreamExecutor 与强度为 1 的边缘矩阵互连:2019-06-2714:06:20.407318:我张量流/核心/common_runtime/gpu/gpu_device.cc:1187] 02019-06-27 14:06:20.407351:我张量流/核心/common_runtime/gpu/gpu_device.cc:1200] 0: N2019-06-27 14:06:20.441266:我tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] 成功从 SysFS 读取的 NUMA 节点具有负值 (-1),但必须有至少有一个 NUMA 节点,因此返回 NUMA 节点为零 2019-06-2714:06:20.443613:我张量流/编译器/xla/service/service.cc:168] XLA服务 0x4ed6d40 在平台 CUDA 上执行计算.设备:2019-06-27 14:06:20.443670:我张量流/编译器/xla/service/service.cc:175] StreamExecutor设备 (0):GeForce 920M,计算能力 3.5 错误
来自 CUDA 示例的 deviceQuery 输出:
Output of deviceQuery from CUDA Samples:
CUDA 设备查询(运行时 API)版本(CUDART 静态链接)
检测到 1 个支持 CUDA 的设备
Detected 1 CUDA Capable device(s)
设备 0:GeForce 920M"CUDA 驱动程序版本/运行时版本
10.1/10.1 CUDA 能力主要/次要版本号:3.5 全局内存总量:4046 MBytes (4242341888字节)(2)多处理器,(192)CUDA 核心/MP:384 CUDA 核心GPU 最大时钟频率:954 MHz (0.95 GHz)
内存时钟频率:900 Mhz 内存总线宽度:64 位二级缓存大小:
524288 字节最大纹理尺寸大小 (x,y,z)
1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096) 最大分层1D 纹理大小,(num) 层 1D=(16384),2048 层最大Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers常量内存总量:65536 字节总计每个块的共享内存量:49152 字节总数每个块可用的寄存器:65536 Warp 大小:
32 每个多处理器的最大线程数:2048 最大每个块的线程数:1024 一个的最大维度大小线程块 (x,y,z): (1024, 1024, 64) 网格的最大尺寸大小 (x,y,z): (2147483647, 65535, 65535) 最大内存间距:
2147483647 字节纹理对齐:512字节并发复制和内核执行:是,有 1 个副本内核的引擎运行时间限制:是
集成GPU共享主机内存:不支持主机页面锁定内存映射:是 对齐要求表面:是设备具有 ECC 支持:
禁用设备支持统一寻址 (UVA):是设备支持计算抢占:否 支持合作内核启动:不支持多设备协作内核启动:无设备 PCI 域 ID/总线 ID/位置 ID:0/8/0 计算模式:<默认(多个主机线程可以同时使用 ::cudaSetDevice() 和设备)>
Device 0: "GeForce 920M" CUDA Driver Version / Runtime Version
10.1 / 10.1 CUDA Capability Major/Minor version number: 3.5 Total amount of global memory: 4046 MBytes (4242341888 bytes) ( 2) Multiprocessors, (192) CUDA Cores/MP: 384 CUDA Cores GPU Max Clock rate: 954 MHz (0.95 GHz)
Memory Clock rate: 900 Mhz Memory Bus Width: 64-bit L2 Cache Size:
524288 bytes Maximum Texture Dimension Size (x,y,z)
1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096) Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers Total amount of constant memory: 65536 bytes Total amount of shared memory per block: 49152 bytes Total number of registers available per block: 65536 Warp size:
32 Maximum number of threads per multiprocessor: 2048 Maximum number of threads per block: 1024 Max dimension size of a thread block (x,y,z): (1024, 1024, 64) Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535) Maximum memory pitch:
2147483647 bytes Texture alignment: 512 bytes Concurrent copy and kernel execution: Yes with 1 copy engine(s) Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No Support host page-locked memory mapping: Yes Alignment requirement for Surfaces: Yes Device has ECC support:
Disabled Device supports Unified Addressing (UVA): Yes Device supports Compute Preemption: No Supports Cooperative Kernel Launch: No Supports MultiDevice Co-op Kernel Launch: No Device PCI Domain ID / Bus ID / location ID: 0 / 8 / 0 Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery,CUDA 驱动程序 = CUDART,CUDA 驱动程序版本 = 10.1,CUDA运行时版本 = 10.1,NumDevs = 1 结果 = PASS
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1 Result = PASS
推荐答案
我的特殊问题是 TensorFlow 1.14.0 正在寻找 CUDA 10.0 二进制文件,而我有仅安装 10.1.由于某种原因,我的 Ubuntu 19.04 无法安装 CUDA 10.0,所以我安装了 18.04 并按照标准方式使 TF 与 GPU 一起工作(安装 CUDA 10.0、安装 CUDNN 等),一切正常.
My particular problem was that TensorFlow 1.14.0 were seeking for CUDA 10.0 binary, while I had only 10.1 installed. For some reason CUDA 10.0 could not be installed on my Ubuntu 19.04 so I installed 18.04 instead and followed standard way to make TF work with GPU (install CUDA 10.0, install CUDNN, etc.) and everything works just fine.
此表显示了 TF 版本与所需的 CUDA 版本:https://www.tensorflow.org/install/source#linux
This table shows TF versions vs. required CUDA versions: https://www.tensorflow.org/install/source#linux
以下是来自 TF 的说明:https://www.tensorflow.org/install/gpu#ubuntu_1804_cuda_10
Here are instructions from TF:https://www.tensorflow.org/install/gpu#ubuntu_1804_cuda_10
您也可以降级到 TF 1.12 (CUDA 9.0):https://www.tensorflow.org/install/gpu#ubuntu_1604_cuda_90_for_tensorflow_1130
You may also downgrade to TF 1.12 (CUDA 9.0): https://www.tensorflow.org/install/gpu#ubuntu_1604_cuda_90_for_tensorflow_1130
这篇关于TensorFlow 1.14.0 未使用 GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!