Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During the course of the Eurohack24 hackathon at CSCS, we worked on performance analysis of our full PIC code by looking at the performance of the Alpine mini-app Landau Damping on the Nvidia A100 GPU cluster at PSI.
The results showed that the scatter operation could be sped up quite a bit by implementing a sorting of particles which are in the same cell, which increases data locality when having to do the atomic add for the interpolation, and avoids throwing away the cache. Furthermore, we can add locally within the cell and then do a single atomic add to the actual field grid point.
The motivation and results are shown in the slides attached. The zip file contains the Nvidia nsight systems reports for the different runs we did to test the performance improvements.
sorted_scatter_PR.pdf
final_reports.zip
This still needs some clean-up; namely improving the design (e.g. by making a class for the sort) and improving the sorting algorithm itself, which is not yet optimal. Additionally, the next goal to improve performance would be using Kokkos team policy and scatter many cells per team.