Hi everyone,
hope this is the right place to post, I apologize if it is not.
I wrote a piece of code to run part of a program written in matlab to the gpu. I had to write a mex file to pass the data from matlab to C environment, than the cuda code to pass data from host to device, make here the computations and pass back the output from device to host to matlab again. Now I compiled the code and it gave me no errors but the output that I’m getting is not correct, it’s just zero. Now with a piece of “normal” code I would go step by step, ouputting intermediate results, to see where is the bug; but once given the data to the mex function it is like a black box untill I don’t have them back. How can I access the data flow to debug my code?
I managed to run the compute visual profiler but that is not of great help.
Hi everyone,
hope this is the right place to post, I apologize if it is not.
I wrote a piece of code to run part of a program written in matlab to the gpu. I had to write a mex file to pass the data from matlab to C environment, than the cuda code to pass data from host to device, make here the computations and pass back the output from device to host to matlab again. Now I compiled the code and it gave me no errors but the output that I’m getting is not correct, it’s just zero. Now with a piece of “normal” code I would go step by step, ouputting intermediate results, to see where is the bug; but once given the data to the mex function it is like a black box untill I don’t have them back. How can I access the data flow to debug my code?
I managed to run the compute visual profiler but that is not of great help.
I haven’t had to do this myself yet since my MEX usually needs the “round-trip” but isn’t it pretty trivial to implement this work-around yourself inside your mex-file? Call the mex with a certain flag/handle etc when you actually do want to retrieve the data ?