Ubuntu11.10 install CUDA4.0

Source: Internet
Author: User
Tags cuda toolkit
Finally, we installed cuda4.0 in Ubuntu11.04. The CUDA Toolkit provided by the Nvidia official website only supports Ubuntu11.10. Normally, it cannot be installed in Ubuntu11.04, after reading some online materials and adding some practices, we have installed cuda4.0 and can run properly. Next we will record my installation process: first declare my computer configuration: CPU: intelcoreP8600 memory: 2*2 GB graphics card: NvidiaQuadr

Finally, we installed cuda4.0 in Ubuntu 11.04. The CUDA Toolkit provided by the Nvidia official website only supports Ubuntu 11.10. Normally, it cannot be installed in Ubuntu 11.04, later, after reading some online materials and adding practices, cuda4.0 has been installed and can run properly. The following is a record of my installation process:

First declare My Computer Configuration:
CPU: Intel core P8600
Memory: 2*2 GB
Graphics: Nvidia Quadro NVS 160 M
Hard Disk: 250 GB 7200 RPM
System: windows7-32bit; RedHat CentOS5.6-64bit; Ubuntu 11.04-32bit

As we already know that cuda4.0 cannot be installed normally in Ubuntu 11.04 before installation, refer.

1. Download and install CUDA 4.0.

Download CUDA Toolkit for Ubuntu Linux 10.10, CUDA Tools SDK, and GPU Computing SDK code samples from the NVIDIA website.

After downloading, install CUDA Toolkit for Ubuntu Linux 10.10. You need to run the following command to install CUDA Toolkit for Ubuntu Linux 11.04:

Chmod + x cudatoolkit_4.0.17_linux_32_ubuntu10.10.run
Sudo./cudatoolkit_4.0.17_linux_32_ubuntu10.10.run

Note that the name of the above toolkit must be the same as the name of the downloaded toolkit. The file names of different system versions are slightly different.

The default Path is installed in the/usr/local/cuda directory. It is recommended that you install it according to its preset Path. After installation, you must set the Path of the Library in two ways, one is to change the LD_LIBRARY_PATH environment variable:
Open the. bashrc file in the user name directory. You can use the vi command or the gedit command to edit it. I prefer the latter and add two lines at the end:
Export PATH =/usr/local/cuda/bin: $ PATH
Export LD_LIBRARY_PATH =/usr/local/cuda/lib: $ LD_LIBRARY_PATH
If it is a 64-bit system, you need to change the lib of the previous line to lib64, and then save
Another method is to add it directly to/etc/ld. so. conf. d:
Sudo echo "/usr/local/cuda/lib">/etc/ld. so. conf. d/cuda-40.conf
Sudo ldconfig
For a 64-bit system, change lib to lib64.
Set PATH again:
Echo 'export PATH = $ PATH:/usr/local/cuda/bin'> ~ /. Bashrc
Install CUDA Tools SDK:
Chmod + x cudatools_4.0.17_linux_32.run
Sudo./cudatools_4.0.17_linux_32.run
It is installed in the/usr/local/cuda/CUDAToolsSDK directory by default.
Install GPU Computing SDK code samples:
Chmod + x gpucomputingsdk_4.0.17_linux.run
./Gpucomputingsdk_4.0.17_linux.run
It is installed on your account by default ~ In the/NVIDIA_GPU_Computing_SDK directory, set the CUDA installation path: Enter CUDA install path (default/usr/local/cuda ):
If CUDA is installed according to the preset path, no change is required here.
Set GCC compiler
CUDA 4.0 currently only supports gcc 4.4, if only installed gcc 4.5, but also installed gcc 4.4 to compile: sudo apt-get install gcc-4.4
Then let the gcc 4.4 be used during compilation, one way is to change the system/usr/bin/gcc to/usr/bin/gcc-4.4, /usr/bin/g ++ is also connected to/usr/bin/g ++-4.4, or update-alternative:
Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.5 150
Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.4 100
Sudo update-alternatives -- install/usr/bin/g ++-4.5 150
Sudo update-alternatives -- install/usr/bin/g ++-4.4 100
Use update-alternatives to select gcc 4.4:
Sudo update-alternatives -- config gcc
Select gcc-4.4 after execution, and then select version 4.4g ++:
Sudo update-alternatives -- config g ++
Select g ++-4.4
If you do not want to modify the settings of the entire system, you can create one by yourself ~ /Bin directory, then establish the gcc-4.4 and g ++-4.4 link, and then add this PATH to your PATH, so that it will not affect other programs:
Mkdir ~ /Bin
Ln-s/usr/bin/gcc-4.4 ~ /Bin/gcc
Ln-s/usr/bin/g ++-4.4 ~ /Bin/g ++
Run the following command before compiling the CUDA program:
Export PATH = ~ /Bin: $ PATH
In this way, you do not need to change the settings of other programs in the system.
Compile GPU Computing SDK code samples
Next, compile the GPU Computing SDK code samples:
Cd ~ /NVIDIA_GPU_Computing_SDK
Make

Related Article

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.