Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorFlow 2.12.0 WSL2 GPU support #60101

Closed
tg2k opened this issue Mar 24, 2023 · 16 comments
Closed

TensorFlow 2.12.0 WSL2 GPU support #60101

tg2k opened this issue Mar 24, 2023 · 16 comments
Assignees
Labels
TF 2.12 For issues related to Tensorflow 2.12 type:bug Bug type:build/install Build and install issues wsl2 Windows Subsystem for Linux

Comments

@tg2k
Copy link

tg2k commented Mar 24, 2023

Click to expand!

Issue Type

Bug

Have you reproduced the bug with TF nightly?

No

Source

binary

Tensorflow Version

2.12.0

Custom Code

No

OS Platform and Distribution

Windows 11 + WSL2

Mobile device

No response

Python version

3.11

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

11.8/8.4.1.50

GPU model and memory

No response

Current Behaviour?

I had a TensorFlow 2.11 environment in WSL that works fine. It is installed using the conda-forge packages. For TensorFlow 2.12 I swapped to using the pip packages for tensorflow, keras, keras-tuner, tensorflow-hub, tensorflow-datasets, and tensorboard.

After installation the conda environment for 2.12 can't find the GPU anymore. Swapping back over to my 2.11 environment, it still finds it fine. Are there new instructions for GPU support in WSL2 as of TensorFlow 2.12.0?

Standalone code to reproduce the issue

gpus = tf.config.experimental.list_physical_devices('GPU')
print("GPUS: ", gpus)

Relevant log output

No response

@tiruk007
Copy link
Contributor

tiruk007 commented Mar 27, 2023

@tg2k
Sorry for the late reply, As per the documentation, TF v2.12.0 requires 8.6 cuDNN and 11.8 CUDA version.Could you please make sure to follow the instructions mentioned here and check the tested build configuration as well. Please let us know if it helps?
Thank you!

@tiruk007 tiruk007 added type:build/install Build and install issues wsl2 Windows Subsystem for Linux TF 2.12 For issues related to Tensorflow 2.12 stat:awaiting response Status - Awaiting response from author labels Mar 27, 2023
@cfields5
Copy link

@tiruk007 Having the same issue. CUDA 11.8 and cuDNN 8.6

@Adesoji1
Copy link

The issue you are experiencing could be due to TensorFlow 2.12 not being properly configured for GPU support in your new environment. When you install TensorFlow with pip, it doesn't automatically install the GPU version, which is tensorflow-gpu. Here's how to set up your environment to use TensorFlow with GPU support:
pip uninstall tensorflow
pip install tensorflow-gpu
but note that the latest version of tensorflow comes with the gpu installed already in the installation command pip install tensorflow and not pip install tensorflow-gpu. pip install tensorflow-gpu==2.10 and below could be installed like this

@github-actions
Copy link

github-actions bot commented Apr 8, 2023

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Apr 8, 2023
@Monah84
Copy link

Monah84 commented Apr 9, 2023

The issue is still unresolved; when doing pip install tensorFlow => it installs tensorflow_intel instead of the GPU, and tf.config.list_physical_devices('GPU') returns empty.

@Adesoji1
Copy link

@Monah84 i disagree with that, i have the lastest tensorflow with gpu by installing using pip install tensorflow as seen here .

Project description here
tensorflow-gpu has been removed. Please install tensorflow instead. The tensorflow package supports GPU accelerated operations via Nvidia CUDA. furthermore, i made this link to show you how to install cuda on WSL . what OS are you on?

@Monah84
Copy link

Monah84 commented Apr 10, 2023

@Adesoji1

So I have to use WSL? I am using Windows 11 + Nvidia RTX 5000. I installed cuda 11.8 + cudnn 8.6 + tensorflow 2.12 as stated on the TensorFlow website. But it is not working.

Note: it was working before using cuda 11.2 and cudnn 8.1 and tensorflow_gpu 2.10 normally. When I upgraded the version. tensorflow not seeing the GPU device.

@tg2k
Copy link
Author

tg2k commented Apr 19, 2023

@tiruk007 The short answer is this worked.

Long answer:

I had been running unintentionally with cudatoolkit>=11.2 and cudnn>=8.1.0. I've swapped to the cudatoolkit>=11.8.0 conda-forge package and the nvidia-cudnn-cu11>=8.6.0.163 pip package.

I noted that after running this, my /usr/lib/wsl/lib/libcuda* files got overwritten, which is a warning mentioned at NVidia's WSL User Guide . I re-ran their install instructions, to no apparent effect (same files present afterward). I also applied a Windows-side post-fix that is documented here.

At this point I restarted the WSL instance and went back into Jupyter notebooks and swapped between my TF 2.11 and TF 2.12 environments, and the behavior remained the same: TF 2.11 saw the GPUS, while TF 2.12 did not.

It turned out I missed the part in the TF WSL install guide where CUDNN_PATH and LD_LIBRARY_PATH get set. I had something alternative to this, which worked for TF 2.11, but does not work for TF 2.12. Once I got those lines into my env_vars.sh, it worked.

@google-ml-butler google-ml-butler bot removed stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author labels Apr 19, 2023
@tg2k tg2k closed this as completed Apr 19, 2023
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@tiruk007
Copy link
Contributor

@cfields5 @Monah84
Since the issue was closed, Could you please raise another request from here. It helps us to track and debug the issue in an effective way.

Thank you !

@cfields5
Copy link

@Adesoji1 there is no longer a separate tensorflow-gpu package. It's all packaged in tensorflow.

@Monah84 I just ended up using WSL and it worked like a charm. TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Since I have windows 11, I couldn't use archived versions of NVIDIA's software. Had to go with WSL. Honestly much easier than dealing with windows anyways.

@Adesoji1
Copy link

@cfields5 but note that the latest version of tensorflow comes with the gpu installed already in the installation command pip install tensorflow and not pip install tensorflow-gpu. did you see this earlier?

@Monah84
Copy link

Monah84 commented Apr 27, 2023

@Adesoji1 there is no longer a separate tensorflow-gpu package. It's all packaged in tensorflow.

@Monah84 I just ended up using WSL and it worked like a charm. TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Since I have windows 11, I couldn't use archived versions of NVIDIA's software. Had to go with WSL. Honestly much easier than dealing with windows anyways.

I do agree with you. Actually, I am using now the WSL and it is working perfectly as well, as you said. Even I got more benefits in this way. Some libraries are not available for windows and work with Linux systems now are available for me to use them.

Thank you for sharing your feedback

@ogahozy
Copy link

ogahozy commented Aug 8, 2023

Is the support upward compatible. I installed tensorflow 2.13.0 on wsl2-ubuntu but gpu was not found. Do i have to downgrade to 2.10

@Adesoji1
Copy link

Adesoji1 commented Aug 8, 2023

@ogahozy senior man, I am not sure yet about 2.13 but you can downgrade. Follow this tutorial to help you with the installation https://medium.com/@soji4u2c/how-to-install-the-nvidia-cuda-driver-12-0-toolkit-cudnn-8-8-1-3-on-wsl2-in-year-2023-23165024dc16

@ogahozy
Copy link

ogahozy commented Aug 8, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TF 2.12 For issues related to Tensorflow 2.12 type:bug Bug type:build/install Build and install issues wsl2 Windows Subsystem for Linux
Projects
None yet
Development

No branches or pull requests

6 participants