Using kernel printf with Matlab / MEX / CUDA how to pick up the printed data ?


I have Matlab --> MEX --> CUDA and have noticed that when executing a MEX from matlab there doesn’t seem to be a stdout stream and you must use the mexPrintf(). Which is completely incompatible ( AFAIK ) with the printf() which you could have in your kernel code.

If not executing the code from Matlab you could

freopen (“printf_Log.txt”,“w”,stdout);



You could also from the shell:
CUDA_app.exe > printf_Log.txt

This would “pipe” any printf out to the .txt file.

Is there any simple way to get the printouts ? It would be great to be able to pick them up and output either in a new console or directly in matlab.

Thank you for any advice!