As can be seen, the value of x is changed (as expected), but the y is 94 for all rows. I was wondering what is wrong? Is something wrong with the code, or I understood the concept of grids/blocks/threads wrong?
There are NxN = 95*95 = 9025 thread blocks. You want to store each block’s [x,y] coordinates in an array. How many elements does that array need? I would claim 9025 elements, because that’s how many blocks there are. How large an array does the code provide?
And also, allocated sizeof(int[N*N][2]) in memory. However, it didn’t work fine so I changed my code to see how x and y vary, the x changes from 0 to 94 and is repeated 94 times for each number, but, the y varies from 51 to 94 and gets repeated 94 times for each number.
What is wrong with y? shouldn’t it begin from 0 and end up to 94?