I used the code below
cl::Event copyEvent;
cl::Event prolEvent;
T value = 0;
try
{
queue.enqueueFillBuffer(intermediateBuffer, &value, 0,
distDeviceWidth * distDeviceHeight * distDeviceDepth * sizeof(T),
NULL, ©Event);
}catch (const cl::Error& error)
{
std::cout << " -> Prolongation class, Problem in enqueue fill buffer" << std::endl;
std::cout << " -> " << getErrorString(error) << std::endl;
exit(0);
}
try
{
queue.finish();
}catch (const cl::Error& error)
{
std::cout << " -> Prolongation class, Problem in finishing fill buffer" << std::endl;
std::cout << " -> " << getErrorString(error) << std::endl;
exit(0);
}
copyEvent.wait();
But when I read the data from device and print it on host, The function enqueueFillBuffer
generate garbage. I don’t know why. I build the data with openCL 2.0.