Here a small puzzle for those of you who have nothing better to do:
Let “x” be a float.
Can the following assert fire? (assert is the standard macro from cassert).
{ float y=x; assert(x==y); }
If yes, how?
If no, why not?
Here a small puzzle for those of you who have nothing better to do:
Let “x” be a float.
Can the following assert fire? (assert is the standard macro from cassert).
{ float y=x; assert(x==y); }
If yes, how?
If no, why not?
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:
http://www.nvidia.com/object/cuda_get.html
(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:
cudadriver_2.3_linux_64_190.18.run
cudatoolkit_2.3_linux_64_ubuntu9.04.run
cudasdk_2.3_linux.run
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
Run
$ sudo cudadriver_2.3_linux_64_190.18.run
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.
Run
$ nvidia-settings
to verify that your driver version is at least 190.18. Look for the driver version in the window:

After having installed the driver we now need to install the CUDA toolkit itself.
Run:
$ sudo sh cudatoolkit_2.3_linux_64_ubuntu9.04.run
Press enter to install at the
/usr/local/cuda
default location.
Register the new library files, run:
$ sudo gedit /etc/ld.so.conf.d/cuda.conf
and add
/usr/local/cuda/lib64
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.
We will now install the CUDA SDK to your own home directory so you can play with the supplied demos:
Run:
$ sh cudasdk_2.3_linux.run
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/common.mk
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
Add
#use gcc-4.3
NVCCFLAGS+=--compiler-bindir=${HOME}/NVIDIA_GPU_Computing_SDK/C/mygcc
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.
We can now verify that everything is working:
Run:
$ 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)
Test PASSED
Press ENTER to exit...
You should now be good to go. Here’s an screenshot of the volumeRender demo:
$ bin/linux/release/volumeRender
Remember to use gcc-4.3/g++-4.3 and the –compiler-bindir option to nvcc when compiling your own CUDA source.
It 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.
The Northwest European Programming Contest 2006 is starting in 10 minutes. This year they even have a fancy video feed with commentaries and graphics, check it out at the NWERC 2006 site. I am sitting in the main auditorium with some other coaches watching the feed on a big screen, very nice – I wish I had some pop corn.
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!
Google has launched Google Code Search and the first thing you do with such a service is to put in your own name, of course. I am a bit dissappointed about the fact that Martin has more hits than I although, clearly, I am a better programmer ;). I guess it pays off doing boring web scripting crap ;). Now I’ll need to release more source I guess.
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.
I
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.
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.
Today Lille Lars and I handed in our exam project for the course Types in Object Oriented Languages. The project, which we have given the fancy title Assignment Featherweight java: Bringind Mutable State to Featherweight java, turned out nicely, and we got the chance to freshen up some of our dusty SML/NJ skills by constructing a type-checker for the language we constructed in the project.