vexcl icon indicating copy to clipboard operation
vexcl copied to clipboard

Is it possible to create an Boost Compute vector and wrap a vexcl vector with Compute vector?

Open kafi350 opened this issue 4 years ago • 3 comments

As given in the documentation we can do it for the vexcl but not for the compute vecotrs.

kafi350 avatar Aug 12 '21 10:08 kafi350

Both boost.compute and vexcl vectors are just wrappers around raw opencl buffers, so the conversion is possible both ways.

ddemidov avatar Aug 12 '21 10:08 ddemidov

// Wrap boost.compute vectors into vexcl vectors (no data is copied): compute::vector bcv(n, bcq.get_context()); vex::vector y({bcq}, bcv.get_buffer()); y = x * 2;

this is the way to wrap a compute vector but is it possible to wrap a vex vector?

kafi350 avatar Aug 12 '21 10:08 kafi350

See examples in <vexcl/external/boost_compute.hpp>, which uses Boost.compute algorithms with vexcl vectors:

https://github.com/ddemidov/vexcl/blob/ec0cc1fe037f68a9d1c19f56960e92cd820f4f20/vexcl/external/boost_compute.hpp#L60-L102

ddemidov avatar Aug 12 '21 11:08 ddemidov