21 #include "../common/common.hpp"
24 #include "bempp/common/config_opencl.hpp"
26 #ifndef fiber_opencl_handler_hpp
27 #define fiber_opencl_handler_hpp
29 #define __CL_ENABLE_EXCEPTIONS
33 #include "../common/armadillo_fwd.hpp"
34 #include "opencl_options.hpp"
63 OpenClHandler(
const OpenClOptions& options);
71 bool UseOpenCl ()
const {
return useOpenCl; }
77 const std::pair<const char*,int> initStr ()
const;
84 void loadProgramFromString (std::string strSource);
90 void loadProgramFromStringArray (cl::Program::Sources sources)
const;
92 cl::Kernel &setKernel (
const char *kernelName)
const;
97 void enqueueKernel (
const cl::NDRange &global)
const;
104 template<
typename CoordinateType,
typename IndexType>
105 void pushGeometry (
const arma::Mat<CoordinateType>& vtx,
106 const arma::Mat<IndexType>& idx)
const;
114 int SetGeometryArgs (cl::Kernel &kernel,
int argid)
const;
121 template<
typename BufferType>
122 cl::Buffer *createBuffer (
int size, cl_mem_flags usage)
const;
127 template<
typename BufferType>
128 cl::Buffer *pushVector (
const std::vector<BufferType> &vec)
const;
133 template<
typename BufferType>
134 cl::Buffer *pushBuffer (
const BufferType *buf,
int size)
const;
144 template<
typename BufferType>
145 cl::Buffer *pushRow (
const arma::Row<BufferType> &row)
const;
155 template<
typename BufferType>
156 cl::Buffer *pushMatrix (
const arma::Mat<BufferType> &mat)
const;
161 template<
typename BufferType>
162 cl::Buffer *pushCube (
const arma::Cube<BufferType> &cube)
const;
164 template<
typename BufferType>
165 void pullVector (
const cl::Buffer &clbuf,
166 std::vector<BufferType>& vec,
169 template<
typename BufferType>
170 void pullCube (
const cl::Buffer &clbuf,
171 arma::Cube<BufferType>& cube)
const;
180 cl::Buffer cl_vtxbuf;
184 const MeshGeom &meshGeom()
const {
return meshgeom; }
187 const std::pair<const char*,int> typedefStr ()
const;
190 unsigned int deviceUsed;
191 std::vector<cl::Device> devices;
192 cl::CommandQueue queue;
194 mutable cl::Program program;
195 mutable cl::Kernel kernel;
196 mutable cl::Event event;
198 mutable MeshGeom meshgeom;
200 mutable const char **progBuf;
201 mutable int nProgBuf;
213 bool UseOpenCl ()
const {
return false; }
215 template<
typename CoordinateType,
typename IndexType>
216 void pushGeometry (
const arma::Mat<CoordinateType>& vtx,
217 const arma::Mat<IndexType>& idx)
const {}
220 #endif // WITH_OPENCL
225 #endif // fiber_opencl_handler_hpp
Definition: opencl_options.hpp:29
Definition: opencl_handler.hpp:208