Install CUDA8.0 and CUDA7.0 under Ubuntu16.04

Source: Internet
Author: User

First of all, it can be explained that CUDA8.0 and CUDA7.0 can coexist under the ubuntu16.04 environment. I first installed the CUDA8.0, and then installed the CUDA7.0, installed CUDA8.0 found that installation CUDA7.0 has been unsuccessful, after the discovery is the default version of the 16.04 system GCC, g++ version is too high, so the back is installed gcc-4.8 , g++-4.8, which has multiple versions of GCC and g++ installed.

1. Install cuda-8.0

sudo dpkg-i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install Cuda

2. Configure Environment Variables

Export ld_library_path= "$LD _library_path:/usr/local/cuda/lib64"
export Cuda_home=/usr/local/cuda
Export Path= "$CUDA _home/bin: $PATH"

3. Installation of cuda-8.0 corresponding CUDNN v5.1

Tar xvzf cudnn-8.0-linux-x64-v5.1.tgz
mv Cuda cudnn-8.0-v5.1
sudo cp cudnn-8.0-v5.1/include/cudnn.h/usr/ Local/cuda-8.0/include
sudo cp cudnn-8.0-v5.1/lib64/libcudnn*/usr/local/cuda-8.0/lib64

To this cuda-8.0 and its corresponding CUDNN is finished.

4. Install multiple version Cuda

I first installed the CUDA8.0 after the CUDA7.0
Because the current system's GCC g++ are 5.4.0 for installation Cuda7.0 version is too high, so you need to install a lower version of GCC g++ 4.8
Originally/usr/bin in the catalogue
GCC soft connect to system default GCC-5.4.0
GCC-> gcc-5
g++ link to system default g++-5.4.0
g++-> g++-5
First install gcc-4.8 g++-4.8

sudo apt-get install-y gcc-4.8
sudo apt-get install-y g++-4.8
#现在需要把软连接到GCC -4.8 g++-4.8
sudo rm gcc 
Sud o rm g++
sudo ln-s gcc-4.8 gcc
sudo ln-s g++-4.8 g++

Then install the cuda-7.0 and the corresponding CUDNN

./cuda_7.0.28_linux.run
# for cuda7.0 install corresponding CUDNN cudnn-7.0-v4.0
tar xvzf cudnn-7.0-linux-x64-v4.0-prod.tgz 
mv Cuda cudnn-7.0-v4.0
sudo cp cudnn-7.0-v4.0/include/cudnn.h   /usr/local/cuda-7.0/include/
sudo cp cudnn-7.0-v4.0/lib64/libcudnn*  /usr/local/cuda-7.0/lib64/

Considerations During installation:
Do you accept the previously read EULA? (accept/decline/quit): Accept
You are are attempting to install on a unsupported configuration. Do your wish to continue? ((y) es/(n) o) [Default is no]: Y
Install NVIDIA accelerated Graphics Driver for linux-x86_64 346.46? ((y) es/(n) o/(q) uit): N
Do your want to install the OpenGL libraries? ((y) es/(n) o/(q) uit) [Default is yes]: n
Install the CUDA 7.0 Toolkit? ((y) es/(n) o/(q) uit): Y
Enter Toolkit Location [default is/usr/local/cuda-7.0]:
/usr/local/cuda-7.0 is not writable.
Do your wish to run the installation with ' sudo '? ((y) es/(n) o): Y
Please enter your password:
Do your want to install a symbolic link At/usr/local/cuda? ((y) es/(n) o/(q) uit): N
Install the CUDA 7.0 Samples? ((y) es/(n) o/(q) uit): Y
Enter CUDA Samples Location [default Is/home/wty]:
Installing the CUDA Toolkit in/usr/local/cuda-7.0 ...
Installing the CUDA Samples in/home/wty ...
Copying samples To/home/wty/nvidia_cuda-7.0_samples now ...
Finished copying samples.

You are should pay attention carefully to the prompts offered you during.
1. Select No when prompted to install the driver from the CUDA 7.5 runfile. Keep your CUDA 8 installed driver. It would work with CUDA 7.5
2. Select No when prompted to update the Symlink For/usr/local/cuda (unless your want to switch the default Config from CU DA 8 to CUDA 7.5)

When you are want to actually switch your machine behavior from CUDA 8 to CUDA 7.0, you'll need to modify the PATH and Ld_li Brary_path env variables accordingly.

If you previous CUDA 8 install is via Runfile installer, this should work. I Use this method regularly. If you are previous CUDA 8 install is via Package Manager method, I am I am the should still the work I don ' t but do tha T.

It ' s probably also possible to do side-by-side install using only Package Manager methods, but I don ' t have a set of InStr Uctions handy for that.

CUDNN Link:
Https://developer.nvidia.com/rdp/cudnn-archive

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.