在pcl中创建DeviceArray的时序行为不一致

时间:2018-12-17 03:46:13

标签: c++ runtime

如果我在pcl中创建了多个gpu :: DeviceArrays,则只有第一个DeviceArray创建需要时间(〜80ms)。创建更多DeviceArray花费零毫秒的时间。这是预期的行为吗?对此有什么解释?

我的代码以及时间如下:

#include <pcl/gpu/octree/octree.hpp>
#include <pcl/gpu/containers/device_array.hpp>
#include <pcl/point_types.h>

#include <pcl/common/time.h>

int main (int argc, char** argv)
{

    pcl::StopWatch sw;
    sw.reset();

    pcl::gpu::DeviceArray<pcl::PointXYZ>  cloud_device;
    cloud_device.create(640*480);

    std::cout<<"time taken to create cloud device array="<<sw.getTime() << std::endl;
    sw.reset();

    // create the gpu normals class
    pcl::gpu::NormalEstimation::Normals normals_device;
    normals_device.create(640*480);

    std::cout<<"time taken to create normals device array="<<sw.getTime() << std::endl;
    sw.reset();

    pcl::gpu::Octree::PointCloud cloud_octree_device;
    cloud_octree_device.create(640*480);

    std::cout<<"time taken to create octree device array="<<sw.getTime() << std::endl;

   return 0;
}

Output:

time taken to create cloud device array=80
time taken to create normals device array=0
time taken to create octree device array=0

0 个答案:

没有答案