gpt4 book ai didi

c++ - CUDA Visual Profiler 5.0 不生成时间线,Cudadevicereset() 出错

转载 作者:行者123 更新时间:2023-11-28 02:44:56 24 4
gpt4 key购买 nike

我使用 CUDA Visual Profiler 分析我的 CUDA 项目,但它显示消息

"Unable to read the entire session timeline. the displayed timeline may be empty or incomplete because the application aborted or failed to flush profile data before exiting. The application should call cudaDeviceReset() to ensure that all profile data is flushed. "

如何调用 cudaDeviceReset() ,VS 2012 在项目结束时调用它时发生错误。我需要什么库、方法或参数?

最佳答案

call it like this :

cudaDeviceReset();

假设您正在使用 nvcc 编译您的项目(即它是一个 CUDA 项目,在 .cu 文件中),则不需要任何库、方法或参数.

如果您的项目是 C++ 项目(.cpp 文件),那么您需要添加

#include <cuda_runtime.h> 

添加到您的源代码,您需要将 CUDA 包含文件的适当路径添加到编译器规范,并将 CUDA 库的适当路径添加到链接器规范。通过查看一些示例项目,可以为您的特定 Visual Studio 安装发现这些路径。

顺便说一下,visual studio 2012 不是 CUDA 5.0 的官方支持环境。您可以通过查看文件 CUDA_Toolkit_Release_Notes.pdf 来发现这一点(使用 Windows 文件资源管理器查找功能在您的计算机上找到该文件。)

关于c++ - CUDA Visual Profiler 5.0 不生成时间线,Cudadevicereset() 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24748928/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com