Category Archives: Development

NVIDIA CUDA on Ubuntu Karmic Koala and GCC 4.4

NVIDIA’s currently released version of CUDA does not directly with Ubuntu 9.10 which uses GCC 4.4 as the default compiler. However, it is quite easy to make it work and the following guide goes through the entire installation process in some detail.

I use the 64bit version of CUDA, go here to get it:
(I selected Linux 64 bit and  Ubuntu 9.04 .)

This lets you download the CUDA Drivers, the CUDA Toolkit and the CUDA SDK, and you will end up with three files:

Installing the NVIDIA driver:

Cuda needs at least version 190 of the linux driver


Uninstall existing NVIDIA drivers and nvidia-glx. (Use gui or aptitude).


Install driver:

Quit x (log out of your desktop, go to a virtual terminal (CTRL+ALT+F1), login, run

$ sudo service gdm stop



$ sudo

to install the driver, follow the prompts.
Say yes to install 32 bit compatibility libraries.
If you want you can let the installer overwrite the Xorg configuration file.


Reboot and log back in.



 $ nvidia-settings

to verify that your driver version is at least 190.18. Look for the driver version in the window:

The 190.xx NVIDIA Driver for use with CUDA.

Installing the CUDA Toolkit:

After having installed the driver we now need to install the CUDA toolkit itself.



$ sudo sh


Press enter to install at the


default location.


Register the new library files, run:

$ sudo gedit /etc/

and add


to the otherwise empty file and save it. Then run:

$ sudo ldconfig

You can also add

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

to the end of your ~/.bashrc file.

(You should then login and out again of start a new bash with

bash --

to update your environment.

Installing the CUDA SDK and Compiling the Example Programs

We will now install the CUDA SDK to your own home directory so you can play with the supplied demos:



$ sh

I chose to install it at the default location.


As CUDA does not yet work with GCC 4.4 you will have to  install gcc-4.3:

$ sudo aptitude install gcc-4.3 g++-4.3


Go to SDK source dir:

cd ~/NVIDIA_GPU_Computing_SDK/C$


Create a directory and create symlinks to gcc-4.3/g++-4.3

$ mkdir mygcc
$ cd mygcc
$ ln -s $(which g++-4.3) g++
$ ln -s $(which gcc-4.3) gcc
$ cd ..


Edit common makefile:

$ gedit common/

Find the lines that specify CC, CXX and LINK and change them to:

CXX        := g++-4.3
CC         := gcc-4.3
LINK       := g++-4.3 -fPIC


#use gcc-4.3

Before the line that says “ifeq ($(nvcc_warn_verbose),1)”. This tells the nvcc computer that it should look in mygcc for gcc, which will cause it to pickup our gcc-4.3 compiler.


You should now be able to compile everything by running

$ make

This should now compile all the examples in the SDK without errors.

Verify Installation

We can now verify that everything is working:



$ bin/linux/release/deviceQuery

On my machine I get the following output (depending on your harware, you ourput may be different):

CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA
Device 0: "GeForce 8800 Ultra"
CUDA Driver Version:                           2.30
CUDA Runtime Version:                          2.30
CUDA Capability Major revision number:         1
CUDA Capability Minor revision number:         0
Total amount of global memory:                 804585472 bytes
Number of multiprocessors:                     16
Number of cores:                               128
Total amount of constant memory:               65536 bytes
Total amount of shared memory per block:       16384 bytes
Total number of registers available per block: 8192
Warp size:                                     32
Maximum number of threads per block:           512
Maximum sizes of each dimension of a block:    512 x 512 x 64
Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
Maximum memory pitch:                          262144 bytes
Texture alignment:                             256 bytes
Clock rate:                                    1.51 GHz
Concurrent copy and execution:                 No
Run time limit on kernels:                     Yes
Integrated:                                    No
Support host page-locked memory mapping:       No
Compute mode:                                  Default (multiple host threads can use this device simultaneously)
Press ENTER to exit...

You should now be good to go. Here’s an screenshot of the volumeRender demo:

$ bin/linux/release/volumeRender
The volumeRender applicatin from the CUDA SDK.

Remember to use gcc-4.3/g++-4.3 and the –compiler-bindir option to nvcc when compiling your own CUDA source.

Code Gets Around

Code on TV2-oestjyllandIt seems that my code gets around these days. I recently got some code in Gnome and this evening I had some other code on Danish television as shown on the screenshot attached to this post. The text behind the anchorman is from an ongoing project and is being displayed using VIM (obviously since it is the best editor!) There is really no reason for them to show that code but I guess they thought it looked techie. The full clip can be seen here.

Online at NWERC 2006

I am currently sitting in a hall way at KTH in Stockholm where the North West European Programming Contest 2006 (NWERC 2006) is taking place. I am coaching two teams this year, after having participated in 2005,2004 and 2003, the teams (Aarhus 1 and Aarhus 2) will hopefully do good. The contest starts at 10 swedish time tomorrow and the scoreboard will be updated online for the world to follow :)
Right now the teams are doing the test contest to get to know the contest setup and coming up in 30 minutes is lunch followed by a trip to the Wasa museum. Following this a guy from google will give a talk and then we are off for the contest dinner.
Yesterday we (me and the Aarhus teams) walked around in Stockhom ending up with a visit to the Hard Rock Cafe which had a special Iron Maiden theme night, talk about a lot of black shirts with weird drawings ;)
I guess I will be sufficiently bored during the contest tomorrow that I may actually update this site again at that point, we will see.
Wish us luck!

