compute
compute copied to clipboard
BOOST_COMPUTE_CLOSURE triggers run-time compiling every time the closure value changes
Just wondering if this is a bug or a user error. The below is a snippet showing the issue. Trying to pass different run-time value to closure, that triggers the run-time compiling every time the transform() is called.
If this is user error or not supported, is there a workaround for supplying run-time values to algorithms?
boost::compute::device gpu = boost::compute::system::default_device();
boost::compute::context context(gpu);
boost::compute::command_queue queue(context, gpu);
size_t size = 10000;
boost::compute::vector
size_t N = 100;
for (size_t i = 0; i < N-1; ++i)
{
int e = static_cast
BOOST_COMPUTE_CLOSURE(int, calc, (int a, int b), (e),
{
return a + b + e;
});
boost::compute::transform(
va.begin(),
va.end(),
vb.begin(),
vc.begin(),
calc,
queue);
}
Cheers