Created
June 12, 2024 22:02
-
-
Save mauro-belgiovine/6dd9b94ec1ff67784c8625bdab6e56f0 to your computer and use it in GitHub Desktop.
This bash script exports all the CUDA libraries in Ubuntu/Linux environment for correct visibility of GPU devices. This is especially useful when using Tensorflow (> 3.15) in a Conda environment, which is not a default library location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HOW TO RUN IN TERMINAL: | |
# $ source tf_env_variables.sh | |
NVIDIA_DIR=$(dirname $(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))) | |
for dir in $NVIDIA_DIR/*; do | |
if [ -d "$dir/lib" ]; then | |
export LD_LIBRARY_PATH="$dir/lib:$LD_LIBRARY_PATH" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment