Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

python - TensorFlow 1.14.0 is not using GPU

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: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2019-06-27 14:06:18.611194: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2194885000 Hz 2019-06-27 14:06:18.621295: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x19d54e0 executing computations on platform Host. Devices: 2019-06-27 14:06:18.621339: I tensorflow/compiler/xla/service/service.cc:175]
StreamExecutor device (0): , 2019-06-27 14:06:18.742193: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1 2019-06-27 14:06:18.869601: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2019-06-27 14:06:18.870469: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: name: GeForce 920M major: 3 minor: 5 memoryClockRate(GHz): 0.954 pciBusID: 0000:08:00.0 2019-06-27 14:06:18.870675: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-27 14:06:18.870812: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-27 14:06:18.870973: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-27 14:06:18.871111: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-27 14:06:18.871228: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-27 14:06:18.871352: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64 2019-06-27 14:06:20.233321: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7 2019-06-27 14:06:20.233363: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices... 2019-06-27 14:06:20.407248: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix: 2019-06-27 14:06:20.407318: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0 2019-06-27 14:06:20.407351: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N 2019-06-27 14:06:20.441266: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2019-06-27 14:06:20.443613: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4ed6d40 executing computations on platform CUDA. Devices: 2019-06-27 14:06:20.443670: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): GeForce 920M, Compute Capability 3.5 False

Output of deviceQuery from CUDA Samples:

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

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 Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1 Result = PASS

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

This table shows TF versions vs. required CUDA versions: https://www.tensorflow.org/install/source#linux

Here are instructions from TF: https://www.tensorflow.org/install/gpu#ubuntu_1804_cuda_10

You may also downgrade to TF 1.12 (CUDA 9.0): https://www.tensorflow.org/install/gpu#ubuntu_1604_cuda_90_for_tensorflow_1130


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...