即使检测到 GPU,tensorflow 也不使用 GPU

Bay*_*ina -1 gpu python

在执行我的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
Run Code Online (Sandbox Code Playgroud)

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

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

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

Mok*_*bai 5

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

在此输入图像描述

它肯定正在使用 GPU,其他图表显然显示较低的数字,因为您没有执行 3D 操作。

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