I’m new here and was making great progress with CUDA, transferring data back and forth building towards more complex computing until I hit the following problem. I’m on WinXP/8800GS if that matters. The following snippet will cause the cudaError_enum (on each thread I think) if any of the lines with //E are put back in. There is another message that comes up in the stdout window but I can’t catch that. This only happens on the actual version, but works fine in EMU.
Before I did this version, I had the routine use a pointer to return the intersected point, but that also caused the same exception. The explanation of auto vars and function return value handling isn’t explained in the CUDA refs so I’m not sure how these are handled exactly. Do they have to allocated via cudaMalloc instead?
This routine is used within another, but there isn’t much stack depth so I don’t think that’s the problem. THANKS!
In the case posted, the variable ‘intersection’ is declared as a local variable, so when this runs in a kernel does it automatically reside on the device? The manual isn’t very clear although it refers to local variables being defined in registers, per below. Although other local variables don’t seem to be a problem. What I was alluding to as the earlier version of the function was that I passed a pointer to a local variable to the function and also had issues. This is how I am getting led towards the handling of auto/local variables as being a problem.
Maybe this is a red-herring in that there is something else wrong.
BTW, I’m using VS 2005. Also, each thread is independent.
Can I use C++ try/catch blocks in host code or do I need to use the signal lib to catch exceptions? EDIT: I tried using signal but can’t seem to catch the error so that I can see what appears in the printf screen before the program closes.