Showing posts with label cuda. Show all posts
Showing posts with label cuda. Show all posts

Monday, August 30, 2010

Installing CUDA 3.1 on Ubuntu 10.04

To install the CUDA driver on Ubuntu 10.04 follow the following instructions.

  1. Download the proper driver from nvidia's site
  2. Change gcc 4.4 to 4.3
  3. Remove any nvidia driver. > sudo apt-get purge nvidia-*
  4. Make the file in following location - "/etc/modprobe.d/nvidia-graphics-drivers.conf" with the following matters:

    blacklist vga16fb
    blacklist nouveau
    blacklist lbm-nouveau
    blacklist nvidia-173
    blacklist nvidia-96
    blacklist nvidia-current
    blacklist nvidiafb
  5. Kill  X
  6. Launch the driver's installation
  7. Reboot
Source: 
Pablo's experience and 

Tuesday, July 20, 2010

Total Variation image regularization in CUDA

Lately I've been playing with NVidia's CUDA language. As a result two Total Variation regularizers were implemented, one is Chambolle's dual method the other is Zhu and Chan's primal dual method.

Original and TV regularized image.

The CUDA implementation of both methods, when running on GeForce 9400M, is 4 times faster than the CPU version; and 15 times faster when running on GeForce GTX 285.
I must confess that I'm a little disappointed, I expected a ~100x speed-up with the GTX 285. Probably the speed-up is proportional to the coding skills :(

There is no stop condition for the algorithms other than the number of iterations, but the Zhu and Chan algorithm exhibits faster convergence than Chambolle's.

One of the most remarkable performance boosts came from the use of structures of arrays. Basically instead of storing a vector valued image as [ (u0,v0),(u1,v1),(u2,v2), .... ] , storing two arrays [ u0,u1,u2, .... ]  and [ v0,v1,v2, .... ]  favors the coalesced memory access.

Download the code. Tested on OSX and Linux.