TensorFlow 不使用 GPU,即使它检测到了它

TensorFlow 不使用 GPU,即使它检测到了它

在执行我的 tensorflow 1.15 python 代码时,我注意到它正在检测我的 GPU:

2021-11-09 13:52:56.890952: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2021-11-09 13:52:56.891239: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2021-11-09 13:52:56.891526: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2021-11-09 13:52:56.891841: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2021-11-09 13:52:56.892128: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2021-11-09 13:52:56.892418: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2021-11-09 13:52:56.892707: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-11-09 13:52:56.893042: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2021-11-09 13:53:04.263485: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-11-09 13:53:04.263803: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 
2021-11-09 13:53:04.263989: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N 
2021-11-09 13:53:04.293081: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6311 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 2060 SUPER, pci bus id: 0000:01:00.0, compute capability: 7.5)
2021-11-09 14:08:32.294865: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: NVIDIA GeForce RTX 2060 SUPER major: 7 minor: 5 memoryClockRate(GHz): 1.68
pciBusID: 0000:01:00.0

但是当我进入任务管理器时,我注意到执行时没有使用 GPU:

我的任务管理器在执行代码时:

执行代码时如何使用 GPU 而不是 CPU 来加速 exe,因为它花费了太多时间?

答案1

该图中的 CUDA 图表显示 89%,并且您正在使用 6GB 的 GPU RAM。

在此处输入图片描述

它肯定使用了 GPU,其他图表显然显示的数字较低,因为你没有做 3D 的东西。

如果您现在需要它运行得更快,那么您可能需要更好的 GPU。

相关内容