Profiling mex files How do I profile cuda Matlab mex files

Hallo wizards,

I have written a few cuda kernels in Matlab Mex format. some of them are not delivering the expected performance. does anyone of you have experience profiling mex files using the cuda profiler? is this even possible?

Thank you in advance for your help.

Yeah, I do that all the time.
You can make a matlab script to call your program that contains the calls to the mex files. Put an exit at the end of the script.
Then in the visual profiler set the following:

launch : “/usr/local/matlab/bin/matlab”
working directory : “path to where the script is”
arguments: -nojvm -nosplash -r name_of_the_script_without_m

Make sure that you do not change directory in your script/program before your run the kernel, as the profiler expects the output to be in the working directory

Thanks a lot Denis.

Finally got this going under windows you have to add -wait to make the profiler wait to the end of the matlab session

Thanks to all for hints


edit: wrong post