Previous | Next --- Slide 8 of 72
Back to Lecture Thumbnails
sushi

Can anyone tell me why it's N+2 instead of N? I miss that in class. Thanks!

sushi

And I think that there's a mistake in the code. It should be "allocate(rows_per_thread+2, N+2)" instead of "allocate(N+2, rows_per_threads+2)".

jocelynh

If you see lecture 4, slide 24, the grid is actually of size (N+2)x(N+2), but we only compute for the inner N rows and columns. (Because otherwise we wouldn't have the data to calculate for the edges.)

unparalleled

The N+2 X N+2 space is required to store the two additional rows in each dimension. All though we will not update those rows in that thread, we still need space to store the values when they are communicated by the neighboring threads.

eosofsky

A problem with the ghost cell implementation is that it requires additional memory to replicate the data owned by neighboring threads (the exact same data values are stored in 2 different thread's address spaces for each border row).