-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusion about dimensions and update #3
Comments
Confusion about update (resolved): Ah, I think it doesn't matter because this will be the "corner" element, which doesn't matter (it's not even shown in the image above - probably should be shown in grey). |
Confusion about dimensions (proposed fix):
gives this order
Hence, we should probably just relabel |
In a Cartesian view of the world (which I implicitly adopted in these examples), the x-dimsension refers to columns, while the y-dimensions refers to lines. In 2D, selecting a value of x actually means copying an entire vertical slice, while selecting a value of y means copying an entire horizontal slice. Now, confusion comes from the mapping (x, y) from the Cartesian world, to the (x, y) in the array world, where the first entry (here x) refers to the horizontal slice (lines), and the second entry (here y) refers to the vertical slice (columns). The Cartesian -> Array "mapping" may be confusing but is overall present. If you plot a heatmap of a 2D array, it will be actually transposed (as you expect Cartesian layout, but you may get array layout). Some routines correct for that, others not. From my point of view, there is no issue nor confusion, but it's just a matter of facts that Cartesian and array (or linear algebra) layout are "transposed"; (columns, lines) vs (lines, columns). |
The corner case (literally here); the corner cell will be correctly updated if and only if MPI communication is done sequentially amongst spatial dimensions. This will solve the corner case and correctly propagate the update there. |
@luraess, @JBlaschke It would be great if you guys could take a look and enlighten me so that we can fix this :)
(Disclaimer: It's early in the morning here and it might be super obvious.)
Confusion about dimensions
We call
neighbors.x
the neighbors inx
dimension (horizontal dimension), however we copy rows (horizontal slices) of the data grid (A
) into the send buffers:juliacon24-hpcworkshop/parts/mpi/solution/diffusion_2d_mpi.jl
Lines 24 to 26 in b1e77e6
This seems wrong. If a MPI rank needs to send something to the left/right it should be a column (vertical slice), no?
See
At least we're consistently wrong:
juliacon24-hpcworkshop/parts/mpi/solution/diffusion_2d_mpi.jl
Lines 39 to 41 in b1e77e6
I guess this doesn't matter - because who cares about labeling dimensions anyways in a
x <-> y
symmetric system - but it definitley isn't great because we actually refer to those dimensions asx
andy
and even have comments that sayleft neighbor
etc.Confusion about update
(I think I resolved this, see my new comment further down)
At the end of the
dim-1 (x)
communication, we copy the received data to, say,A[1, :]
. However, to prepare for thedim-2 (y)
communication, we copy, say,A[:, 2]
into a send buffer. What confuses me: This copy only happens after thedim-1 (x)
part and thus one element (A[1,2]
) has already been modified as part of thedim-1 (x)
receive (that is, on ranks that have both ax[1]
and ay[1]
neighbor).juliacon24-hpcworkshop/parts/mpi/solution/diffusion_2d_mpi.jl
Lines 36 to 41 in b1e77e6
That's also wrong no?! Shouldn't we have all "copy data of A into send buffers" lines (for both x and y dimension) at the top of the function to ensure that we're really sending the "old A"?
The text was updated successfully, but these errors were encountered: