Use openacc in cmakelists of ros package

set(CMAKE_CXX_COMPILER /opt/pgi/linux86-64/2018/bin/pgc++)
set(CMAKE_C_COMPILER /opt/pgi/linux86-64/2018/bin/pgcc)

add_compile_options(-std=c++11)
set(CMAKE_BUILD_TYPE Release)

add_compile_options(-fopenacc)
option(ENABLE_OPENACC “Enable OpenACC support” ON)
if(ENABLE_OPENACC)
ADD_DEFINITIONS(-DUSE_OPENACC)
set(CMAEK_C_FLAG “${CMAKE_C_FLAGS} -acc -Minfo=accel”)
set(CMAEK_CXX_FLAG “${CMAKE_CXX_FLAGS} -acc -Minfo=accel”)
endif()

How to configure openacc in CmakeLists file? I did like above, but it didn’t work. Could you please help me? Thank you!

Andysen0,

What doesn’t work about it? I’m not too familiar with Cmake so this might be an issue specific with your Cmake config, but specify the acclerator target with the -ta option. Use -ta=tesla for GPU acceleration and -ta=multicore for multicore. You should see the -Minfo messages give you feedback for the target.