Game Development Reference
In-Depth Information
However, the drawback of particle-based simulation is its computational cost.
If the resolution of the simulation is the same as for a grid-based simulation, i.e.,
the number of particles are the same as the number of grid points in a grid-based
simulation, particle-based simulations of fluids are much more expensive because
the neighboring particles have to be searched in every time step. In order to get
good visual quality, a large number of particles have to be simulated. It depends
on the situation, but a simulation with only thousands of particles does not usually
give us a satisfactory result.
In this chapter, a method to parallelize particle-based simulation on multi-
ple processors with distributed memory is presented. The method simulates the
motion of particles by splitting a simulation into smaller simulations. Using this
method, a high-resolution simulation, as shown in Figure 7.1, can be simulated
in a few milliseconds per step. GPUs are generally used for parallelizing simu-
lations, but the present method is not limited to GPUs, as it is also applicable to
multiple CPUs.
7.2 Dividing Computation
To utilize multiple processors for a simulation, the computation has to be divided
into several computations. For a grid-based fluid simulation, in which connec-
tivity among fixed simulation entities is parallelized on multiple processors, the
approach we should take is obvious. The simulation domain is divided into sub-
domains, and a subdomain is assigned to a processor. Because of the fixed con-
nectivity, the decomposition of the simulation domain has to be done once before
the simulation starts. To calculate each subdomain, the simulation requires some
data from an adjacent subdomain. The elements whose data have to be transferred
to an adjacent processor are fixed. Therefore, it is relatively easy to use multiple
processors for a grid-based fluid simulation. The overhead of the parallelization
is not so large because of the fixed connectivity.
Particle-based simulation, the analogy of the domain decomposition for grid-
based simulation, involves dividing particles into sets equal to the number of pro-
cessors. We quickly realize that this is not a good choice, because particles mix up
soon after a simulation starts so that the communication among processors would
almost halt the simulation. Thus, it is not obvious how to divide a particle-based
simulation in which simulation entities, particles, move freely in the computation
domain on multiple processors. The overhead of parallelization can easily kill
the benefits of using multiple processors without a carefully designed method,
because the simulation data have to be managed at each simulation step.
Search Nedrilad ::




Custom Search