Dear PTfS team,
Why are the threads distributed by columns, not rows, since C++ iterates row by row if the outer loop for row iteration?
The "j" outer loop iterates over rows while "i" over columns.
Just rotate the image on the left by 90 degrees, then rows become columns and vice versa.
What you call "row" and "column" in 2D indexing is entirely up to you. In a[i][j], i could be the column and j could be the row, it doesn't matter. It is, however, important to know that in C the last index addresses counts through memory locations.