Hey everybody,
I am trying to convert a RGB video image to gray image.After GPU have processed one frame image and delay time t,then continue to process the next frame(eg.FPS=25,delay 40ms).
The problem is that: on GeForce 9800GTã€Window Xpã€Intel Pentium4 CPU ,the execution time of the Kernel would CHANGE suddenly.For example ,after processing M images,the
execution time changes from 0.40ms to 3.60ms.But,on 8600GX,windows xp,Intel celeron CPU or 8600GX,window xp,Intel Core™2 CPU ,this phenomenon never hanppens,I don`t know Why.Any idea?thanks!
//The main Fun
int main()
{
...
while(1)
{
GPUFun(oData,iData,iWidth,iHeight,iStep);
Sleep(640);//delay 640ms
}
...
}
//GPUFun
void GPUFUn(…)
{
...
unsigned int timer;
cutCreateTimer(&timer);
cutResetTimer(timer);
cutStartTimer(timer);
for(int i=0;i <10;i++)
{
kernel_gray < < <blocks,threads,0>>>(dev_o,dev_i,width,height,step);
}
cudaThreadSynchronize();
cutStopTimer(timer);
printf("%0.2f ",cutGetTimerValue(timer)/10);
...
}
//Kernel
global void kernel_gray(unsigned char *od,unsigned char *id,int w,int h,int step)
{
short y=blockIdx.y*blockDim.y+threadIdx.y;
short x=blockIdx.x*blockDim.x+threadIdx.x;
if(x <w&&y <h)
od[yw+x]=0.3tex2D(tex,3x,y)+0.59tex2D(tex,3x+1,y)+0.11
tex2D(tex,3*x+2,y);
}
The result of the processing time When delay 640ms on 9800GT :
0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.52 0.52 0.52 0.49 0.49 0.49 0.49 0.49
0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49
0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 3.66 3.66 3.65
3.66 3.66 3.66 3.67
The result of the processing time When delay 320ms on 9800 :
0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49
0.49 0.49 0.49 0.49 0.55 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49
0.49 0.49 0.49 0.49 0.49 0.51 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49
0.49 0.49 0.49 0.53 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49
0.49 0.49 0.49 0.53 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.51 0.49 0.49
0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 0.49 3.67 3.66 3.66 3.66 3.67 3.78 3.66
3.65 3.66 3.67 3.66 3.66 3.66