无法在CUDA中执行内核函数

无法在CUDA中执行内核函数

本文介绍了无法在CUDA中执行内核函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我的程序中有几个内核函数。一些内核函数确实执行,但有些内核函数没有执行。无法得到什么问题。编译时的程序不会出现任何错误,也不会出现编译错误或任何运行时错误。请帮忙。



一个内核函数在嵌套循环中,如下所示:



  for (init; condition; re-initialization)
{
----;
----;
----;
for (init; condition; re-initialization)
{
Kernel1<<< blocks,threads>>> ;(参数);
}
}

Kernel2<<<< blocks,threads>>>(arguments);
----;
----;
----;
Kernel3<<<< blocks,threads>>>(arguments);





如果我放入内核函数,Kernel1,在嵌套循环内部如上图所示,其余的内核函数也执行,但是如果我把这个内核函数放在循环之外,因为内核函数不应该放在任何循环中,其余的都不会被执行一点。



它有助于理解吗?再一次,在此先感谢。

解决方案


Hello,

I have several kernel functions in my program. Some kernel functions do execute, but some others do not. Can't get what is the problem. The program upon compilation do not give any error, neither compilation error nor any runtime error. Please help.

One kernel function is in a nested loop, like below:

for(init; condition; re-initialization)
{
     ----;
     ----;
     ----;
    for(init; condition; re-initialization)
    {
       Kernel1<<<blocks, threads>>>(arguments);
    }
}

Kernel2<<<blocks, threads>>>(arguments);
----;
----;
----;
Kernel3<<<blocks, threads>>>(arguments);



If I put the kernel function, Kernel1, inside the nested loop as shown above, the rest of the kernel functions also execute, but if I put this kernel function outside the loop, since the kernel function should not be put inside any loop, the rest do not get executed at all.

Will it help in understanding? Once again, thanks in advance.

解决方案


这篇关于无法在CUDA中执行内核函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 17:32