我可以使用 CUDA 计时器事件在一个文件中分别计算两个内核时间吗?
我创建了两对开始和停止事件,希望记录两个内核的时间。但我只是得到这个:
fatal error LNK1120: 1 unresolved externals
CUDA 最佳实践指南,s 2.1.2,使用 CUDA GPU 计时器没有讨论如何在一个程序中记录两个内核的时间。
I create two pairs of start and stop event hoping to record two kernels' time. But I just get this:
fatal error LNK1120: 1 unresolved externals
the CUDA Best Practices Guide, s 2.1.2, Using CUDA GPU Timers doesn't talk about how to record two kernels' time in one program.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如评论中所述,您的链接器错误与那些记录的事件无关。确保使用
nvcc
进行编译,确保安装了 CUDA 工具包,确保文件路径正确并已发布。请参阅面向初学者的最简单 CUDA 包装器了解如何开始。如果您需要有关 cudaEvents 如何工作的更多信息(带有示例代码),请参阅
CUDA:cudaEvent_t 和 cudaThreadSynchronize 用法
As said in the comments your linker error is unrelated to those recorded events. Make sure to compile with
nvcc
, make sure you got the CUDA toolkit installed, make sure the file pathes are correct and published. See Simplest CUDA Wrapper for Beginners for how to get started.If you need more information on how cudaEvents work (with example code) see
CUDA: cudaEvent_t and cudaThreadSynchronize usage
由于您使用的是 Visual Studio 2008,因此您需要确保已正确设置项目属性。这包括在项目配置属性下的“链接器”->“输入:附加依赖项”中添加适当的库,以及进入 Visual Studio 2008 的“选项”对话框并在 VC++ 目录下添加适当的文件。最后,如果右键单击项目名称并选择“自定义构建规则”,则应根据您的 CUDA 工具包版本选择适当的 CUDA 构建规则。
Since you are using Visual Studio 2008, you'll need to make sure you have set your project properties properly. This includes adding the appropriate libraries in Linker->Input: Additional Dependencies under the Project's Configuration Properties as well as going into Visual Studio 2008's Options dialog and adding the appropriate files under VC++ Directories. Finally, if you right click your project's name and select "Custom Build Rules" you should select the appropriate CUDA Build Rule based on your version of the CUDA Toolkit.