2

我正在尝试使用 Nsight Visual Studio Edition 或 Visual Profiler 使用managedCuda 分析用 C# 编写的 CUDA 应用程序。两个分析器都可以很好地与普通的 C++ CUDA 应用程序配合使用。要使用 managedCuda 测试分析器,我想在ManagedCudaSamples中分析项目“vectorAdd” 。

首先,我尝试使用 VS 2013 中集成的 Nvidia Nsight Visual Studio Edition 5.0。我使用 x64 Debug 配置。如果我尝试在 Nsight 性能分析的“应用程序控制”中启动应用程序,我会收到一条错误消息:

Analysis Session - Start Application Unable to launch 64-bit managed application '...\ManagedCudaSamples\vectorAdd\bin\x64\Debug\vectorAdd.exe'.

此外,我尝试使用 Nvidia Visual Profiler 7.5 来分析相同的应用程序。在运行 vectorAdd.exe nvprof 控制台显示以下输出:

==2944== NVPROF is profiling process 2944, command: ...\ManagedCudaSamples\vectorAdd\bin\x64\Debug\vectorAdd.exe ==2944== Warning: Some profiling data are not recorded. Make sure cudaProfilerStop() or cuProfilerStop() is called before application exit to flush profile data. ==2944== Generated result file: ...\nvvp_workspace\.metadata\.plugins\com.nvidia.viper\launch\7\api_2944.log

我是 CUDA 的新手,如果有任何关于如何分析 managedCuda 应用程序的建议,我将不胜感激。

4

1 回答 1

3

您需要CudaContext.ProfilerStop()在退出应用程序(或销毁上下文)之前调用,以便将收集的数据刷新到分析器。managedCuda 示例不包含此调用,为什么分析器看不到收集的信息。这解释了您得到的第二个错误。

关于第一个错误:在Nsight 5.0 的发行说明中,您可以找到一个已知问题:

  1. 不支持使用 AnyCpu 配置构建的托管应用程序。目标应用程序必须使用 Win32 或 x64 配置构建。

vectorAdd 的 VS 项目始终设置为 AnyCPU,无论解决方案平台是什么,请参阅 managedCuda 示例解决方案的配置管理器来更改它。

于 2015-11-10T23:03:46.880 回答