Remote Backup Of A Subversion (svn) Repository

Yesterday I spent a lot of time trying to figure out how to take a complete backup of a subversion repository containing some code that I am currently working on. The generic way to do this is

svnadmin dump path-to-repos

but svnadmin only works on local repositories. However, I do not have shell access to the machine containing the repository and can only access it through its webDAV interface. I thought that since all revision information is available through the normal svn client, someone would have solved this problem nicely already. I googled around and could not find any obvious solutions. I found a the source to a program, svn-push in the subversion repository contrib section. It is a bit unclear what this program actually does and I was unable to actually make it compile. After some more searching I stumbled acroos svk which is a program build on top of subversion. Eventually I found out that I could abuse this program to create a dump of my remote repository. First make sure that you have no previous svk history:

rm -rf ~/.svk

Then get information of the repository by issuing the following command and follow the instructions on screen

svk ls [subversion-repository-URL]

svk should then have built a local repository, the first two revisions to this are local svk information, we simply dump the rest:

svnadmin dump -r2:HEAD ~/.svk/local > my-repository-dump

If you have stored the repository with the same name as you original repository as part of the “ls” command, my-repository-dump should now contain the full revision and log information of the original remote repository. yay.


IEnlightenment Foundation Libraries, Evas have been playing with the Enlightenment Foundation Libraries(EFL) enlightenment 0.17 from CVS for quite some time now, it a bit today. I have been running is nice to play with developing software. Using evas and ecore I was able to produce a little test application in no time.

Yesterday I went shopping in the city with Mette and David from my dorm. I ended up buying some wodden mind puzzle, the objective of which is to assemble a star from several parts, a handgrip gel for strengthening of the wrist and fingers and Pandora’s Star which is the first book in a series written by Peter F. Hamilton, the author of the brilliant Nights Dawn trilogy.

Life Goes On

So, my vacation has ended and I am now studying full time at DAIMI, I had one last week at CAVI which I spent tying loose ends, in particular I finished a rather large production with Ruben and it turned out quite nice. I am looking forward to the weekend, I am going camping with my family, we are staying in the northern part of Jutland, and the forecasts predict plenty of rain – very cosy.

I recently released vplayer which is a xine-lib front-end I wrote at CAVI. The frontend is able to play a movie frame-synchronized on a cluster of computers. It uses SDL to display the video but it is also able to render on an OpenGL texture for use in a graphics engine.