Install Nvidia Driver and CUDA Toolkit on CentOS 6

Source: Internet
Author: User
Tags cuda toolkit

Install Nvidia Driver and CUDA Toolkit on CentOS 6 Posted on May 6, 2012

(Update: have posted a MUCH simpler method of driver install. Steps for CUDA toolkit install have to be followed as given in this post, I. e., bulleted step #10-19)

Although the topic has been addressed succinctly in a CentOS forum post, there are certain things like plymouth uth configuration post Nvidia driver install, etc. which I felt needed to be jotted down for reference. so, here we go describing the Nvidia CUDA toolkit installation on a CentOS system:

  • Download the appropriate toolkit, driver and SDK from Nvidia's website.
  • RHEL, and its derivatives come with the open source Nvidia driver callednouveau. before installing Nvidia drivers, we need to ensure nouveau drivers dont get loaded. for this, append the following in the line starting with 'kernel 'in the file/etc/boot/grub. conf:

Rdblacklist = nouveau. modeset = 0

  • Install the Development Tools and Development Libraries group packages, and a few extra packages listed below:

Sudo yum groupinstall 'development Tools ''' Development libraries'

Sudo yum install kernel-devel gcc-c ++ freeglut-devel libX11-devel mesa-libGLU-devel libXmu-devel libXi-devel gcc * compat-glibc * compat-lib *

  • Restart the system. upon restart, you'll see that the resolution of the display wowould have gone for a toss. thats due to blacklisting the nouveau driver, and is a sign that we are on track! Open terminal and type the following to goto non-GUI mode (called, runlevel 3 ):

Sudo init 3

  • Above command takes us to text mode. Change directory to/usr/src/kernels/and note down the complete path of the kernel folder present. In our scenario, it shows up:

/Usr/src/kernels/2.6.32-220.13.1.el6.x86 _ 64/

  • Change directory to the folder containing the downloaded files from Nvidia's website (say ~ /Downloads). Mark the 3 downloaded files as executables:

Cd ~ /Downloads

Chmod a + x NV *; chmod a + x cuda *; chmod a + x gpu *

  • Now finally, we are ready to run the installer. First is the Nvidia Driver install:

Sudo sh NVIDIA-Linux-x86_64-295.20.run-kernel-source-path =/usr/src/kernels/2.6.32-220.13.1.el6.x86 _ 64/

  • NOTE: There's a double minus sign before the word kernel above. During the above install, accept the licence agreement shown. Reboot upon completion:

Sudo reboot

  • You'll notice that the GUI resolution is back to normal, indicating successful Nvidia driver install. Now, cudatoolkit has to be installed.
  • Open terminal and change directory ~ /Downloads. Run the cudatoolkit *. run file:

Sudo sh cudatoolkit_4.0.17_linux_64_rhel6.0.run

  • During the install, you'll be asked to supply installation path. Enter the default path itself (/usr/local/cuda ).
  • Once completed, few more steps are needed, like adding/usr/local/cuda to default path environment variable, etc .:

Sudo nano/etc/ld. so. conf. d/cuda. conf

  • Add the following lines to the above created file:

/Usr/local/cuda/lib64
/Usr/local/cuda/lib

  • Save the above file by pressing Ctrl + x, followed by 'y' and pressing Enter. Now run:

Sudo ldconfig

  • For adding cuda install path to enviroment path variable, edit ~ /. Bash_profile file using a text editor (say, nano ~ /. Bash_profile ):

Export CUDA_INSTALL_PATH =/usr/local/cuda
Export PATH = ($ PATH:/usr/local/cuda/bin)
Export LD_LIBRARY_PATH =/usr/local/cuda/lib64
Export PATH = ($ PATH:/usr/local/cuda/lib)

  • Finally, gpucomputingsdk needs to be installed. For that:

Sh gpucomputingsdk_4.0.17_linux.run

  • During the install, you'll be asked for install path. Keep in mind that the sdk can take around 400-500 MB. Say, we install it ~ /Documents/NVIDIA_GPU_Computing_SDK.
  • Once done, we need to compile the files in the SDK:

Cd ~ /Documents/NVIDIA_GPU_Computing_SDK/C/

Make

  • To check whether everything is working fine, we'll run the deviceQuery file, provided by the SDK just installed:

Cd ~ /Documents/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/

./DeviceQuery

  • You shoshould see something similar to what is shown at this link.

Congrats for successfully installing the Nvidia driver and the cudatoolkit on your CentOS system. I know, things shoshould be much simpler. I wish someday Nvidia open-sources their drivers and CUDA toolkit to make things simpler for Linux enthusiasts. all that is left now, is to fix the uugly white-blue scrolling bar that shows up instead of the beautiful Plymouth at boot.

  • Reboot system. At the grub prompt, press 'E' against the first item on the grub menu to edit its kernel arguments (this mode is called kernel edit mode ).
  • Out the three lines being shown (starting with: root; kernel; initrd), scroll to kernel line and press 'E' again. Type in the following at the end of that line:

Vga = ask

  • Press Enter after typing the above and press 'B '. you'll see a tabulated list of keywords against several screen-resolutions. note down the number being shown against the most appropriate screen resolution. say, the number is 361. now, reboot system. again, enter the kernel edit mode described in the previous two list items. the only difference being that instead of vga = ask, enter vga = 0 × 361. now pr Ess 'B' and you'll see the beautiful Plymouth back in its glory!
  • To make this change permanent, open terminal and open/boot/grub. conf as sudo (sudo nano/boot/grub. conf ).
  • Find the line saying 'kernel 'against your most recent kernel version and add vga = 0 × 361. Save the file (Ctrl + x, y, Enter)

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.