Saturday, 3 October 2015

Installing CUDA on Ubuntu 12.x/14.x Distros

Hi All,

This has been a long time that I have not published articles.  I am trying to learn CUDA for Parallel programming architecture.

First few words about CUDA [a/c to my understanding]:

Compute Unified Device Architecture[CUDA] is technology developed by NVIDIA. The purpose of

CUDA is to let the processor for executing the programs/instructions in parallel manner. Simple !!

Now let's see most cumbersome task that we all are waiting for Install NVIDIA SDK on Ubuntu

To test are NVIDIA  drivers going to work fine for us,

first we will Install ubuntu as under windows installation.

Copy on desktop of ubuntu.

Log in as root

run update for ubuntu
# apt-get update

To install compiler
# apt-get install build-essential

To switch to Text,


Enter username and password

login as root.

stop GUI service

# service lightdm stop

# chmod +777

# ./

if absolute path demanded by NVIDIA, press y

and enter for /home/user option.

It will say installation skipped

then reboot with

# reboot -h

Now, again with GUI do following steps:

Login as root.

Switch to text console


login as root

# service lightdm stop


now reboot system manually

Now after system gets booted, enter two commands as general user:

 export PATH=/usr/local/cuda-6.5/bin:$PATH
 export LD_LIBRARY=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH

Now we are ready to run our hello world program for NVIDIA CUDA.

As the name suggests. the extension of our program will be .cu

So copy-paste "hello world" from this link in gedit

Save to desired directory.

Now time to compile and run.

compile with:  nvcc -cuda
run with:      ./a.out

You output will be:

Hello World !!

Ta..Da... CUDA has been installed successfully.

1 comment: