I followed the instructions on tensorflow.org to install tensorflow on WSL2. It seems to work. This is by running the GPU verification code on the website. However, when I run the same code in Visual Studio Code. It couldn’t find the GPU. On VSC, I did pick the same kernel.
Let me show step by step. On WSL2, the verification code does show GPU:
(tf) dlin@SCL-DLIN:~$ python3 -c “import tensorflow as tf; print(tf.config.list_physical_devices(‘GPU’))”
2024-04-04 20:21:11.437247: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0
.
2024-04-04 20:21:11.463715: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-04-04 20:21:11.843862: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2024-04-04 20:21:12.267983: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-04-04 20:21:12.292401: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-04-04 20:21:12.292469: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:984] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
[PhysicalDevice(name=‘/physical_device:GPU:0’, device_type=‘GPU’)]
However, on VSC, it shows the following messages:
What do I do to make the verification code run on VSC? Thanks.