Created
June 27, 2018 09:54
-
-
Save Wummer/29c32c48342130e20ca311260708b6fa to your computer and use it in GitHub Desktop.
Bash script that binds anacoinda environment to a CUDA version. Requires the system environments ORIGINAL_LD_LIBRARY_PATH and LD_LIBRARY_PATH
This file contains 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
#!/bin/bash | |
ENV=$1 | |
CUDA=$2 | |
# Create activation script | |
mkdir -p ~/anaconda3/envs/"$ENV"/etc/conda/activate.d | |
echo 'ORIGINAL_LD_LIBRARY_PATH='"$LD_LIBRARY_PATH" > ~/anaconda3/envs/$ENV/etc/conda/activate.d/activate.sh | |
echo 'export LD_LIBRARY_PATH=/usr/local/'"$CUDA"'/lib64' >> ~/anaconda3/envs/$ENV/etc/conda/activate.d/activate.sh | |
chmod +x ~/anaconda3/envs/"$ENV"/etc/conda/activate.d/activate.sh | |
#Create deactivation script | |
mkdir -p ~/anaconda3/envs/"$ENV"/etc/conda/deactivate.d | |
echo 'export LD_LIBRARY_PATH='"$ORIGINAL_LD_LIBRARY_PATH" > ~/anaconda3/envs/"$ENV"/etc/conda/deactivate.d/deactivate.sh | |
echo 'unset ORIGINAL_LD_LIBRARY_PATH' >> ~/anaconda3/envs/"$ENV"/etc/conda/deactivate.d/deactivate.sh | |
chmod +x ~/anaconda3/envs/"$ENV"/etc/conda/deactivate.d/deactivate.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment