'Keras-GPU is detected in conda environment but not in ipykernel in VSCode

So, I have a keras model to be trained GPU and the setting for the same via keras/tensorflow support works fine. When I verify the GPU support from keras in the bash of Linux with conda environment activated, the the GPUs are detected as shown in the commandline snippet below

(thesis) njoshi@zzzzz: python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
2022-05-22 18:41:16.328409: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-05-22 18:41:16.359273: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-05-22 18:41:16.359985: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')]

Although the same environment with the GPUs are not detected in jupyter notebook of VSCode. enter image description here

There are two perfectly working GPUs working as shown in the pic below. enter image description here

Please help me troubleshoot the actual problem which I do not seem to understand.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source