Tensorflow finds GPU but doesn't use GPU

Question:

Recently bought a 3060 and trying to make it work with tensorflow but it doesn’t seem to work.
Although the GPU can be detected, whenever I train mask_rcnn_coco.h5 it takes so much time that I left it for like 30 minutes and not even 1 epoch was completed. Any ideas how to fix this?

I used these libraries

pip install tensorflow==2.3
pip install tensorflow--gpu==2.3
pip install imgaug
pip install pixellib==0.5.2
pip install labelme2coco==0.1.0
pip install Pillow==8.0

I installed CUDA 10.1 and cuDNN 7.6.

Session

[I 20:24:21.746 NotebookApp] Kernel started: 0b6d1f66-f4ff-442f-bf6f-59bb5fe2ff03, name: python3
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control
[IPKernelApp] WARNING | No such comm: 5db9fb8e-9956-4081-9c1d-c8e445ca997f
2022-10-12 20:24:40.214889: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
[W 20:24:43.199 NotebookApp] 404 GET /api/kernels/8eba5c9e-587f-4cd0-86db-7d5987a61f9b/channels?session_id=010d8cfef1df42cd835e128121663487 (::1): Kernel does not exist: 8eba5c9e-587f-4cd0-86db-7d5987a61f9b
[W 20:24:43.200 NotebookApp] 404 GET /api/kernels/8eba5c9e-587f-4cd0-86db-7d5987a61f9b/channels?session_id=010d8cfef1df42cd835e128121663487 (::1) 3.000000ms referer=None
2022-10-12 20:24:48.841665: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2022-10-12 20:24:57.703980: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce RTX 3060 computeCapability: 8.6
coreClock: 1.777GHz coreCount: 28 deviceMemorySize: 12.00GiB deviceMemoryBandwidth: 335.32GiB/s
2022-10-12 20:24:57.704187: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2022-10-12 20:24:57.713341: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2022-10-12 20:24:57.718274: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2022-10-12 20:24:57.720302: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2022-10-12 20:24:57.726087: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2022-10-12 20:24:57.729356: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2022-10-12 20:24:58.054469: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2022-10-12 20:24:58.054702: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2022-10-12 20:25:01.424735: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-10-12 20:25:01.432727: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1fcea173490 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-10-12 20:25:01.432877: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device 
(0): Host, Default Version
2022-10-12 20:25:01.433675: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce RTX 3060 computeCapability: 8.6
coreClock: 1.777GHz coreCount: 28 deviceMemorySize: 12.00GiB deviceMemoryBandwidth: 335.32GiB/s
import tensorflow as tf
tf.config.list_physical_devices('GPU')
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
Asked By: Romeo

||

Answers:

I have managed to solve my problem. As it turns out, the GPU RTX 3060 is based on Ampere Architecture which means any version of CUDA below 11.x would work. So I used tensorflow-2.10.0, CUDA 11.2, and cuDNN 11.2.

Answered By: Romeo
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.