Reputation: 303
I recently installed CUDA 5 (and am using Visual Studio 2010 Express, if that matters). When I try to perform an out-of-bounds read-access on a global memory device array in a kernel, CUDA now gives me an error (Error 30 'unknown error'). I am wondering if this seemingly automatic out-of-bounds error checking is a new addition to CUDA 5. I do not recall seeing it in earlier versions.
Additionally, is there anyway to turn off this automatic out-of-bounds error checking? Having this capability turned on forces me to add additional conditional logic to my kernels (whereas before I just wouldn't use the out-of-bounds results).
Thank you,
Aaron
Upvotes: 1
Views: 1046
Reputation: 9474
This is a device exception, it is not coming from the software. The only reason it didn't crash on you before is pure luck (and, likely, older compiler). You cannot rely on compiler behaviour (e.g. even with the old compiler you might've seen different behaviour for different optimization levels)
Upvotes: 1
Reputation: 1507
Considering my experiences out-of-bounds error checking is also in older CUDA versions but it doesn't behave very strictly. Launching kernels with more threads and larger allocated arrays caused kernel crashing more often than launching of smaller kernels with smaller arrays when some thread exceeded bounds of allocated array.
I suppose this checking is done by CUDA runtime system and there is no way how to turn it off. Agreeing with @Roger Dahl it definitely wouldn't be "OK" to write out of bounds if there were such way of turning this checking off.
Upvotes: 0