Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tensorflow 2.4.0尽管使用兼容版本,但未检测到GPU_Python_Python 3.x_Tensorflow - Fatal编程技术网

Python Tensorflow 2.4.0尽管使用兼容版本,但未检测到GPU

Python Tensorflow 2.4.0尽管使用兼容版本,但未检测到GPU,python,python-3.x,tensorflow,Python,Python 3.x,Tensorflow,我最近从TensorFlow1.x-gpu迁移到TensorFlow2。但是TF不再识别GPU了。 我使用Spyder和非蟒蛇解释器。我使用pip来管理我的包。操作系统是Windows10。GPU是GTX 1660 Ti,因此它确实支持CUDA Py版本——Python 3.7 当前TF版本--2.4.0 当前CUDA版本--11.1 当前CUDNN版本--8.0.4.30 -我已按照此处的规定复制了提取后的所有CUDNN DLL-- -还添加了所有必要的路径变量。我已经安装了Visual

我最近从TensorFlow1.x-gpu迁移到TensorFlow2。但是TF不再识别GPU了。 我使用Spyder和非蟒蛇解释器。我使用pip来管理我的包。操作系统是Windows10。GPU是GTX 1660 Ti,因此它确实支持CUDA

  • Py版本——Python 3.7
  • 当前TF版本--2.4.0
  • 当前CUDA版本--11.1
  • 当前CUDNN版本--8.0.4.30
-我已按照此处的规定复制了提取后的所有CUDNN DLL--

-还添加了所有必要的路径变量。我已经安装了Visual Studio 2019以及以前安装的Visual代码(当 我曾经在我的GPU上运行tensorflow)

根据,我已安装CUDNN和CUDA的正确组合。然而,tf不认识我的gpu。 提前感谢您抽出时间:)

编辑1——添加在cmd中导入tensorflow后收到的日志 编辑2--添加了中指定的日志级别

编辑2——添加PyTorch注册GPU的证据,如中所述

导入火炬
torch.cuda.CUU当前设备()
Out[2]:0
火炬.cuda.装置(0)
出[3]:
torch.cuda.device_count()
Out[4]:1
torch.cuda.get_设备_名称(0)
输出[5]:“GeForce GTX 1660 Ti”
torch.cuda.U是否可用()
Out[6]:对

当您导入tensorflow时,终端上会打印一个日志,请在您的问题中包括。添加了它,感谢您的建议,这不是整个日志,它应该提到所有cuda libsI尝试增加日志级别的内容,这就是我训练一个基本模型并显示完整日志的全部内容,因为导入tensorflow不足以说明问题所在,除非它是一个已知的问题,并且有一个已知的解决方案。
NVIDIA SMI output :-
C:\WINDOWS\system32>nvidia-smi
Tue Feb  9 17:08:11 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 461.40       Driver Version: 461.40       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 166... WDDM  | 00000000:01:00.0 Off |                  N/A |
| N/A   76C    P0    26W /  N/A |    273MiB /  6144MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     15272    C+G   ...n64\EpicGamesLauncher.exe    N/A      |
|    0   N/A  N/A     16500      C   ...iles\Python37\pythonw.exe    N/A      |
+-----------------------------------------------------------------------------+


nvcc --version :-
C:\WINDOWS\system32>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:54:10_Pacific_Daylight_Time_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.relgpu_drvr455TC455_06.29190527_0

tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None)
Out[9]: False
>>> os.environ['TF_CPP_MIN_VLOG_LEVEL']='3'
>>> os.environ['TF_CPP_MIN_LOG_LEVEL']='0'
>>> import tensorflow as tf
2021-02-09 18:10:16.489113:Itensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
    2021-02-09 18:10:16.558283: I tensorflow/core/platform/cloud/gcs_file_system.cc:804] GCS cache max size = 0 ; block size = 67108864 ; max staleness = 0
    2021-02-09 18:10:16.562188: I .\tensorflow/core/platform/cloud/ram_file_block_cache.h:64] GCS file block cache is disabled
    2021-02-09 18:10:16.565031: I tensorflow/core/platform/cloud/gcs_file_system.cc:844] GCS DNS cache is disabled, because GCS_RESOLVE_REFRESH_SECS = 0 (or is not set)
    2021-02-09 18:10:16.568337: I tensorflow/core/platform/cloud/gcs_file_system.cc:874] GCS additional header DISABLED. No environment variable set.
import torch

torch.cuda.current_device()
Out[2]: 0

torch.cuda.device(0)
Out[3]: <torch.cuda.device at 0x222be69a8c8>

torch.cuda.device_count()
Out[4]: 1

torch.cuda.get_device_name(0)
Out[5]: 'GeForce GTX 1660 Ti'

torch.cuda.is_available()
Out[6]: True