Skip to content

Commit 0b8294d

Browse files
atmyersax3l
andauthored
Add information about generating particles for GPU codes to the docs (#4760)
The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [x] include documentation in the code and/or rst files, if appropriate --------- Co-authored-by: Axel Huebl <[email protected]>
1 parent d0e3bc8 commit 0b8294d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Docs/sphinx_documentation/source/Particle.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,18 @@ particles, if the processes generate particles they don't own (for example, if
309309
the particle positions are perturbed from the cell centers and thus end up
310310
outside their parent grid).
311311

312+
.. note::
313+
314+
The above code snippet, which successively calls :cpp:`push_back` on the particle
315+
vectors, assumes you have compiled AMReX for CPU execution.
316+
For GPU codes, one can either generate particles on the host and copy them
317+
to the device, or generate the particles directly on the GPU. For the first
318+
approach, please see the sample code `here <https://github.com/AMReX-Codes/amrex/blob/development/Tests/Particles/Redistribute/main.cpp#L81>`__.
319+
For an example of generating a variable number of particles in each cell
320+
directly on the GPU, please see
321+
`this <https://github.com/AMReX-Codes/amrex-tutorials/blob/main/ExampleCodes/Particles/ElectromagneticPIC/Source/EMParticleContainerInit.cpp#L48>`__
322+
Electromagnetic Particle-in-Cell tutorial
323+
312324
.. _sec:Particles:Runtime:
313325

314326
Adding particle components at runtime

0 commit comments

Comments
 (0)