Anaconda miniconda env 마다 다른 CUDA version 사용하기 - jinwooklim/my-exp GitHub Wiki

Anaconda/miniconda 환경마다 다른 CUDA version 사용하기.

참조 : https://blog.kovalevskyi.com/multiple-version-of-cuda-libraries-on-the-same-machine-b9502d50ae77

  1. CUDA 설치하기.

    Ex) sudo sh cuda-9.1.run --silent --toolkit --toolkitpath=/usr/local/cuda-9.1

    --silent — this will force installer to do everything in a silent mode without any interactive prompt. Really useful for the automation

    --toolkit — install only the toolkit, majority of users probably indeed need only toolkit

    --toolkitpath — this is where all the magic starts, each cuda that we’re going to install needs to be installed in its own separate folder, in our example CUDA9 is installed in /usr/local/cuda-9.0, therefore CUDA8 will be installed in /usr/local/cuda-8, CUDA9.1 can go to /usr/local/cuda-9.1 , etc

  2. Anaconda env 에서 CUDA path linking 하기.

    activate.sh 파일 만들기.

    */<path to anaconda>/envs/<env name>/etc/conda/activate.d/* Ex) */home/ubuntu/anaconda3/envs/tf_cu90/etc/conda/activate.d/*

    mkdir -p ~/anaconda3/envs/tf_cu90/etc/conda/activate.d touch ~/anaconda3/envs/tf_cu90/etc/conda/activate.d/activate.sh vim ~/anaconda3/envs/tf_cu90/etc/conda/activate.d/activate.sh chmod +x ~/anaconda3/envs/tf_cu90/etc/conda/activate.d/activate.sh

    activate.sh 에 작성하기.

    #!/bin/sh ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/cuda-9.0/extras/CUPTI/lib64:/lib/nccl/cuda-9:$LD_LIBRARY_PATH

    deactivate.sh 파일 만들기.

    */<path to conda>/envs/<env name>/etc/conda/deactivate.d/*

    Ex) *~/anaconda3/envs/tf_cu90/etc/conda/deactivate.d/*

    mkdir -p ~/anaconda3/envs/tf_cu90/etc/conda/deactivate.d touch ~/anaconda3/envs/tf_cu90/etc/conda/deactivate.d/deactivate.sh vim ~/anaconda3/envs/tf_cu90/etc/conda/deactivate.d/deactivate.sh chmod +x ~/anaconda3/envs/tf_cu90/etc/conda/deactivate.d/deactivate.sh

    deactivate.sh 에 작성하기.

    #!/bin/sh

    export LD_LIBRARY_PATH=$ORIGINAL_LD_LIBRARY_PATH

    unset ORIGINAL_LD_LIBRARY_PATH

⚠️ **GitHub.com Fallback** ⚠️