本文介绍了如何使用Matlab的Nvidia Visual Profile配置CUDA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要配置我的CUDA代码从Matlab。我已经将一些matlab代码转换为CUDA,以提高性能。我这样做通过调用调用CUDA的mexFunction。 matlab feval函数不提供足够的控制。我可以运行mexFunction通过VS调试这,但我需要调试内核,因为我相信这是问题是。



所以,我的问题是如何在执行调用它的matlab函数时通过profiler运行CUDA代码?



将所有输入的值硬编码是不现实的



我使用Tesla C2050 GPU卡在Windows 7 64位上运行Matlab 2012a 64bit。 >解决方案

NVIDIA Nsight Visual Studio版本2.2应该能够描述你的内核。


  1. 新分析活动

  2. 将活动类型设置为配置文件CUDA过程树(matlab可以启动另一个可执行文件)


Nsight Visual Studio CUDA Profiler有两个功能可以实现这一点:


  1. 活动配置文件CUDA过程树将对启动过程的CUDA过程和所有子进程进行配置。这是很重要的,因为我认为Matlab的默认实现是启动32位变体,如果在64位系统上,然后启动64位可执行文件,所以只是启动Matlab是不够的。


  2. Nsight分析器支持在应用程序内核重放中,它支持在应用程序的一个执行中使用相同的输入多次运行您的内核。


NVIDIA Visual Profiler通过多次运行应用程序来收集结果。它不支持启动程序。这可以通过直接启动Matlab.exe的正确版本来克服。由于应用程序重放机制,您可以使用Visual Profiler配置文件,如果您可以自动运行您的mexFunction。我没有尝试使用Visual Profiler对Matlab进行性能分析,但我知道Nsight团队在过去对此进行了测试。


I need to profile my CUDA code from Matlab. I have been converting some of the matlab code to CUDA in order to increase performance. I have done this by calling a mexFunction which calls the CUDA. The matlab feval function doesn't provide enough control. I can run the mexFunction through VS to debug this, but i need to debug the kernel as well, as i believe this is were the issue is.

So, my question is how do i run the CUDA code through the profiler when executing the matlab functions that call it?

It isn't practical to hard code the values of all the inputs into the CUDA function.

I am running Matlab 2012a 64bit on windows 7 64bit with a Tesla C2050 GPU card

解决方案

NVIDIA Nsight Visual Studio Edition 2.2 should be able to profile you kernel.

  1. Nsight | New Analysis Activity
  2. Set Activity Type to Profile CUDA Process Tree (matlab can launch another executable)
  3. Experiments to Run set to All

Nsight Visual Studio CUDA Profiler has two features that should make this possible:

  1. The activity Profile CUDA Process Tree will profile the CUDA process and all children processes of the launched process. This is important as I think the default implementation of Matlab is to launch the 32-bit variant and if on a 64-bit system then launch the 64-bit executable so simply launching Matlab is not sufficient.

  2. Nsight profiler supports in application kernel replay which supports running your kernel multiple times with the same input in one execution of the application.

The NVIDIA Visual Profiler collects results by running the application multiple times. It does not support launcher applications. This may be overcome by directly launching the correct version of Matlab.exe. Due to the application replay mechanism you may be able to profile using the Visual Profiler if you can automate running your mexFunction. I have not tried profiling Matlab with the Visual Profiler but I know the Nsight team has tested this in the past.

这篇关于如何使用Matlab的Nvidia Visual Profile配置CUDA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 00:36