25
Nov
0

[GPU] Install Cuda Opencl on Ubuntu

The steps to install cuda, opencl for nvidia gpu on ubuntu.

Keep default directories.

Download what you need from NVidia website:
http://developer.nvidia.com/cuda-downloads

Take:
“CUDA Toolkit for Ubuntu Linux 10.10″ (gpucomputingsdk_4.0.17_linux)
“GPU Computing SDK – complete package including all code samples” (cudatoolkit_4.0.17_linux_32_ubuntu10.10.run)
And if you want (not recommended):
“Developer Drivers for Linux” (devdriver_4.0_linux_32_270.41.19.run)

Install NVidia Driver

I recommend not to install Official NVidia Driver!!
(I did the first time and had a lot of problems!)
Use the safest install:

sudo apt-get install linux-headers-generic
sudo apt-get install nvidia-current
sudo nvidia-xconfig

If you need to remove bad drivers:

sudo apt-get remove --purge nvidia-current

Anyway, if you prefer you can install official nvidia package:

sudo /etc/init.d/gdm stop
sudo sh devdriver_4.0_linux_32_270.41.19.run
reboot

Install SDK

SDK has to be downloaded from the NVidia offical website.

Run the downloaded package:

sudo sh cudatoolkit_4.0.17_linux_32_ubuntu10.10.run

Then change your path and log dirs:

gedit ~/.bashrc

And paste:

# opencl
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib
export PATH=$PATH:/usr/local/cuda/lib:/usr/local/cuda/bin

(note, in case of 32bits you do not need /usr/local/cuda/lib64)

Restart your terminal or tape:

source ~/.bashrc

Install Examples

Examples have to be downloaded from the NVidia offical website.

sudo sh gpucomputingsdk_4.0.17_linux

I need to install some dependencies:

sudo apt-get install libxmu-dev libxmu6
sudo apt-get install freeglut3-dev

Then compile OpenCl examples (remplace user name with yours):

cd ~
sudo chown -R “user name” NVIDIA_GPU_Computing_SDK
sudo chmod -R 777 NVIDIA_GPU_Computing_SDK
cd NVIDIA_GPU_Computing_SDK
cd OpenCL
make

Run examples in (for example run oclNbody)

cd ~/NVIDIA_GPU_Computing_SDK/OpenCL/bin/linux/release
./oclNbody

References

http://vgerscorner.wordpress.com/2010/10/24/opencl-ubuntu-install-guide/

http://forums.nvidia.com/index.php?showtopic=87692h2

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.

Comments are closed.

Celadon theme by the Themes Boutique