multiple kernel calls


I figured out a problem and could not find out what causes this.

I am trying to call multiple kernels.

Case 1:

cudaMalloc array1, array2, array3…;




this works fine. But,

Case 2:

cudaMalloc array1, array2;


cudaMalloc array3, …;

kernel2<<<>>>; // also uses array1 and array2


In Case 2 program crashes almost half of the time. But in Case 1 never…

Is there something I should do for case 2?

Thanks in advance…

I don’t really see a problem with case 2, assuming kernel1 does not use array3.

What do you mean by “crash”? A seg fault?

Are you doing proper cuda error checking? What happens when you run your program with cuda-memcheck?

It gives an exception error in the middle of the program. In Case 1, Kernel can be completed (I see results on console) but Kernel2 is interrupted (I cannot see its results on console) after crash and program ends…

I can give Exception message in detail if needed… Looks like a memory location read fault…

** All procedures are identical in both case 1 and Case2.

You might want to post short, complete, buildable code that reproduces the issue. Trying to debug a program based on extremely rudimentary information by exchanging messages in an online forum, is not a efficient process, nor likely one that leads to a successful conclusion.