Skip to content
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

Add bufferguard example #166

Merged
merged 1 commit into from
Mar 19, 2021

Conversation

bernhardmgruber
Copy link
Member

This example showcases a custom LLAMA mapping splitting a 2D array of 3 component vectors into 9 regions.
These 9 regions are the center part of the array, 4 guard regions at the left, right, top and bottom border and the 4 corners of the array.
The content of the blobs belonging to one guard region of a view are copied to blobs of a corresponding guard region of another view.
Such a workflow is typical for HPC applications where the guard regions are exchanged between compute nodes.

Command line output:

View 1:
[  1,  2,  3][  4,  5,  6][  7,  8,  9][ 10, 11, 12][ 13, 14, 15]
[ 16, 17, 18][ 19, 20, 21][ 22, 23, 24][ 25, 26, 27][ 28, 29, 30]
[ 31, 32, 33][ 34, 35, 36][ 37, 38, 39][ 40, 41, 42][ 43, 44, 45]
[ 46, 47, 48][ 49, 50, 51][ 52, 53, 54][ 55, 56, 57][ 58, 59, 60]
[ 61, 62, 63][ 64, 65, 66][ 67, 68, 69][ 70, 71, 72][ 73, 74, 75]
[ 76, 77, 78][ 79, 80, 81][ 82, 83, 84][ 85, 86, 87][ 88, 89, 90]
[ 91, 92, 93][ 94, 95, 96][ 97, 98, 99][100,101,102][103,104,105]

View 2:
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]

Copy view 1 right -> view 2 left:
View 2:
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 28, 29, 30][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 43, 44, 45][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 58, 59, 60][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 73, 74, 75][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 88, 89, 90][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]

Copy view 1 left top -> view 2 right bot:
View 2:
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 28, 29, 30][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 43, 44, 45][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 58, 59, 60][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 73, 74, 75][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[ 88, 89, 90][  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0]
[  0,  0,  0][  0,  0,  0][  0,  0,  0][  0,  0,  0][  1,  2,  3]

Copy view 2 center -> view 1 center:
View 1:
[  1,  2,  3][  4,  5,  6][  7,  8,  9][ 10, 11, 12][ 13, 14, 15]
[ 16, 17, 18][  0,  0,  0][  0,  0,  0][  0,  0,  0][ 28, 29, 30]
[ 31, 32, 33][  0,  0,  0][  0,  0,  0][  0,  0,  0][ 43, 44, 45]
[ 46, 47, 48][  0,  0,  0][  0,  0,  0][  0,  0,  0][ 58, 59, 60]
[ 61, 62, 63][  0,  0,  0][  0,  0,  0][  0,  0,  0][ 73, 74, 75]
[ 76, 77, 78][  0,  0,  0][  0,  0,  0][  0,  0,  0][ 88, 89, 90]
[ 91, 92, 93][ 94, 95, 96][ 97, 98, 99][100,101,102][103,104,105]

Dump of mapping:
image

We can beautifully see the 4 blobs for the corner regions, the 2 long blobs for left/right, the 2 shorter blobs for bot/top and the large blob for the center region.

@bernhardmgruber
Copy link
Member Author

SoA:
image

SoA with 1 blob per element (except first 4 blobs with are mapped using llama::mapping::One):
image

@psychocoderHPC
Copy link
Member

@bernhardmgruber I love llama and I am so sad that I have not enough time to integrate it directly into PIConGPU 😢

@bernhardmgruber
Copy link
Member Author

bernhardmgruber commented Mar 10, 2021

@bernhardmgruber I love llama and I am so sad that I have not enough time to integrate it directly into PIConGPU 😢

Thank you for the praise! :) In fact, this example is primarily motived by some ideas you sketched in the last alpaka VC. I built it for you <3. Jokes aside, LLAMA should see at least a proof-of-concept PIConGPU integration at some point.

@bussmann
Copy link

Github love stories ❤

@bussmann
Copy link

Btw: I really like this. Excellent work!

@bernhardmgruber
Copy link
Member Author

Btw: I really like this. Excellent work!

Thank you! This means something to me.

This example showcases a custom LLAMA mapping splitting a 2D array of 3 component vectors into 9 regions.
These 9 regions are the center part of the array, 4 guard regions at the left, right, top and bottom border and the 4 corners of the array.
The content of the blobs belonging to one guard region of a view are copied to blobs of a corresponding guard region of another view.
Such a workflow is typical for HPC applications where the guard regions are exchanged between compute nodes.
@bernhardmgruber bernhardmgruber marked this pull request as ready for review March 19, 2021 14:03
@bernhardmgruber bernhardmgruber merged commit c491b16 into alpaka-group:develop Mar 19, 2021
@bernhardmgruber bernhardmgruber deleted the bufferguard branch March 19, 2021 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants