Issue with installing GPU

Hi,
I have a Geforce RTX2070, I am quite confused regarding cuda, cudnn and tensorflow versions, I have tried installing quite a few times using instructions from various websites. I ran this sample code below to check if installation is successful. but i didn’t get the mentioned output so I guess the installation didn’t work. I have currently re-installed ubuntu 18.04, and I wish to do it right this time. can anyone please help with the installation and verifying the installation.

Thank you.
Regards,
Akshay.

sample code to verify:
import tensorflow as tfwith tf.device(’/gpu:0’):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name=‘a’)
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name=‘b’)
c = tf.matmul(a, b)

with tf.Session() as sess:
print (sess.run©)

Hi,
I’m not sure how much help I can because I am running 20.04 LTS, but have you tried:

nvidia-smi

I noticed when I was using 18.04 latest update in AWS that something didn’t get loaded right with drivers and I had to revert to 16.04.

I didn’t notice the issue until I tried the nvidia-smi command and noticed there wasn’t anything there.

nvidia-smi shows gpu is installed but tensorflow is not using it when I as it to using
with tf.session() as sess: