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

OMP parallelize Beam pusher #1161

Merged

Conversation

AlexanderSinn
Copy link
Member

@AlexanderSinn AlexanderSinn commented Sep 13, 2024

When compiling for CPUs, amrex::ParallelFor only uses a single OMP thread. Some ParallelFor loops in hipace are outside MFIter loops, so to use multiple threads we need to define our own PrallelFor that uses OMP when compiling for CPU.

When compiling for GPU the normal  amrex::ParallelFor is used.

The new omp ParallelFor is used in both the beam and plasma pushers. The plasma pusher was omp parallelized previously. The new version has the same performance but is cleaner (hide whitespace). The beam pusher was not omp parallelized before and could be comparatively very slow when using many threads. Now it's fast.

  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn added component: plasma About the plasma species component: beam About the beam species cleaning Code cleaning, avoid duplication, better naming, better style etc. performance optimization, benchmark, profiling, etc. labels Sep 13, 2024
Copy link
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

@MaxThevenet MaxThevenet merged commit 624c7ed into Hi-PACE:development Oct 7, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleaning Code cleaning, avoid duplication, better naming, better style etc. component: beam About the beam species component: plasma About the plasma species performance optimization, benchmark, profiling, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants