[Documentation] [TitleIndex] [WordIndex

  Documentation Status

Cannot load information on name: cuda, distro: electric, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.
Cannot load information on name: cuda, distro: fuerte, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.
Cannot load information on name: cuda, distro: groovy, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.
Cannot load information on name: cuda, distro: hydro, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.

Contents

  1. Tutorial

Tutorial

To add CUDA support to a package, you must edit its manifest:

<package>
  [...]
  <depend package="cuda"/>
  <depend package="roscpp"/>
  [...]
</package>

Also modify its CMakeLists.txt file:

[...]
rosbuild_init()

# Run the CUDA-linking routines
rosbuild_include(cuda cuda)
[...]

# Build the kernel and the kernel-aware host code
CUDA_ADD_LIBRARY(kernel src/kernel.cu)
# Build the ROS node and the matrix-adding code that's CUDA-unaware
rosbuild_add_executable(program src/program.cpp)
# Link the CUDA code and CUDA libraries into the ROS node
target_link_libraries(program kernel shrutil_x86_64 cutil_x86_64)

kernel.cu contains the CUDA kernels and CUDA-aware (nvcc-compiled) host code. The plain C++ code in program.cpp calls code in kernel.cu which runs the kernel. The host-code entry point in kernel.cu should be declared in a header shared with program.cpp.

See cuda_tests for an example of a CUDA-aware ROS node.


2013-05-18 12:29