Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:

C++
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.
Posted
Updated 10-Nov-14 21:11pm
v6
Comments
Richard MacCutchan 6-Nov-14 8:49am    
How can we help when we have no idea how your code works? Please edit your question and show the parts of your code that does not work, and explain exactly what happens.
KarstenK 6-Nov-14 14:15pm    
I guess that the declaration of these functions have subtile bugs. but without code it is only guessing ...

1 solution

Often when this happens, it is due to your kernel launch parameters. When debugging, print these values to check if they are within the bounds of your hardware.

A second way of debugging is by using the cudaGetLastError() function (documentation). It returns a cudaError_t, which you can pass to cudaGetErrorString() (documentation).

E.g.
C++
cout << "Blocks: " << blocks << ", Threads: " << threads << '\n';
kernel<<< blocks, threads >>>(params);
cout << "Error: " << cudaGetErrorString(cudaGetLastError()) << '\n';
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900