我想在Ubuntu 16.04上安装tensorflow 2.2(当前稳定版本)。但是我的tensorflow不能在笔记本电脑中检测到gpu。
这是我安装和配置所有内容的方式
nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.36.06 Driver Version: 450.36.06 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce RTX 2060 Off | 00000000:01:00.0 Off | N/A |
| N/A 41C P8 4W / N/A | 206MiB / 5934MiB | 7% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1202 G /usr/lib/xorg/Xorg 184MiB |
| 0 N/A N/A 2112 G compiz 12MiB |
| 0 N/A N/A 2742 G /usr/lib/firefox/firefox 3MiB |
| 0 N/A N/A 3857 G /usr/lib/firefox/firefox 3MiB |
+-----------------------------------------------------------------------------+
然后我创建了一个虚拟环境,并使用pip install tensorflow-gpu
要安装cuda,我去了Nvidia's official website并下载了cuda以遵循Ubuntu 16.04的安装过程。安装程序类型:deb(local)
在安装cuda之后,我下载了CuDNN。最初,我尝试安装开发人员库,但它吐出了一个依赖项错误。因此,根据this guide,我尝试安装libcupti-dev并将export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
添加到我的bashrc中。尽管在上述路径中找不到文件lib64。我尝试再次安装cuDNN开发人员库,但仍然发现一些依赖项错误。因此,在搜索错误时,我发现必须安装运行时库。因此,我尝试安装该程序,然后安装开发人员库。这次我能够成功安装开发人员库。
我执行了以下两次导出,如官方安装cudo工具包安装指南中的安装后操作所述。
export PATH=/usr/local/cuda-111.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
tf.config.list_physical_devices('GPU')
此行的输出如下。
>>> tf.config.list_physical_devices('GPU')
2020-06-07 13:20:51.814659: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-06-07 13:20:51.840069: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: CUDA_ERROR_UNKNOWN: unknown error
2020-06-07 13:20:51.840135: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: hari-Lenovo-Legion-Y740-17IRHg
2020-06-07 13:20:51.840142: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: hari-Lenovo-Legion-Y740-17IRHg
2020-06-07 13:20:51.840188: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:200] libcuda reported version is: 450.36.6
2020-06-07 13:20:51.840226: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:204] kernel reported version is: 450.36.6
2020-06-07 13:20:51.840245: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:310] kernel version seems to match DSO: 450.36.6
[]
有人可以告诉我我的安装步骤是否有问题,这里的解决方案是什么?