kernel failed after few invokation

Hi

i have a kernel that is invoked in a loop on host.
the problem is that when i run my kernel on vs08 on window, the kernel work well for first few iteration of loop but after 3 or 4 times that kernel invoked, the kernel fail to work and output of my kernel become unchanged. sometimes only first iteration of my loop working well and for the other iteration kernel fail to work.
note that the output of my kernel for few times that kernel was executed is correct.
another note is that i had run this kernel on linux and i have see this differences:
for first iteration output of my kernel is wrong and for other iteration the output is same as first iteration but kernel not failed to run.
who can help me?

Hi

i have a kernel that is invoked in a loop on host.
the problem is that when i run my kernel on vs08 on window, the kernel work well for first few iteration of loop but after 3 or 4 times that kernel invoked, the kernel fail to work and output of my kernel become unchanged. sometimes only first iteration of my loop working well and for the other iteration kernel fail to work.
note that the output of my kernel for few times that kernel was executed is correct.
another note is that i had run this kernel on linux and i have see this differences:
for first iteration output of my kernel is wrong and for other iteration the output is same as first iteration but kernel not failed to run.
who can help me?

Could be anything…you need to paste some kernel code. Maybe the grid/block parameters exceed limits for some iterations, if they’re variable?

You could try commenting out some instructions from your kernel to see if the bug you’re seeing depends on any of them.

Could be anything…you need to paste some kernel code. Maybe the grid/block parameters exceed limits for some iterations, if they’re variable?

You could try commenting out some instructions from your kernel to see if the bug you’re seeing depends on any of them.

here is my code:

[/code]

//host code:

//grid and block dimention

dim3 dimBlock  (16,1,1);

dim3 dimGrid  (1,1);

//device code:

//kernel 

.

.

comp = threadIdx.x;

if(comp == 0) {

.

do some caculations

.

}

if(comp == 1) {

.

do some caculations

.

}

.

.

.

if(comp == 15) {

.

do some calculations

.

}[code]

each thread do some work from begining of my kernel.

enyone can help me?

here is my code:

[/code]

//host code:

//grid and block dimention

dim3 dimBlock  (16,1,1);

dim3 dimGrid  (1,1);

//device code:

//kernel 

.

.

comp = threadIdx.x;

if(comp == 0) {

.

do some caculations

.

}

if(comp == 1) {

.

do some caculations

.

}

.

.

.

if(comp == 15) {

.

do some calculations

.

}[code]

each thread do some work from begining of my kernel.

enyone can help me?

The code that you pasted seems OK, although terribly slow.
The problem must reside either:

  • in one of the codes you dotted out
  • or in a way you call the kernel itself from the host code

The code that you pasted seems OK, although terribly slow.
The problem must reside either:

  • in one of the codes you dotted out
  • or in a way you call the kernel itself from the host code

it seems to my code worked well.

in calling kernel if it has a problem why this problem not apear in first few calling of kernel?

it seems to my code worked well.

in calling kernel if it has a problem why this problem not apear in first few calling of kernel?