如何使用 CUDA 在一个 GPU 上运行 1 个以上内核?

发布于 2024-09-29 12:27:28 字数 405 浏览 1 评论 0原文

kernel1 <<< blocks1, threads1, 0, stream1 >>> ( args ... );
...
kernel2 <<< blocks2, threads2, 0, stream2 >>> ( args ... );
...

我有两个内核要同时运行,
设备是GTX460,所以是Fermi架构。
cuda工具包和sdk是3.2 rc。

与上面的代码一样,两个内核被编码为同时运行,
但没有任何内核的响应。

内核所做的事情是否有任何限制? 两个内核共享一些数据
他们有一些共同点。
如果我注释掉一个内核函数的大部分,那么程序就会停止。

请给我任何帮助。

kernel1 <<< blocks1, threads1, 0, stream1 >>> ( args ... );
...
kernel2 <<< blocks2, threads2, 0, stream2 >>> ( args ... );
...

I have two kernels to run concurrently,
and the device is GTX460, so it's Fermi architecture.
The cuda toolkit and sdk are 3.2 rc.

Like codes above, two kernels are coded to be run concurrently,
but there are no responses from any kernel.

Is there any constraints on what kernels are doing?
Two kernels share some data
and they have some part in common.
If I comment out most of one kernel function, then program halts.

Please give me any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮光之海 2024-10-06 12:27:28

在不同流上运行的事实并不意味着它们将同时运行。
如果第一个内核所需的资源量足以允许运行第二个内核,则情况就是如此,否则它们将串行运行。
确保在两次内核调用之后有一个 cudaSyncThreads(),或者在两个线程上同步。请记住,所有 cuda 调用都是异步的。

the fact that are running on different streams does not imply they will run concurrently.
If the amount of resources needed by the first kernel is such that allows to run the second kernel then it will be the case, otherwise they will run serially.
Make sure to have a cudaSyncThreads() after the two kernel invocations, or sync on both threads. Remember that all the cuda invocations are async.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文