CUDA 10.1, Tensorflow 2.4.0, Cudnn 7.6 and GPU available but, GPU not working

Viewed 38

GPU available, but GPU not working

  • GPU available
  • NVIDIA GeForce GTX 960
  • tensorflow, keras : 2.4.0 version
  • torch : 1.5.1+cu101 verison
  • cuda : 10.1 version
  • cudnn : 7.60 version
  • python : 3.76 version

and tensorflow-gpu : 2.4.0 version

I changed to cudnn64_7.dll to cudnn64_8.dll

GPU not working

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] Successfully opened dynamic library cudart64_110.dll
Using TensorFlow backend.
There are 1 GPU(s) available.
We will use the 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] Not creating XLA devices, tf_xla_enable_xla_devices not set
2022-09-16 12:28:49.010333: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2022-09-16 12:28:49.011137: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 960 computeCapability: 5.2
coreClock: 1.2405GHz coreCount: 8 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 104.46GiB/s
2022-09-16 12:28:49.011790: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2022-09-16 12:28:49.025746: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2022-09-16 12:28:49.062736: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2022-09-16 12:28:49.088301: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2022-09-16 12:28:49.135863: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2022-09-16 12:28:49.137370: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2022-09-16 12:28:49.143520: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2022-09-16 12:28:49.145547: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2022-09-16 12:28:49.145885: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
Num GPUs Available:  1
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

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

2.4.0 2.4.0

0 Answers
Related