NVIDIA Jetson Nano 4GB, 4.9.140-tegra , CUDA 10-2 till 11-3
Hi i am making a droplet animation while learning CUDA programming, so noob i am.
i am using openglut in a bash terminal enviroment the function is:
global void doeding( int size, float * a, float * b, float * c, float * gloval)
{
int index = threadIdx.x;
int stride = blockDim.x;
float xidx = 0.0;
float yidx = 0.0;
size = ((500 + 2) * (500 + 2));
for (int lidx = index; lidx < size; lidx += stride)
{
xidx = (float)(lidx % 502); yidx = (float)(lidx / 502);
xidx = (xidx==501) ? 500 : xidx ;
xidx = (xidx==0) ? 1 : xidx ;
yidx = (float)(lidx / 502);
yidx = (yidx==501) ? 500 : yidx ;
yidx = (yidx==0) ? 1 : yidx ;
c[(int)((yidx * (500 + 2)) + xidx)] = gloval[0] * ( gloval[1] * (
b[(int)((yidx * (500 + 2)) + (xidx - 1))]
+ b[(int)((yidx * (500 + 2)) + (xidx + 1))]
+ b[(int)(((yidx - 1) * (500 + 2)) + xidx)]
+ b[(int)(((yidx + 1) * (500 + 2)) + xidx)])
- a[(int)((yidx * (500 + 2)) + xidx)]);
}
for (int lidx = 1; lidx < size; lidx++)
{
a[lidx] = b[lidx];
b[lidx] = c[lidx];
}
i start with one pixel at [(250 * 502) + 251] = 1.0;
when i call the global function with <<<1, 1>>> or <<<1, 32>>> everything is fine.
however as soon as i raise in steps of 32 for instance <<<1, 64>>> i get an disturbance on the botom of the screen :
the bottom should look like the top or left or right side of the circle
when i change the number of threads the same thing happens, the only difference is the speed in which this disturbance manifests itself.
What happens in memory when you change the blocksize ?
How can i prevent this disturbance ? and still use all the threads and have higher blocksizes ?
In advance thanks DO_Ray