背景:
使用NDT建图,帧率比较慢,打算使用gpu加速计算。
ndt_gpu是一个使用gpu加速ndt计算的库,首先在工作空间编译这个包。
然后在ndtMap包中链接这个库,其CMakelists.txt添加如下内容,
SET(CUDA_INCLUDE_DIRS /usr/local/cuda-10.0/include) find_package(CUDA) if (CUDA_FOUND) add_definitions(-DCUDA_FOUND) list(APPEND PCL_OPENMP_PACKAGES ndt_gpu) endif () find_package(catkin REQUIRED COMPONENTS ${PCL_OPENMP_PACKAGES} )
编译成功!
运行却报错如下:
ndtMap: /usr/local/gtsam/include/gtsam/3rdparty/Eigen/Eigen/src/Core/DenseStorage.h:109: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = float; int Size = 16; int MatrixOrArrayOptions = 0]: Assertion `(internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (15)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed. Aborted (core dumped)
问题解决思路:
https://blog.csdn.net/wojiushixiangshi/article/details/78356271
http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html (更多详情需要参考这个网址)
解决方案:
在ndt_gpu库的CMakeLists.txt中添加下述指令,重新编译即可。
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O3 -mtune=native ")