Combine interact! kernels to reduce GPU latency#1082
Draft
efaulhaber wants to merge 3 commits intotrixi-framework:mainfrom
Draft
Combine interact! kernels to reduce GPU latency#1082efaulhaber wants to merge 3 commits intotrixi-framework:mainfrom
interact! kernels to reduce GPU latency#1082efaulhaber wants to merge 3 commits intotrixi-framework:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Here is the pipe flow 2D example as a benchmark.
2k particles
CPU (72 threads)
For small problems, we can even see a 1.85x speedup on the CPU with combined threaded loops. No timers is slightly faster, but only because of the timer overhead. The only difference is that synchronization is skipped on GPUs.
With
IndividualTimers():With
CombinedTimers():With
NoTimers():GPU (H100)
Here, we get a 2x speedup from combining the kernels and another 1.5x by removing synchronization, giving a total speedup of 3x.
With
IndividualTimers():With
CombinedTimers():With
NoTimers():1.6M particles
CPU (72 cores)
This problem is now so large that the extra overhead from having multiple multithreaded loops is negligible. The performance is identical in all three versions.
With
IndividualTimers():With
CombinedTimers():With
NoTimers():GPU (H100)
On the GPU, we can gain some performance here, with a 7% speedup from combining the kernels and another 7% from removing synchronization.
With
IndividualTimers():With
CombinedTimers():With
NoTimers():10M particles
GPU (H100)
This is now large enough that even the small kernels are large enough for the GPU, so there is no speedup from this PR. I don't know why this is getting slightly slower.
With
IndividualTimers():With
CombinedTimers():With
NoTimers():