简体   繁体   中英

Tensorflow can't use GPU. tf.test.is_gpu_available() show GPU but cannot use

I have Ubuntu 18.04. Python 3.7.3, Tensorflow 2.0.0

here's my cuda version:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

My computer is UX430UQ, graphic card is GeForce 940MX

Here's the output from nvidia-smi:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.87.01    Driver Version: 418.87.01    CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| 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 940MX       On   | 00000000:01:00.0 Off |                  N/A |
| N/A   45C    P0    N/A /  N/A |    283MiB /  2004MiB |      9%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1014      G   /usr/lib/xorg/Xorg                            24MiB |
|    0      1164      G   /usr/bin/gnome-shell                          47MiB |
|    0      1440      G   /usr/lib/xorg/Xorg                           123MiB |
|    0      1615      G   /usr/bin/gnome-shell                          84MiB |
+-----------------------------------------------------------------------------+

Here's the output when I run sudo apt-get install cuda :

Reading package lists...
Building dependency tree...
Reading state information...
cuda is already the newest version (10.1.243-1).
0 upgraded, 0 newly installed, 0 to remove and 138 not upgraded.

Here's the output when I run tf.test.is_gpu_available()

2019-10-08 21:04:37.186069: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1006] 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-10-08 21:04:37.188434: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:

name: GeForce 940MX major: 5 minor: 0 memoryClockRate(GHz): 1.2415

pciBusID: 0000:01:00.0

2019-10-08 21:04:37.188863: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic 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-8.0/lib64

2019-10-08 21:04:37.189156: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic 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-8.0/lib64

2019-10-08 21:04:37.189426: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic 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-8.0/lib64

2019-10-08 21:04:37.189687: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic 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-8.0/lib64

2019-10-08 21:04:37.189946: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic 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-8.0/lib64

2019-10-08 21:04:37.190202: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic 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-8.0/lib64

2019-10-08 21:04:37.190236: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7

2019-10-08 21:04:37.190244: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1641] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.

Skipping registering GPU devices...

2019-10-08 21:04:37.190261: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:

2019-10-08 21:04:37.190268: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0

2019-10-08 21:04:37.190276: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N

You should use cuda10 and cudnn7.4 referring to this web

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM