You can profile Matlab mexfiles including CUDA codes using the NVIDIA Visual Profiler by the following procedure:
1. Write your mexfile including CUDA code (see this article for guidelines).
2. Add cudaDeviceReset() at the end of your mexfunction.
3. Write your Matlab .m file end add exit at its end.
4. Launch the NVIDIA Visual Profiler and go to File -> New Session.
5. In File: add the full path of the Matlab executable file, for example C:Program FilesMATLABR2012bbinwin64MATLAB.exe .
6. In Working directory: add the full path of the Matlab .m file.
7. In Arguments: -nojvm -nosplash -r file_name_without_m_extension.
8. Next -> Finish and that’s it!