【问题标题】:Profiling MATLAB mex CUDA applications with the NVIDIA visual profiler使用 NVIDIA 视觉分析器分析 MATLAB mex CUDA 应用程序
【发布时间】:2016-06-22 18:41:45
【问题描述】:

我正在尝试分析嵌入在从 MATLAB 调用的 mex 文件中的 CUDA 代码。在win7 x64机器上运行,MATLAB r2014b

代码结构如下:

 MATLAB   test.m
    ->contains some standard code generating variables (and calling 1 or 2 minor own MATLAB fucntions)
    -> calls testcuda.mex
        ->contains small, standard, no library C++ code
        -> calls either test1.cu or test2.cu
              ->.cu files end in cudaDeviceReset();
           

如网上several places 所述,我做了以下操作:

  1. 已编译的 mex 文件。测试它们。他们工作。
  2. 在test.m末尾添加exit
  3. 启动 NVIDIA Visual Profiler。文件 -> 新会话。
  4. 添加Matlab可执行文件的完整路径,例如C:\Program Files\MATLAB\R2014b\bin\matlab.exe
  5. 工作目录:添加Matlab .m 文件的完整路径。 C:\CUDA_MATLABtests\MyToolbox
  6. 参数:-nojvm -nosplash -r test

但是,当我运行分析器时,我得到了

======== Warning: No CUDA application was profiled, exiting

仅此而已。

我缺少一些说明?

是否有任何特定的代码结构会使分析器无法分析?

【问题讨论】:

  • 我认为在第 4 步中你必须使用C:\Program Files\MATLAB\R2014b\bin\win64\matlab.exe。或者尝试使用-wait 选项。
  • @Daniel 确实.... win64 文件夹,真是个愚蠢的错误。作为 MATLAB 已经在 Program Files 而不是 Program Files x86 我认为它已经是 64 位版本。考虑回答这个问题。

标签: matlab cuda mex


【解决方案1】:

Matlab 安装附带两个二进制文件,<matlabroot>\bin 中的启动器和<matlabroot>\bin\<arch> 中的主应用程序。后者是可执行文件,它也在其地址空间中执行 mex 函数。

  • 当调试工具需要直接启动应用程序时,必须启动<matlabroot>\bin\<arch>中的那个。
  • 当调试工具也自动附加到子进程时,通常在<matlabroot>\bin 中设置-wait 参数就足够了。看到启动器应用程序终止,调试工具通常会停止。

除非必须,否则切勿直接使用 <matlabroot>\bin\<arch> 中的二进制文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-28
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多