背景:html
使用NDT建圖,幀率比較慢,打算使用gpu加速計算。c++
ndt_gpu是一個使用gpu加速ndt計算的庫,首先在工做空間編譯這個包。this
而後在ndtMap包中連接這個庫,其CMakelists.txt添加以下內容,spa
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} )
編譯成功!.net
運行卻報錯以下:code
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)
問題解決思路:htm
https://blog.csdn.net/wojiushixiangshi/article/details/78356271blog
http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html (更多詳情須要參考這個網址)it
解決方案:io
在ndt_gpu庫的CMakeLists.txt中添加下述指令,從新編譯便可。
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O3 -mtune=native ")