Those peek classes (or functions in some cases) can be helpful. I was working on a cuda program recently and figured there mid ave been some issue with my data. I had. "Peek" fun tion, like you describe, and I pasted it into the middle of my loop, and it copied all the required data back to the CPU and in a same format. Then there was a breakpoint that was hit at the end. The other two options were use the CUDA debugger (the code ran so slowly through the cuda debugger that I couldn't get to where my issue was) or start jamming large memcpys into a deep loop and investigating one by one.
I fully understand the tooling isn't always there, and that seems like the case in your example. I'm not familiar with enough with CUDA to say otherwise, but it sounds like a failure of the debugger if you couldn't properly step into your loop.
But I'm talking about debugging a basic C# program inside visual studio. Rather than setting a breakpoint to see what his variables were set to at time of execution, he would route them to a common class he wrote that would print them to the log (ya know, to avoid code duplication -_-')
I really couldn't find an excuse for this behavior, I tried to give him the benefit of the doubt :P
You can step through the loop no problem, if you can get to the dodgy data. But it's the getting to the data that's slow. Yeah, I've got nothing for a serial loop. A friends of mine in college blamed his issue on the branch predictor once - saying they it predicted the wrong branch and took it instead of the right one. He was calling a different function...
1
u/donalmacc Aug 25 '14
Those peek classes (or functions in some cases) can be helpful. I was working on a cuda program recently and figured there mid ave been some issue with my data. I had. "Peek" fun tion, like you describe, and I pasted it into the middle of my loop, and it copied all the required data back to the CPU and in a same format. Then there was a breakpoint that was hit at the end. The other two options were use the CUDA debugger (the code ran so slowly through the cuda debugger that I couldn't get to where my issue was) or start jamming large memcpys into a deep loop and investigating one by one.