PIC simulation GPU acceleration: codes, considerations and pitfalls
Updated · Scientifically reviewed by Dinkar Mishra, PhD on
Short answer
PIC maps well to GPUs because millions of particles can be pushed in parallel, but deposition (many particles writing to the same cells) and memory capacity are the hard parts. GPU-native codes such as WarpX, PIConGPU, FBPIC and VPIC 2.0 handle this with particle sorting, atomics or tiling, and careful memory layouts. To use GPUs well, give each GPU enough particles, fit the problem in GPU memory, choose precision deliberately, and balance load across GPUs.
Who this is for
Plasma physicists and HPC users planning GPU-based PIC simulations, or deciding whether to move from CPU codes to GPU codes.
PIC memory calculator
Results update as you type. Scientific notation such as 1e18 is accepted.
| Macro-particles | — | |
|---|---|---|
| Particle memory | — | |
| Field memory | — | |
| Total (+30% buffers) | — | |
| Per device | — |
How it works
A PIC step has four phases, with different GPU characteristics:
| Phase | GPU suitability | Challenge |
|---|---|---|
| Particle push | Excellent: independent per particle | Memory bandwidth (load fields, update positions and momenta) |
| Field gather | Good | Irregular reads from grid memory |
| Current/charge deposition | Hard | Many particles write to the same cells, so atomics, sorting or tiling are needed |
| Field solve (FDTD) | Excellent: regular stencil | Bandwidth-bound; spectral solvers need FFTs |
GPU codes keep particles sorted by cell or tile, so that nearby threads touch nearby memory and deposition conflicts stay local. They also keep all data resident on the GPU and avoid host transfers except for diagnostics.
Planning a GPU run
- Estimate memory. Each GPU must hold its share of particles and fields. Use the calculator above or the PIC memory calculator. In double precision with 3 positions, 3 momenta and 2 extra attributes, each particle needs 64 bytes.
- Choose the GPU count so that memory fits with headroom and each GPU still has plenty of particles.
- Plan load balance. Laser–plasma and target problems are often highly non-uniform. Use your code’s dynamic load balancing and check the per-GPU time.
- Limit diagnostics. Large field dumps move data from GPU to host and to disk, so write only what you need.
- Estimate cost in GPU-hours with the PIC Simulation Planner and compare options with the HPC Cost Estimator.
Precision and verification
GPUs offer large throughput gains in single precision, and many PIC codes support mixed or single precision. Before production:
- run a short representative case in double and single precision and compare reported quantities;
- check total energy conservation over the planned run length;
- repeat the convergence test on the GPU configuration you will actually use.
Common pitfalls
- Strong-scaling too far. Spreading a modest problem over many GPUs leaves each underused. Measure time per step versus GPU count; see strong vs weak scaling.
- Out of memory mid-run. Particle numbers grow through ionisation or injection, and load imbalance concentrates particles on some GPUs. Leave headroom.
- Comparing CPU and GPU runs that are not equivalent. Precision, shape order, filters or solver choices can differ by default between builds.
Assumptions and limitations
- Code capabilities summarise their documentation at the time of writing. GPU support evolves quickly.
- Performance depends on GPU model, code version, physics modules and problem layout. No speedup numbers are claimed; benchmark your case.
- For porting your own PIC or plasma code to GPUs, see our GPU code porting page.
Frequently asked questions
Which PIC codes run on GPUs?+
GPU-native or GPU-capable open codes include WarpX (CUDA, HIP, SYCL via AMReX), PIConGPU (CUDA, HIP via alpaka), FBPIC (CUDA via Numba/CuPy) and VPIC 2.0 (Kokkos). Smilei has been adding GPU support. EPOCH is primarily a CPU code. Check current documentation for features available on GPUs.
Is single precision safe for PIC?+
Often, for laser–plasma and beam simulations, with care for long runs and large dynamic ranges, and many GPU runs use it to halve memory and increase speed. Verify by comparing key results with a double-precision run of a representative case.
How many particles should each GPU have?+
Enough to keep it busy: typically tens of millions of particles or more per modern GPU. With too few, overheads dominate and strong scaling stops. Measure time per step as you change the number of GPUs.
Can a CPU code simply be recompiled for GPUs?+
No. Efficient GPU PIC requires different data layouts, parallel deposition strategies and minimal host–device transfers. Porting is a substantial software project; using an existing GPU-native code is usually faster.
References
- WarpX documentation · WarpX developers
- PIConGPU documentation · PIConGPU developers
- Bird et al., VPIC 2.0: next generation particle-in-cell simulations, IEEE TPDS 33(4), 952 (2022) · Peer-reviewed article
- Decyk & Singh, Particle-in-cell algorithms for emerging computer architectures, Comput. Phys. Commun. 185, 708 (2014) · Peer-reviewed article
Need help applying this?
Our physicists turn concepts into working, verified simulations for research groups and companies.
Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.
Spotted an error or an outdated command? Tell us. We correct verified issues promptly.