Installation method of Cuda under Liunx

Source: Internet
Author: User

CUDA Installation Guide on Linux systems

Applicable operating system

Fedora 7,8,9,10

Redhat Enterprise 3.x,4.x,5.x

SUSE Linux Enterprise Desktop 10-sp1,10.2,11.0

OpenSUSE 10.1,10.2,10.3,11.0,11.1

Ubuntu 7.04, 7.10.,8.04,8.10,9.04

--------------------------------------------------------------------------------

Download and operating system matching

Driver, SDK, Tookit

Address: http://www.nvidia.com/object/cuda_get.html

--------------------------------------------------------------------------------

Setup (TESLA is used with non-NVIDIA graphics cards without the need to install the video driver)

--------------------------------------------------------------------------------

Install in terminal (do not enter Xwindow)

Install cuda2.1 under Linux as5.2 for example

1. Install CUDA operation driver

Command line execution: SH nvidia-linux-x86_64-180.22-pkg2.run

Follow the prompts to return to perform each step of the installation process

For information on how to install NVIDIA's Linux drivers, refer to the

NVIDIA accelerated Linux Driver Set README and installation Guide

Http://us.download.nvidia.com/XFree86/Linux-x86/1.0-9755/README/index.html

After installation, [Nvidia-xconfig-query-gpu-info] can be executed in terminal to view the installed NVIDIA GPU

See below for implementation results

2. Install NVIDIA CUDA toolkit

Command line execution: SH cudatoolkit_2.1_linux64_rhel5.2.run

The installer will ask you to enter the installation path or accept the default value, and it is recommended to install as root and use the default path (/usr/local).

After that we will replace the actual installation path with <CUDA_INSTALL_PATH>

Increase CUDA binary (NVCC) and function Path (libcuda.so) to path and LD_LIBRARY_PATH environment variables

After installation, you can perform [Nvidia-smi] to view the installed CUDA GPU

[Nvidia-smi] is a new tool for Nvidia that allows us to confirm whether the GPU installed in the machine is functioning properly CUDA

See below for implementation results

3. Install NVIDIA CUDA SDK

Execution at the command line: Shcuda-sdk-linux-2.10.1215.2015-3233425.run

Setup will require you to enter the installation path or accept the default, and the default installation path is the user's home directory (/NVIDIA_CUDA_SDK).

After that we will take the <SDK_INSTALL_PATH> instead of the actual installation path. In the Bash_profile, add the following lines in the home directory.

Path= $PATH: <cuda_install_path>/bin

Ld_library_path= $LD _library_path:<cuda_install_path>/lib64

Export PATH

Export Ld_library_path

Note <CUDA_INSTALL_PATH> Replace with actual path installed in the system

Then enable the configuration

source. bash_profile

4. Building the SDK Project sample program

CD <SDK_INSTALL_PATH>

Build:

-Release enter "make".

-Debug Enter ' Make Dbg=1 '.

-Emurelease Enter "Make Emu=1".

-Emudebug Enter ' Make Emu=1 dbg=1 '. Make

Libcutil This common tool used in <SDK_INSTALL_PATH> execute make create sample programs

Libcutil is provided for ease of use and is not part of the CUDA.

Attention:

Some examples of OpenGL used in make are compile errors about GL, due to the fact that there is no library for OpenGL installed, and a separate library to install GL is required.

Other examples should be compiled correctly.

You can directly execute make to compile directly into each of the examples under/root/nvidia_cuda_sdk/projects:

such as: Matrix multiply

Cd/root/nvidia_cuda_sdk/projects/matrixmul

Make

5. Examples of Implementation

The Devicequery in the sample program is that we get GPU information that we can perform CUDA operations on this machine.

Building an example program

CD <sdk_install_path>/projects/devicequery

Make

Then execute the sample program in <sdk_install_path>/bin/linux32/release/devicequery

Devicequery execution results are shown below

and perform release, Debug, emurelease or Emudebug, etc.

Its directory is located in/bin/linux32/[release|debug|emurelease|emudebug]



--------------------------------------------------------------------------------

to create your own program

--------------------------------------------------------------------------------

Using the CUDA SDK makes it easy to create new CUDA programs.

To replicate and modify the project "template" provided by the CUDA SDK to meet your needs

Steps are as follows

1. Copy the entire "template" project (this myproject represents the project you want to create)

CD <sdk_install_path>/projects

Cp-r Template <myproject>

2. Change the file name of the project to the name of the file you want

MV Template.cu MYPROJECT.CU

MV Template_kernel.cu MYPROJECT_KERNEL.CU

MV Template_gold.cpp Myproject_gold.cpp

3. Change the file name of the project contents to the file name you want

Edit Makefile and original files

Replace all "template" with "MyProject".

4. Compile

Make

5. Execute the new program in the following location

.. /.. /bin/linux32/release/myproject

The execution result should be "Test passed"

6. Finally change the program code to meet your operational needs can be

For this part please refer to CUDA programming Guide

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.