You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CUDA/TensorFlow环境下GPU可检测但无法正常工作求助

GTX 960显卡下TensorFlow与PyTorch GPU无法正常工作

环境配置

  • GPU可被系统检测
  • TensorFlow、Keras:2.4.0版本
  • PyTorch:1.5.1+cu101版本
  • CUDA:10.1版本
  • cuDNN:7.6.0版本
  • Python:3.7.6版本
  • tensorflow-gpu:2.4.0版本

已尝试操作

已将cudnn64_7.dll替换为cudnn64_8.dll,但GPU仍无法正常工作。

检测代码

import torch
import tensorflow as tf
import sys
import keras

def set_device(): 
  if torch.cuda.is_available():    
      device = torch.device("cuda")
      print('There are %d GPU(s) available.' % torch.cuda.device_count())
      print('We will use the GPU:', torch.cuda.get_device_name(0))
  else:   
      device = torch.device("cpu")
      print('No GPU available, using the CPU instead.')
  return device

device = set_device()

print(tf.__version__, tf.version.VERSION)
print(tf.version.GIT_VERSION)
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
print(tf.config.list_physical_devices('GPU'))
print()

print(f"{torch.__version__}")
print(f"{tf.__version__}")
print(f"cuda version {torch.version.cuda}")
print(f"cudnn version {torch.backends.cudnn.version()}")
print(f"python version {sys.version}")
print()

print(tf.__version__, keras.__version__)
print()

x = torch.rand(5, 3)
x = x.to(device)
print("!!!"*10)
print(a)

运行日志

2022-09-16 12:28:46.227160: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cudart64_110.dll
Using TensorFlow backend.
检测到1个可用GPU。
将使用GPU:NVIDIA GeForce GTX 960
2.4.0 2.4.0
v2.4.0-rc4-71-g582c8d236cb
2022-09-16 12:28:49.010094: I tensorflow/compiler/jit/xla_cpu_device.cc:41] 未创建XLA设备,未设置tf_xla_enable_xla_devices
2022-09-16 12:28:49.010333: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 nvcuda.dll
2022-09-16 12:28:49.011137: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] 发现设备0,属性如下:
pciBusID: 0000:01:00.0 名称: NVIDIA GeForce GTX 960 计算能力: 5.2
核心时钟: 1.2405GHz 核心数: 8 设备内存: 2.00GiB 设备内存带宽: 104.46GiB/s
2022-09-16 12:28:49.011790: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cudart64_110.dll
2022-09-16 12:28:49.025746: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cublas64_11.dll
2022-09-16 12:28:49.062736: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cublasLt64_11.dll
2022-09-16 12:28:49.088301: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cufft64_10.dll
2022-09-16 12:28:49.135863: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 curand64_10.dll
2022-09-16 12:28:49.137370: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cusolver64_10.dll
2022-09-16 12:28:49.143520: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cusparse64_11.dll
2022-09-16 12:28:49.145547: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 成功打开动态链接库 cudnn64_8.dll
2022-09-16 12:28:49.145885: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] 添加可见GPU设备: 0
可用GPU数量:  1
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

1.5.1+cu101
2.4.0
cuda版本 10.1
cudnn版本 7604
python版本 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]

2.4.0 2.4.0

内容的提问来源于stack exchange,提问作者YoungChae

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 11:10:33