Download enzo-2.1.1 PDF - Read the Docs
Transcript
Enzo Documentation, Release 2.1 the standard particle storage in Enzo, where the particles are stored on one processor and NumberOfParticles is the same on all processors. We adopt the strategy of storing particles on many processors for one grid, and NumberOfParticles denotes the number of particles actually stored on the local processor. Once we rebuild the coarsest level with a dynamical hierarchy, we move all of the particles to their host processor, i.e. ProcessorNumber, and synchronize NumberOfParticles to equal the total number of particles on the grid over all processors. Below we will outline this method to distribute memory usage from particles during RebuildHierarchy() on level L. Pre-existing routines in RebuildHierarchy() are not included in the outline. 1. Set NumberOfParticles to zero on all grids on level >= L, except on the grid’s host processor. 2. Find the finest level (Lsub ) with static subgrids. In the code, this is called MaximumStaticSubgridLevel. 3. grid::MoveAllParticles() – Move all particles on grids on level > L to their parents on level L, but keep them on the same processor as before. Now the particles are on their parent, but distributed across many processors. 4. CommunicationTransferParticles() – Move any particles that have migrated across grid boundaries to their siblings. 5. CommunicationCollectParticles(SIBLINGS_ONLY) – If we are rebuilding a level > Lsub , move all particles to their host processor, as this new method is not needed. This was previously done in grid::MoveAllParticles. This routine is faster than before because we do the communication in one MPI_Alltoallv() call. 6. Loop over levels L0 -> MAX_DEPTH_OF_HIERARCHY. 7. DepositParticleMassFlaggingField() – If level <= Lsub , then the particles are distributed across processor. This causes complications when creating the mass refinement flagging field for particles. Therefore, we must sum this particle mass field over these processors. For each grid, only processors with particles contribute to this sum to reduce the amount of computation and communication. In short, this routine performs a non-blocking MPI_SUM over a select number of processors. 8. CommunicationCollectParticles(SUBGRIDS_LOCAL) – This routine replaces grid::MoveSubgridParticlesFast(). It keeps the particles on the same processor, but this doesn’t matter here because the children grids are always created on the same processor as its parent and then moved to another processor during load balancing. 9. CommunicationCollectParticles(SIBLINGS_ONLY) – After load balancing is complete on level Lsub , we can safely move the particles to their host processor without the worry of running out of memory. 7.13 Estimated Simulation Resource Requirements Estimating problem sizes for most Enzo calculations is at best an inexact science, given the nature of Adaptive Mesh Refinement (AMR) simulations. The fundamental issue with an AMR calculation in cosmology or in many astrophysical situations where gravitational collapse is important has to do with memory. The amount of memory used at the beginning of the simulation (when you have a single grid or a handful of grids) is far, far less than the memory consumption at the end of the simulation, when there can be hundreds of grids per processor. The amount of memory required can easily grow by an order of magnitude over the course of a cosmological simulation, so it is very important to make sure to take this into account to ensure that enough memory is available in later stages of your simulation. It is also important to realize that in general one should try to keep the largest amount of data per processing core that you can so that individual cores are never data-starved. Data-starved processing units cause poor scaling, as your CPUs will then be sitting idle while waiting for data from other computing nodes. Computational fluid dynamics simulations are notoriously communication-heavy, making this a challenging corner of parameter space to operate in. 162 Chapter 7. Reference Information