2
votes

My program consists of a Matlab file (.m) and a mex-cuda file(.cu). It starts with Matlab, then the Matlab file calls the mex-cuda file.

I want to get profiling the performance in the mex-cuda file using 'nvprof' command-line. I know that for regular CUDA program, we simply use (in Unix):

$nvprof file.out

However, the mex-cuda file now is called from matlab, not from the shell anymore. Is there a way to use 'nvprof' command-line for this mex-cuda file?

2
If you run matlab from the command line, try nvprof "matlab < myfile.m"Robert Crovella
This is a perfect solution. It runs well without using the quotation " symbols. Just --> $nvprof matlab < myfile.m <--. Thanks a lot Robert.Phong
@RobertCrovella Consider answering this. As easy as it seems, it is a brilliant feature for us MATLAB users.Ander Biguri

2 Answers

2
votes

If you run matlab from the command line, try

nvprof "matlab < myfile.m"

The quotes may be unnecessary, i.e.this may work as well:

nvprof matlab < myfile.m
0
votes

This blog explains how to profile CUDA kernels from MATLAB.

http://meerkat.gr/matlab-profile-cuda.html

It should work with CUDA-MEX as well.