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

Particle Push: OpenMP Not Working if no Collective Effects #847

Open
ax3l opened this issue Feb 12, 2025 · 1 comment
Open

Particle Push: OpenMP Not Working if no Collective Effects #847

ax3l opened this issue Feb 12, 2025 · 1 comment
Assignees
Labels
backend: openmp Specific to OpenMP execution (CPUs) bug: affects latest release Bug also exists in latest release version bug Something isn't working component: distributions beam distributions tracking: particles

Comments

@ax3l
Copy link
Member

ax3l commented Feb 12, 2025

Tested with 1 MPI rank:
It looks like setting OMP_NUM_THREADS to values greater than 1 neither accelerates tracking nor space charge calculations right now. This is a defect.

The init logic shows we use multiple threads, but tracking takes as long with 1 as with 4 threads as of 25.02.

Reproducer:

  • any test w/o collective effects on CPU, e.g., FODO Cell

Reproducer (private link):

@ax3l ax3l added backend: openmp Specific to OpenMP execution (CPUs) bug Something isn't working bug: affects latest release Bug also exists in latest release version labels Feb 12, 2025
@ax3l ax3l changed the title OpenMP Not Working? OpenMP Not Working if no Collective Effects Feb 18, 2025
@ax3l
Copy link
Member Author

ax3l commented Feb 18, 2025

Update: @atmyers is working on this right now.

For runs w/o collective effects, we do never call Redistribute to keep a perfect load balance of particles.

The problem stems from particle init, where we have to assign particles to OMP_NUM_THREAD tiles to make sure we have tiles available for OpenMP threads.

The init logic is here:
https://github.com/ECP-WarpX/impactx/blob/25.02/src/initialization/InitDistribution.cpp#L281-L314
And identically here:
https://github.com/ECP-WarpX/impactx/blob/25.02/src/elements/Source.cpp#L116-L120

Calling the same AddNParticles using device vectors:
https://github.com/ECP-WarpX/impactx/blob/25.02/src/particles/ImpactXParticleContainer.cpp#L122-L202

@ax3l ax3l changed the title OpenMP Not Working if no Collective Effects Particle Push: OpenMP Not Working if no Collective Effects Feb 18, 2025
@ax3l ax3l added the component: distributions beam distributions label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: openmp Specific to OpenMP execution (CPUs) bug: affects latest release Bug also exists in latest release version bug Something isn't working component: distributions beam distributions tracking: particles
Projects
None yet
Development

No branches or pull requests

3 participants