Isn't there any ways avoid computer crashing when running wrongly programmed OpenCL Codes?

Hi.

I’m quite a new for OpenCL.

I tried matrix multiplication sample, and modified for practicing purpose,

and my computer soon dead with black screen (think graphic driver was dead. just recovered after power-button rebooting).

I found array out of bound mistake own my OpenCL kernel code, After fixing, everything was fine.

Though, do I have to go through this computer-crashing-risk all the time?

I think this is too cumbersome and probably harm my computer sometime…

isn’t there any way to avoiding this crashing problem on coding mistakes?

Currently I’m concerning firstly developing on CPU based OpenCL (using intel’s implementation) and verify my program is okay,

and then tunning parameters on GPU based OpenCL. But I hope there is more efficient way than this.

That is what debug indexers are used for. You might want to enable printf extension (if I’m not mistaken it’s now available on NV as well) and use something like:

int indexerD(int x, int y)
{
int index = y * dimY + x;
if((index < 0) || (index > maxSize)){
printf(“OVERINDEX with x=%d y=%d” in thread gidX=%d gidY=%d,x,y,get_global_id(0),get_global_id(1));
return 0;
else
return index;
}

This kind of indexer prevents you from overindexing and crashing your system. However it will be damned slow, so it must be used for debug pouposes only.