OCLSLAM  0.1.0
 Hosted by GitHub
algorithms.hpp
Go to the documentation of this file.
1 
32 #ifndef OCLSLAM_ALGORITHMS_HPP
33 #define OCLSLAM_ALGORITHMS_HPP
34 
35 #include <CLUtils.hpp>
36 #include <oclslam/common.hpp>
37 #include <RBC/data_types.hpp>
38 #include <RBC/algorithms.hpp>
39 #include <eigen3/Eigen/Dense>
40 
41 
45 namespace cl_algo
46 {
48 namespace oclslam
49 {
50 
74  class SplitPC8D
75  {
76  public:
81  enum class Memory : uint8_t
82  {
83  H_IN,
84  H_OUT_PC3D,
85  H_OUT_RGB,
86  D_IN,
87  D_OUT_PC3D,
88  D_OUT_RGB
89  };
90 
92  SplitPC8D (clutils::CLEnv &_env, clutils::CLEnvInfo<1> _info);
94  cl::Memory& get (SplitPC8D::Memory mem);
96  void init (unsigned int _n, Staging _staging = Staging::IO);
98  void write (SplitPC8D::Memory mem = SplitPC8D::Memory::D_IN, void *ptr = nullptr, bool block = CL_FALSE,
99  const std::vector<cl::Event> *events = nullptr, cl::Event *event = nullptr);
101  void* read (SplitPC8D::Memory mem = SplitPC8D::Memory::H_OUT_PC3D, bool block = CL_TRUE,
102  const std::vector<cl::Event> *events = nullptr, cl::Event *event = nullptr);
104  void run (const std::vector<cl::Event> *events = nullptr, cl::Event *event = nullptr);
105 
106  cl_float *hPtrIn;
107  cl_float *hPtrOutPC3D;
108  cl_uchar *hPtrOutRGB;
110  private:
111  clutils::CLEnv &env;
112  clutils::CLEnvInfo<1> info;
113  cl::Context context;
114  cl::CommandQueue queue;
115  cl::Kernel kernel;
116  cl::NDRange global;
117  Staging staging;
118  unsigned int n;
119  unsigned int bufferInSize, bufferOutPC3DSize, bufferOutRGBSize;
120  cl::Buffer hBufferIn, hBufferOutPC3D, hBufferOutRGB;
121  cl::Buffer dBufferIn, dBufferOutPC3D, dBufferOutRGB;
122 
123  public:
131  template <typename period>
132  double run (clutils::GPUTimer<period> &timer, const std::vector<cl::Event> *events = nullptr)
133  {
134  queue.enqueueNDRangeKernel (kernel, cl::NullRange, global, cl::NullRange, events, &timer.event ());
135  queue.flush (); timer.wait ();
136 
137  return timer.duration ();
138  }
139 
140  };
141 
142 }
143 }
144 
145 #endif // OCLSLAM_ALGORITHMS_HPP
void write(SplitPC8D::Memory mem=SplitPC8D::Memory::D_IN, void *ptr=nullptr, bool block=CL_FALSE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
Performs a data transfer to a device buffer.
Definition: algorithms.cpp:190
Interface class for the splitPC8D_octomap kernel.
Definition: algorithms.hpp:74
cl_uchar * hPtrOutRGB
Definition: algorithms.hpp:108
Memory
Enumerates the memory objects handled by the class.
Definition: algorithms.hpp:81
Offers classes which set up kernel execution parameters and provide interfaces for the handling of me...
Definition: algorithms.hpp:45
Declares classes used by the OpenCL interface classes in cl_algo.
void run(const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
Executes the necessary kernels.
Definition: algorithms.cpp:244
double run(clutils::GPUTimer< period > &timer, const std::vector< cl::Event > *events=nullptr)
Executes the necessary kernels.
Definition: algorithms.hpp:132
SplitPC8D(clutils::CLEnv &_env, clutils::CLEnvInfo< 1 > _info)
Configures an OpenCL environment as specified by _info.
Definition: algorithms.cpp:53
Offers functions that are serial CPU implementations of the relevant algorithms in the OCLSLAM pipeli...
Definition: helper_funcs.hpp:47
void init(unsigned int _n, Staging _staging=Staging::IO)
Configures kernel execution parameters.
Definition: algorithms.cpp:95
void * read(SplitPC8D::Memory mem=SplitPC8D::Memory::H_OUT_PC3D, bool block=CL_TRUE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
Performs a data transfer to a staging buffer.
Definition: algorithms.cpp:218
Staging
Enumerates staging buffer configurations.
Definition: common.hpp:43
cl_float * hPtrOutPC3D
Definition: algorithms.hpp:107
cl_float * hPtrIn
Definition: algorithms.hpp:106