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

sort particles per mesh cell #58

Open
alecjohnson opened this issue Oct 16, 2013 · 0 comments
Open

sort particles per mesh cell #58

alecjohnson opened this issue Oct 16, 2013 · 0 comments

Comments

@alecjohnson
Copy link
Contributor

Particles are currently sorted by MPI subdomain. If one only uses MPI parallelization, then this allows for efficient pushing of particles and summing of moments as long as 10_nxn_nyn_nzn_sizeof(double) fits in cache. But to support effective use of vector units (such as on Intel's Xeon and Xeon Phi processors) to push particles and sum moments, we need to sort particles at the level of individual mesh cells.

Sorting particles at the cell level will have benefits that extend beyond vectorization. Benefits of this fine-grain particle locality include:

  • ability to relax the particle distribution to Maxwellian. This will allow for smooth coupling of iPic3D to fluid models.
  • ability to efficiently merge and appropriately split or resample particles. This can be used to maintain appropriate resolution of velocity space.
  • ability to collide particles. This would allow to extend use of iPic3D to problems that involve interacting species.

If particles are sorted per mesh cell then we can vectorize the task of a single iteration of pushing all particles positioned in a given cell, because pushing them uses the same field data. Note that with each iteration of the particle solver, the position (xp, yp, zp) used to interpolate from the field is updated, and the particles need to be resorted.

To sort particles at the cell level, we can sort by the Z-value of the cell in the mesh of each MPI process. The Z-value is computed by interleaving the bits of the x, y, and z array indices. We can adapt the multisort code that Maria Elena and I worked with at the workshop at Barcelona Supercomputing Centre in July in order to do fast, thread-safe sorting based on the Z-value. An alternative would be to simply walk through the particles and move them if necessary to the correct cell, but doing this in a thread-safe way would take some care.

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

No branches or pull requests

1 participant