Hi everyone.
Now I have been writing a raytracing kernel using OpenCL.
The kernel is big because it includes lots of procedures.
And it takes an argument which specifies the number of iterations in the kernel.
kernel void raytracing(global uchar* ..., uint spp, ...) {
...
for (int i = 0; i < spp; ++i) {
...
}
...
}
Furthermore, kernel execution is iterated also in runtime API.
for (int i = 0; i < iterations; ++i) {
printf("[ %d ]
", i);
queue.enqueueNDRangeKernel(kernel, cl::NullRange, cl::NDRange{g_width, g_height}, cl::NDRange{32, 32}, nullptr, nullptr);
queue.finish();
}
So, the argument to the kernel controls the unit of computing.
When I set the argument by the value 1.
The program works fine.
But when I set the argument by a larger value for example 16, the program does not return at queue.finish() at all.
Things get complicated because sometimes the program works fine even if the value is large.
I have tried searching for this problem.
And I maybe found the cause.
it says that if kernel execution takes so much time, the system resets the video driver. So the program does not works correctly.
I am still going to extend the kernel for a rich rendering feature, so this is the problem even if I set the argument by the low value.
Is there a good way to solve this problem?
Thanks in advance.
------Environment------
MacBook Pro Retina late 2013
OS X 10.9.2
Core-i7 4850HQ
16GB RAM
512GB SSD
Iris Pro Graphics 5200 128MB
Geforce GT750M 2GB