背景:
使用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 ")