我的Tensorflowgpu如何无法激活?

2024-06-01 09:07:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经安装了:

tensorflow==1.13.1
tensorflow-estimator==1.13.0
tensorflow-gpu==1.13.1

Cuda安装了2个gpu:

$ nvidia-smi
Tue Jul 23 14:59:13 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.48                 Driver Version: 410.48                    |
|-------------------------------+----------------------+----------------------+
| 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 RTX 208...  Off  | 00000000:01:00.0  On |                  N/A |
|  0%   49C    P8    27W / 250W |    367MiB / 10988MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 208...  Off  | 00000000:02:00.0 Off |                  N/A |
|  0%   34C    P8    13W / 250W |      0MiB / 10989MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1081      G   /usr/lib/xorg/Xorg                           129MiB |
|    0      1481      G   kwin_x11                                      33MiB |
|    0      1485      G   /usr/bin/krunner                               6MiB |
|    0      1487      G   /usr/bin/plasmashell                          95MiB |
|    0      4111      G   ...uest-channel-token=13844302101002828917    99MiB |
+-----------------------------------------------------------------------------+

然后我执行命令:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

nvcc版本是什么:

$ which nvcc
/usr/local/cuda-10.0/bin/nvcc

cuda在哪里:

$ whereis cuda

    cuda: /usr/local/cuda

$ cat /usr/local/cuda/version.txt 
CUDA Version 10.0.130

但是,此测试显示只有CPU处于活动状态:

In [1]: from tensorflow.python.client import device_lib 
   ...: print(device_lib.list_local_devices())                                                                                                                                                                                                                                                                                                              
2019-07-23 15:05:05.551069: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-07-23 15:05:05.577118: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3600000000 Hz
2019-07-23 15:05:05.578385: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x1b10c90 executing computations on platform Host. Devices:
2019-07-23 15:05:05.578396: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 7705944944160425878
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 6552980760028299571
physical_device_desc: "device: XLA_CPU device"
]

这是在Ubuntu 18.04上测试的。此外,我不能卸载Tensorflow,只能保留Tensorflow gpu,因为我的库需要依赖Tensorflow


Tags: gpudeviceusrlocaltensorflowserviceusagecpu