ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Using openCL in ROS

asked 2011-11-24 04:54:20 -0600

Daniel Canelhas gravatar image

updated 2014-01-28 17:10:52 -0600

ngrennan gravatar image

Hi,

I've been using openMP to get some multi-core parallelism going in ROS but I'd like to try to use the GPU for this instead. Can someone please instruct me on how to edit my CMakeLists.txt to get ROS to compile a node so that it can use openCL? Typically, I'd go about compiling an openCL program is like this:

gcc -c -I /path-to-the-include-dir-with-cl.h/ main.c -o main.o
gcc -L /path-to-the-lib-folder-with-OpenCL-libfile/ -l OpenCL main.o -o host

I know there is a CUDA package somewhere, but it's not an option due to the ATI hardware (plus, cross-platform is nice, right?)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2011-11-24 15:28:09 -0600

Hi Daniel,

You could try adding the following lines to your CMakeLists.txt:

include_directories(/path-to-the-include-dir-with-cl.h)
rosbuild_add_executable(main path-to-main-cpp/main.cpp)
target_link_libraries(main /path-to-the-lib-folder-with-OpenCL-libfile/libOpenCL.so)

For more details you can find the documentation of CMake here. I hope this could help you.

Martin.

edit flag offensive delete link more

Comments

The CMake find_package command will also likely be useful to automatically find the path.
tfoote gravatar image tfoote  ( 2011-11-24 16:39:47 -0600 )edit
0

answered 2019-01-08 08:38:06 -0600

dinesh gravatar image

how to do that?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-11-24 04:54:20 -0600

Seen: 1,459 times

Last updated: Nov 24 '11