Cuda And PCL Issues

I am working on an Ubuntu 20.04 computer, which has cuda capabilities. I have also installed Opencv4.5 and point cloud library (PCL 1.8).
Everything works ok, when I am writing code using the above mentioned frameworks.
I have written a *.cu program and I want to display some results using the PCL library. The program runs perfectly, however when I simply include some of the PCL headers (without calling any function), I get the errors displayed bellow.

In file included from /usr/include/vtk-7.1/vtkRenderingLODModule.h:36,
from /usr/include/vtk-7.1/vtkLODActor.h:59,
from /usr/include/pcl-1.10/pcl/visualization/common/actor_map.h:44,
from /usr/include/pcl-1.10/pcl/visualization/pcl_visualizer.h:48,
from /home/mmp/Desktop/TestObiecte/display.h:5,
from /home/mmp/Desktop/TestObiecte/main.cu:1:
/usr/include/vtk-7.1/vtkRenderingCoreModule.h:48: error: unterminated argument list invoking macro “VTK_AUTOINIT1”

The headers included are:
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/vlp_grabber.h>
#include <pcl/console/parse.h>
#include <pcl/visualization/pcl_visualizer.h>

I have used those headers in other programs which use PCL and everything ran ok, without any problems.

I have seen the same issues in this post from the forum however there was no solution on how it was solved.
Could anyone help with this issue?

The CUDA compiler doesn’t always work with other libraries. Another common example of this used to be boost.

A common suggestion in these cases is to partition your code. Place the code that depends on PCL or any particular library you are having trouble with, in .cpp files. The troublesome includes only need to be in these files. Place the code that must interact with the GPU (including your CUDA device code, e.g. kernels) in .cu files. Don’t put the troublesome includes there. Compile your .cu files with nvcc. Compile your .cpp files directly with your host compiler. Link them together either with the host compiler or with nvcc.

When you need to exchange data or call from one side to the other, use wrapper functions.

1 Like

Does NVIDIA have now a solution to be able to compile a code using pcl with nvcc ?

PCL seems to already comprehend CUDA. If you have issues using PCL, my suggestion would be to use one of their recommended paths.

Thanks. But I have not an issue with PCL itself. I have a global code (let’s say sample.cpp) that uses PCL, and sometimes inside I am doing big matrices multiplication that I want to parallelize. So I have tried to change sample.cpp in sample.cu and compile it with nvcc but I have the error reported above "error: unterminated argument list invoking macro “VTK_AUTOINIT1”. And I was wondering if since the first message a solution appeared.