Autonomous Space Robotics Lab

Speeded Up SURF

UTIAS ASRL

Build instructions for Linux

None of us are running Linux (all development has been on OSX and Windows XP) but these build tips were provided by Alastair Harrison who got the library compiling on 64-bit Kubuntu Karmic with gcc 4.4.1.

1) GET CUDA

Download and install CUDA 3.0

http://developer.nvidia.com/object/cuda_3_0_downloads.html

You will need

  1. the development driver (64-bit)
  2. the CUDA toolkit for Ubuntu Linux 9.04 and
  3. the GPU Computing SDK code samples

Compiling CUDA using gcc 4.4.1 is a bit of a hassle.

There are two ways to do this:

1) Comment some 'extern' definitions in the cuda headers, as per comment #14 here:

http://moelhave.dk/2009/12/nvidia-cuda-on-ubuntu-karmic-koala/#comment-356165

OR

2) you can turn off inlining and the compiler optimizations as per these:

http://parasatria.wordpress.com/2010/01/27/cuda-and-gcc-4-4/

http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/

The former is probably preferable, because you don't have to disable the optimizations but only the latter has been tested.

2) COMPILE CUDPP

The segmented scan from the CUDPP project is used to build the integral images.

http://code.google.com/p/cudpp/

We have included the sources for this project in the 3rdParty directory. To build this in 64-bit linux takes a bit of work.

There are two parts to this.

1) If you turned off inlining and optimization to make the cuda sdk work, then you need to make the same changes in the CUDPP linux_build/common.mk file.

2) If you're on a 64-bit platform then you need to persuade it to compile the libraries with -fPIC and make them properly shared.

Again, in the CUDPP linux_build/common.mk file, change:

CXXFLAGS  := $(CXXWARN_FLAGS)
CFLAGS    := $(CWARN_FLAGS)

To this:

CXXFLAGS  := $(CXXWARN_FLAGS) -fPIC
CFLAGS    := $(CWARN_FLAGS) -fPIC

And add

--compiler-options -fPIC -shared

to the NVCCFLAGS.

3) GET CMAKE

This should be available using apt

sudo apt-get install cmake

4) GET OPENCV

Good instructions are available here. There may be a package available in aptitude.

5) GET BOOST

There are instructions available here but the Boost C++ libraries should be available in an aptitude repository. The Boost Program Options library is necessary for the gpusurf_engine command-line utility.

6) BUILD GPU SURF

open a console in the build directory. type:

cmake ..

This gets cmake to construct the makefile. The CMake script that finds CUDA may not work correcly and you may be requried to specify paths to the CUDA libraries manually. CMake comes with a utility that allows you to do this from the console. Type

ccmake .

to open the utility. Now typing t will allow you to see all of the variables defined by the build scrips. Look for values labeled NOTFOUND.

Now you can build the library. Type:

make

This will produce a few things:

  1. The bin/gpusurf_engine command line utility.
  2. The bin/gpusurf_tests command line program.
  3. The lib/gpusurf.so dynamically linked library file.

Generated on Fri Apr 30 20:06:20 2010 for gpusurf by doxygen 1.6.2