-
Where I found the resolution
- TF 2.16.1 Fails to work with GPUs
- Solution proposed by "sh-shahrokhi", improved by "ChristofKaufmann"
- See specially Comment by COntributor
- Related Issues
- GPU not detected on WSL2, where I have post some comments
- Tensorflow WSL GPU CUDA recognition issue RTX3090
- Once gain: tf.2.16.1 fails to recognize GPUs
- Other mention on social media
- TF 2.16.1 Fails to work with GPUs
-
Exact solution
- Temporary fix (after activating environment in which Tensorflow 2.16.1 is installed)
export NVIDIA_DIR=$(dirname $(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))) export LD_LIBRARY_PATH=$(echo ${NVIDIA_DIR}/*/lib/ | sed -r 's/\s+/:/g')${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- Automating the variable set/unset process with Anaconda (one-time setup)
- Activate your environement in which TF 2.16.1 is installed
- Two files to be created in "anaconda3/envs/<ENV_NAME>/etc/conda"
- anaconda3/envs/<ENV_NAME>/etc/conda/activate.d/env_vars.sh
#!/bin/sh export NVIDIA_DIR=$(dirname $(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))) export LD_LIBRARY_PATH=$(echo ${NVIDIA_DIR}/*/lib/ | sed -r 's/\s+/:/g')${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- anaconda3/envs/<ENV_NAME>/etc/conda/deactivate.d/env_vars.sh
#!/bin/sh unset NVIDIA_DIR unset LD_LIBRARY_PATH
- Official documentation to do this via conda.io
- Stack-overflow question where I got this Set environment vars when activating conda env
- Temporary fix (after activating environment in which Tensorflow 2.16.1 is installed)
-
What else helped me
Last active
March 22, 2024 22:35
-
-
Save chaudharyachint08/130d150c4a17c5558b99882e4bb93491 to your computer and use it in GitHub Desktop.
Provides fix for using GPU on TF 2.16.1 which was release before proper testing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment