cuda 无限内核 [英] cuda infinite kernel

查看:32
本文介绍了cuda 无限内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要无限期运行 CUDA 内核的应用程序.我有一个 CPU 线程将 stg 写入列表,而 gpu 读取该列表并重置(至少在开始时).当我在内核中写代码时

I am working on an application for which it is necessary to run a CUDA kernel indefinitely. I have one CPU thread that writes stg on a list and gpu reads that list and resets (at least for start). When I write inside the kernel

while(true)
{
//kernel code
}

系统挂断.我知道 GPU 仍在处理,但当然没有任何反应.而且我不确定列表中的重置是否会发生.

the system hangs up. I know that the GPU is still processing but nothing happens of course. And I am not sure that the reset at the list happens.

不得不提的是,用于计算的GPU不用于显示,所以没有看门狗问题.

I have to mention that the GPU used for calculations is not used for display, so no watchdog problem.

操作系统是 Ubuntu 11.10 和 cuda 工具包 4.1.我可以使用任何帮助/示例/链接来成功编写无限内核.

The OS is Ubuntu 11.10 and cuda toolkit 4.1. I could use any help/examples/links on writing infinite kernel successfully.

推荐答案

CUDA 编程语言和 CUDA 架构目前不支持无限内核.我建议你考虑一下 Roger 的建议.

The CUDA programming language and the CUDA architecture do not currently support infinite kernels. I suggest you consider Roger's suggestion.

如果你想这样做,我建议你在你的内核中添加以下调试代码:

If you want to pursue this I suggest you add the following debug code to your kernel:

  1. 每 N 个时钟在固定内存中增加一个变量(可能希望每个 SM 有不同的位置),并且,
  2. 定期读取可由 CPU 更新的内存位置,以告知内核退出.

这是一个软件看门狗.

您可以使用 clock() 或 clock64() 来控制执行 (1) 和 (2) 的频率.

You can use clock() or clock64() to control how often you do (1) and (2).

您可以使用 cuda-gdb 来调试您的问题.

You can use cuda-gdb to debug your problem.

该语言不支持无限循环.编译器可能正在剥离代码.您可能需要查看 PTX 和 SASS.如果编译器生成错误代码,您可以通过让编译器认为存在有效的退出条件来伪造它.

Infinite loops are not supported in the language. The compiler may be stripping code. You may want to review the PTX and SASS. If the compiler is generating bad code you can fake it out by making the compiler think there is a valid exit condition.

这篇关于cuda 无限内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