I have some lines of code that give a non expected output, and I do not get to understand why this unexpected behaviour occurs. Maybe someone can try to help me uderstand.
Simplified version of the code:
// In another function
dim3 gridSize, gridSize2;
dim3 blockSize, blockSize2;
blockSize.x = 1; //Threads per block
blockSize.y = frameHeightP;
gridSize.x = frameWidth; // Blocks per grid
gridSize.y = 1;
__global__ void MyKern(//inputs)
{
int deltaxSamp;
int x = blockIdx.x; // each col
int y = threadIdx.y; // each row
for (int channel_i = 0; channel_i<frameWidth; channel_i++) //each elem
{
deltaxSamp = abs(channel_i - x);
if (x < frameWidth && y < frameHeightP)
{
if( condition1 involves deltaxSamp)
{
if(condition2)
{
tempOutputMatrix[y + (channel_i*frameHeightP)] =
tempOutputMatrix[y + (channel_i*frameHeightP)] +
inputMatrix[delayIndexD[ (channel_i*frameWidth*frameHeightP) + (y*frameWidth) + x ] + x*frameHeightP ] ;
}
}
}
}
}
The important line of the code is
“tempOutputMatrix[y + (channel_iframeHeightP)] = tempOutputMatrix[y + (channel_iframeHeightP)] + inputMatrix[delayIndexD[ (channel_iframeWidthframeHeightP) + (yframeWidth) + x ] + xframeHeightP ];”
I would expect the output (a matrix/image) to be STEADY, instead I get TINTLING data. Why?