How to profile MATLAB functions by using NVIDIA Visual Profiler (nvvp)

Hi all,

I am trying to profile a CUDA code which is invoked from MATLAB through “mexcuda”. I have Matlab R2016a and CUDA 9.0 versions running on Ubuntu 16.04.

I am trying to profile this setup using Nvidia Visual Profiler. I followed posts related to this topic regarding the nvvp settings and am able to write data from MATLAB to GPU and then profile all the kernels written using CUDA.

The problem I face is that Nvidia profiler gives time details of the CUDA kernels alone. The time taken by computations run in CPU(ie MATLAB) is not shown in the profiler results.

To achieve this I tried options below:

  1. Enable CPU tracing in Nvidia Visual Profiler. But it does not seem to work and profiler runs continuously without termination.

  2. mexcuda -g file.cu This option I thought would support debugging which also did not work

  3. Within Matlab script, enable profiler that is supported by MATLAB’s dedicated profiler (using “profile on”) in file1.m

But none of these options is working. Can anyone suggest how to profile all steps run on MATLAB and CUDA using Nvidia Visual Profiler?

I am stuck with this issue for a long time.

Thanks

Hi, sceeram

There is an option “Profile execution on CPU”, you can have a try and check results in “CPU Details” view.

Hi veraj,

Thanks for your response. I did try to enable the option “Profile execution on CPU”. After enabling when i try to run nvvp again, an error pops up as below:

[b]{Unexpected system error: bang: poll [4] Interrupted system call

Error in mexcuda (line 65)
compilerForMex = mex.getCompilerConfigurations(‘C++’,‘selected’);

Error in (line 54)
mexcuda -v sub_param.cu kernels.cu -lcublas -lcusolver -lstdc++ -lc…
}[/b]

Please see the settings and the error enclosed herewith.

Could anyone suggest how to fix this problem?

Thanks.

Hi, sreeram

Sorry for the problem you met.

Can you tell the steps that can reproduce your problem ?

We’ll try Matlab on our side if possible.

Hi veraj,

Thanks a lot for responding. Please see the attachments for how i linked matlab to nvvp.
I intend to profile CPU functions and CUDA functions using either nvvp or nsight IDE.

In my case, the CPU functions are written using MATLAB. Now to transfer the data from MATLAB to GPU, i use a gateway function mexcuda.

Hope my explanation is clear. Please inform if any additional information is required. I am stuck with this problem for many days.

Thanks.

Hi, sreeram

I see the profile option you used. But I didn’t see the file you used in “Create New session” page also the “Arguments”, can you provide such info ?