Subsection on parallelization
This commit is contained in:
Binary file not shown.
+83
-2
@@ -1177,6 +1177,87 @@ schemes that allow for the injection of realistic laser pulses
|
||||
|
||||
% Eliasson_2002.pdf outflow condition for Fourier transformed Vlasov-poison system
|
||||
|
||||
\subsection{Parallelization}
|
||||
\label{subsec:num:parallel}
|
||||
|
||||
Hopefully you are convinced by now that Particle-in-Cell codes are actually a
|
||||
fairly approachable simulation method that can great insights into the
|
||||
microphysics of kinetic plasmas. But there is one downside compared to other
|
||||
methods explained in this book: A huge number of particles and a large number
|
||||
of time steps is required to simulate physically relevant systems. And even
|
||||
then we are not covering macroscopic scales. To increase the maximum size of
|
||||
the problem that can be studied and to reduce the time a scientist has to wait
|
||||
before obtaining results that can be studied parallelization is extremly common
|
||||
and has been used for a long time.
|
||||
|
||||
This parallelization can make use of vectorization in the form of
|
||||
single-instruction-multiple-data (SIMD) \cite{Bowers_2008}. Details of this
|
||||
depend on the platform that the code targets (CPUs, GPUs, accelerator cards and
|
||||
so on). The recent arrival of performance portability frameworks such as Kokkos
|
||||
\cite{Edwards_2014} or RAJA \cite{Beckingsale_2019} are changing the codes from
|
||||
carefully formulated C++ and Fortran codes that can be vectorized by the
|
||||
compiler and handwritten assembler primitives to higher level of abstraction.
|
||||
While good reference literature on the topic is rare, the field is changing too
|
||||
rapidly for us to give good advice that will still be relevant in one or two
|
||||
decades.
|
||||
|
||||
The next level of parallelization that is often employed is the use of parallel
|
||||
threads within a process. This might be OpenMP threads \cite{Dagum_1998,
|
||||
Larsgard_2007}, pthreads or other language level features for parallelism. This
|
||||
can be used to use the multiple cores that all current computers offer. Often
|
||||
the user has to manually ensure that no data races or other problems between
|
||||
different threads exist. Since this can be hard to ensure, some codes opt not
|
||||
to make use of these techniques.
|
||||
|
||||
Since the compute power of a single machine is only sufficient for very
|
||||
selected problems and the memory can only hold approximately one billion
|
||||
particles in RAM, it is commonly required to parallelize the code over many
|
||||
nodes. Each node runs one (or more) separate process that communicate with
|
||||
eachother and share the simulation workload. For the communication MPI
|
||||
\cite{Walker_1996} is the defacto standard but recently frameworks have started
|
||||
to appear that take care of threading and communication for the programmer.
|
||||
|
||||
The common way to distribute the workload is to split the simulation domain
|
||||
into smaller local domains (also known as patches or blocks). Each process is
|
||||
then responsible for the particles and fields in that local domain
|
||||
\cite{Pfund_1998, Plimpton_2000, Qiang_2000, Messmer_2001, Qiang_2010}. The
|
||||
state of the electromagnetic field in neighbouring domains is then copied into
|
||||
ghost zones that surround the local domain and act as boundary
|
||||
conditions\footnote{The reason why this works efficiantly is that the the
|
||||
particle shape function have only compact support and the field update only
|
||||
requiring neighboring cells. However with extra effort domain decomposition can
|
||||
also be applied to spectral solvers\cite{Vay_2013}.}. Particles that hit the
|
||||
boundary of the local domain are communicated to the neighbouring process,
|
||||
inject from the wall there and are removed from the local domain.
|
||||
Particle-in-Cell codes tend to parallelize very efficiently using this method
|
||||
since only communication with a handfull of neighbors is required and global
|
||||
all-to-all messaging can be nearly completely avoided. The only caveat is that
|
||||
efficiency only remains high as long as all processes have fairly balanced
|
||||
workloads. If the setup starts unbalanced (e.g. because of a bad decomposition
|
||||
or because of inhomogeneous plasma density) or develops load imbalances over
|
||||
the course of the simulation (typically in reconnection simulations when
|
||||
plasmoids are generated, or shock simulations where the downstream has higher
|
||||
density than the upstream) the parallelization efficancy drops. One can attempt
|
||||
to improve load balance the simulation by imoving the boundaries between local
|
||||
domains and making additional grid cells and particles the responsibility of
|
||||
less loaded processes, but this requires much more complicated code and incures
|
||||
additional costs.
|
||||
|
||||
An alternative to splitting the global domain into rectangular or brick-shaped
|
||||
local domains is to compute a space filling curve that forms a 1d path that
|
||||
goes through all grid cells exactly once
|
||||
\cite{Beck_2016,Germaschewski_2016,Barsamian_2018,Miller_2021}. Additionally
|
||||
the space filling curve has the properties that grid cells that are close to
|
||||
each other along the curve are also mostly close to each other in the full 2d
|
||||
or 3d space. When the curve is then cut into segments to be distributed across
|
||||
processes the cells of each process tend to be close to each other. For most of
|
||||
it's grid cells the process also owns the neighbouring field values and can use
|
||||
those without additional communication. Moving particles that enter another
|
||||
grid cell are likely to stay with the same process. If they do leave they are
|
||||
communicated to the correct neighboruing process same as in the case with patch
|
||||
based domain decomposition. The big upside is that the segments of the space
|
||||
filling curve do not have to be equally long and can be rebalanced more easily.
|
||||
|
||||
\subsection{Diagnostics}
|
||||
\label{subsec:num:diag}
|
||||
|
||||
@@ -1205,11 +1286,11 @@ the particles. The diagnostic is also very valuable to check conservation of tot
|
||||
Another obvious candidate for output are gridded quantities, such as electric
|
||||
and magnetic field as well as current density. These quantities do not
|
||||
require any extra calculation. The two most widely used choices are dumping
|
||||
the memory of every MPI domain to a separate binary file or writing a global
|
||||
the memory of every local domain (in a simulation that uses domain decomposition and MPI) to a separate binary file or writing a global
|
||||
view to a structured format such as HDF5\footnote{other formats are available,
|
||||
but HDF5 is widely supported by many post-processing tools}. The first choice
|
||||
has the advantage of low overhead as nearly no metadata is saved. The downside
|
||||
is that the separate views of the different domains need to be combined for
|
||||
is that the separate views of the different local domains need to be combined for
|
||||
further analysis. The overhead of creating many files at once and the tedious
|
||||
file handling make this alternative a poor choice for more than a few hundred
|
||||
cores. Parallel I/O to HDF5 requires slightly more complicated I/O code and
|
||||
|
||||
@@ -1858,3 +1858,162 @@ doi = {https://doi.org/10.1016/0021-9991(72)90048-4},
|
||||
url = {https://www.sciencedirect.com/science/article/pii/0021999172900484},
|
||||
}
|
||||
|
||||
@article{Pfund_1998,
|
||||
author = {Pfund,R. E. W. and Lichters,R. and Meyer-ter-Vehn,J. },
|
||||
title = {LPIC++ a parallel one-dimensional relativistic electromagnetic Particle-In-Cell code for simulating laser-plasma-interaction},
|
||||
journal = {AIP Conference Proceedings},
|
||||
volume = {426},
|
||||
number = {1},
|
||||
pages = {141-146},
|
||||
year = {1998},
|
||||
doi = {10.1063/1.55199},
|
||||
URL = {https://aip.scitation.org/doi/abs/10.1063/1.55199},
|
||||
}
|
||||
|
||||
@article{Qiang_2000,
|
||||
title = {An Object-Oriented Parallel Particle-in-Cell Code for Beam Dynamics Simulation in Linear Accelerators},
|
||||
journal = {Journal of Computational Physics},
|
||||
volume = {163},
|
||||
number = {2},
|
||||
pages = {434-451},
|
||||
year = {2000},
|
||||
issn = {0021-9991},
|
||||
doi = {https://doi.org/10.1006/jcph.2000.6570},
|
||||
author = {Ji Qiang and Robert D. Ryne and Salman Habib and Viktor Decyk},
|
||||
}
|
||||
|
||||
@InProceedings{Messmer_2001,
|
||||
author="Messmer, Peter",
|
||||
editor="S{\o}revik, Tor
|
||||
and Manne, Fredrik
|
||||
and Gebremedhin, Assefaw Hadish
|
||||
and Moe, Randi",
|
||||
title="Par-T: A Parallel Relativistic Fully 3D Electromagnetic Particle-in-Cell Code",
|
||||
booktitle="Applied Parallel Computing. New Paradigms for HPC in Industry and Academia",
|
||||
year="2001",
|
||||
publisher="Springer Berlin Heidelberg",
|
||||
address="Berlin, Heidelberg",
|
||||
pages="350--355",
|
||||
isbn="978-3-540-70734-9"
|
||||
}
|
||||
|
||||
@article{Plimpton_2000,
|
||||
title = {Load-balancing techniques for a parallel electromagnetic particle-in-cell code},
|
||||
author = {Plimpton, Steven J and Seidel, David B and Pasik, Michael F and Coats, Rebecca S},
|
||||
doi = {10.2172/751032},
|
||||
url = {https://www.osti.gov/biblio/751032},
|
||||
journal = {},
|
||||
place = {United States},
|
||||
year = {2000},
|
||||
month = {1}
|
||||
}
|
||||
|
||||
@article{Qiang_2010,
|
||||
title = {Particle-field decomposition and domain decomposition in parallel particle-in-cell beam dynamics simulation},
|
||||
journal = {Computer Physics Communications},
|
||||
volume = {181},
|
||||
number = {12},
|
||||
pages = {2024-2034},
|
||||
year = {2010},
|
||||
issn = {0010-4655},
|
||||
doi = {https://doi.org/10.1016/j.cpc.2010.08.021},
|
||||
url = {https://www.sciencedirect.com/science/article/pii/S0010465510003127},
|
||||
author = {Ji Qiang and Xiaoye Li},
|
||||
}
|
||||
|
||||
@article{Edwards_2014,
|
||||
title = "Kokkos: Enabling manycore performance portability through polymorphic memory access patterns ",
|
||||
journal = "Journal of Parallel and Distributed Computing ",
|
||||
volume = "74",
|
||||
number = "12",
|
||||
pages = "3202--3216",
|
||||
year = "2014",
|
||||
note = "Domain-Specific Languages and High-Level Frameworks for High-Performance Computing ",
|
||||
issn = "0743-7315",
|
||||
doi = "https://doi.org/10.1016/j.jpdc.2014.07.003",
|
||||
author = "H. Carter Edwards and Christian R. Trott and Daniel Sunderland"
|
||||
}
|
||||
|
||||
@inproceedings{Beckingsale_2019,
|
||||
title={RAJA: Portable performance for large-scale scientific applications},
|
||||
author={Beckingsale, David A and Burmark, Jason and Hornung, Rich and Jones, Holger and Killian, William and Kunen, Adam J and Pearce, Olga and Robinson, Peter and Ryujin, Brian S and Scogland, Thomas RW},
|
||||
booktitle={2019 ieee/acm international workshop on performance, portability and productivity in hpc (p3hpc)},
|
||||
pages={71--81},
|
||||
year={2019},
|
||||
organization={IEEE}
|
||||
}
|
||||
|
||||
@article{Dagum_1998,
|
||||
author={L. {Dagum} and R. {Menon}},
|
||||
journal={IEEE Computational Science and Engineering},
|
||||
title={OpenMP: an industry standard API for shared-memory programming},
|
||||
year={1998},
|
||||
volume={5},
|
||||
number={1},
|
||||
pages={46-55},
|
||||
doi={10.1109/99.660313}},
|
||||
}
|
||||
|
||||
@masterthesis{Larsgard_2007,
|
||||
author = {Nils Magnus Larsgård and Supervisor Anne and Cathrine Elster},
|
||||
title = {Parallelizing Particle-In-Cell Codes with OpenMP and MPI},
|
||||
school = {Norwegian University of Science and Technology},
|
||||
year = {2007},
|
||||
month={May},
|
||||
url={http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.216.342}
|
||||
}
|
||||
|
||||
@article{Walker_1996,
|
||||
title={MPI: a standard message passing interface},
|
||||
author={Walker, David W and Dongarra, Jack J},
|
||||
journal={Supercomputer},
|
||||
volume={12},
|
||||
pages={56--68},
|
||||
year={1996},
|
||||
publisher={ASFRA BV}
|
||||
}
|
||||
|
||||
@article{Germaschewski_2016,
|
||||
title = {The Plasma Simulation Code: A modern particle-in-cell code with patch-based load-balancing},
|
||||
journal = {Journal of Computational Physics},
|
||||
volume = {318},
|
||||
pages = {305-326},
|
||||
year = {2016},
|
||||
issn = {0021-9991},
|
||||
doi = {https://doi.org/10.1016/j.jcp.2016.05.013},
|
||||
author = {Kai Germaschewski and William Fox and Stephen Abbott and Narges Ahmadi and Kristofor Maynard and Liang Wang and Hartmut Ruhl and Amitava Bhattacharjee},
|
||||
}
|
||||
|
||||
@article{Beck_2016,
|
||||
title = {Load management strategy for Particle-In-Cell simulations in high energy particle acceleration},
|
||||
journal = {Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment},
|
||||
volume = {829},
|
||||
pages = {418-421},
|
||||
year = {2016},
|
||||
note = {2nd European Advanced Accelerator Concepts Workshop - EAAC 2015},
|
||||
issn = {0168-9002},
|
||||
doi = {https://doi.org/10.1016/j.nima.2016.03.112},
|
||||
author = {A. Beck and J.T. Frederiksen and J. Dérouillat},
|
||||
}
|
||||
|
||||
@article{Barsamian_2018,
|
||||
title = {Efficient data layouts for a three-dimensional electrostatic Particle-in-Cell code},
|
||||
journal = {Journal of Computational Science},
|
||||
volume = {27},
|
||||
pages = {345-356},
|
||||
year = {2018},
|
||||
issn = {1877-7503},
|
||||
doi = {https://doi.org/10.1016/j.jocs.2018.06.004},
|
||||
author = {Yann Barsamian and Sever A. Hirstoaga and Éric Violard},
|
||||
}
|
||||
|
||||
@article{Miller_2021,
|
||||
title = {Dynamic load balancing with enhanced shared-memory parallelism for particle-in-cell codes},
|
||||
journal = {Computer Physics Communications},
|
||||
volume = {259},
|
||||
pages = {107633},
|
||||
year = {2021},
|
||||
issn = {0010-4655},
|
||||
doi = {https://doi.org/10.1016/j.cpc.2020.107633},
|
||||
author = {Kyle G. Miller and Roman P. Lee and Adam Tableman and Anton Helm and Ricardo A. Fonseca and Viktor K. Decyk and Warren B. Mori},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user