For more information, join the team subscribe to the mailing list 
at the bottom of the Launchpad page

    http://launchpad.net/~hybrid-graphics-linux 

Please join this team if you are new by clicking on the "Join 
Team" link at the right of the Launchpad page. It's important to 
have as many users in the community as possible to request for 
appropriate support.

Friday 11 June 2010

First steps with CUDA with Ubuntu 10.04 @ http://nsaunders.wordpress.com

Reposting from nsaunders blog:
First cautious steps with CUDA | What You’re Doing Is Rather Desperate









I recently obtained an account on our GPU cluster,
so I thought I should get my head around some of the technology that
drives GPU computing.

Put simply, GPUs can be used to perform calculations and since there are
many processors on a GPU, this can lead to quite substantial speed
increases as compared with CPUs. NVIDIA are
leading the way and they provide libraries and
software tools
for people interested in this field.

Development is typically performed using C, C++ or Fortran. I’m not a
compiled languages guy – I could just about manage a hello world
in C – so I’m relying on tools built by other people, such as R
gputools
.

Step 1 is to download and install the required libraries, toolkit and
possibly, drivers. I ran into a couple of minor problems on my machine,
so I thought I’d document them here.



Specifications

I run Ubuntu 10.04 on a 64-bit machine with a quad-core AMD Phenom II X4
955 Processor and a GeForce 9600 GT nVidia 512 MB card. The issues
documented here relate largely to Ubuntu 10.04.

Install the CUDA toolkit

This is reasonably straightforward. Note that the latest version of the
toolkit is for Ubuntu 9.04.


2chmod +x cudatoolkit_3.0_linux_64_ubuntu9.04.run
3sudo ./cudatoolkit_3.0_linux_64_ubuntu9.04.run

The installer asks where you would like to install the toolkit. I
chose /opt/cuda, over the default /usr/local/cuda. You then add
/opt/cuda/bin to your PATH and /opt/cuda/lib64 to LD_LIBRARY_PATH.
There are several ways to achieve this; I like to edit ~/.profile:


1# CUDA
2if [ -d "/opt/cuda/bin" ] ; then
3    PATH="/opt/cuda/bin:$PATH"
4    LD_LIBRARY_PATH="/opt/cuda/lib64:$LD_LIBRARY_PATH"
5fi

Download and unpack the SDK

This is also quite easy.


2chmod +x gpucomputingsdk_3.0_linux.run
3./gpucomputingsdk_3.0_linux.run

This simply unpacks the SDK to the default destination of
~/NVIDIA_GPU_Computing_SDK.


Fix up issues with compilation

In theory, the next step is to cd to
~/NVIDIA_GPU_Computing_SDK/C, type “make” and watch the sample
applications compile. There are a couple of problems with Ubuntu 10.04.

First, the version of GCC in the distribution is 4.4.3, whereas the SDK
requires, at most, 4.3.x. We need to install gcc-4.3:


1sudo apt-get install gcc-4.3

Next, we have to tell the SDK which GCC to use. Open up
~/NVIDIA_GPU_Computing_SDK/C/common/common.mk in a text editor and:


1# look for this line
2# NVCCFLAGS       :=
3# and change it to this
4NVCCFLAGS       :=
--compiler-bindir=/usr/bin/gcc-4.3

At this point, make still failed with errors related to
libraries. Ubuntu 10.04 has an up-to-date version of the NVIDIA video
driver, so there should be no need to update it. However, check whether
your system has libxi-dev, libxmu-dev and libglut3-dev
and install them if required.

My final make error was “unable to find -lcuda”. On my system,
it lives in /usr/lib/nvidia-current/libcuda.so. A temporary symbolic
link to /usr/lib did the trick:


1sudo ln -sf /usr/lib/nvidia-current/libcuda.so /usr/lib/

Finally, make works and creates 68 executables in the
directory ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release. If everything
went well, you can now enjoy a fast rendering of a smoke cloud, like
the one in the video at the top of this post, by running smokeParticles.


Next step – figuring out how to do something useful and
bioinformatics-related with this new toy.


I used several very helpful blog posts by other people to
troubleshoot these issues. Unfortunately, I don’t have the links with
me right now, so I’ll update this post later in the day.