300 likes | 445 Views
Dynamic Load Balancing for VORPAL. Viktor Przebinda Center for Integrated Plasma Studies. What is VORPAL?. A parallel simulation package that models laser - plasma interactions using the PIC or fluid model. Built on an object oriented framework. Over 1,300 pages (68,000 lines) of C++ code.
E N D
Dynamic Load Balancing for VORPAL Viktor Przebinda Center for Integrated Plasma Studies
What is VORPAL? • A parallel simulation package that models laser - plasma interactions using the PIC or fluid model. • Built on an object oriented framework. • Over 1,300 pages (68,000 lines) of C++ code.
Goal: Implement Dynamic Load Balancing for VORPAL • Dynamic: Automatically adjusts decomposition appropriately at runtime. • Fully compatible with all simulations. • Efficient: Minimizes overhead. • User friendly: Requires no special configuration.
Grids define how regions are to be updated. physical region One or two cells wide extended region
Extended regions simplify parallel synchronization. CPU 0 CPU 1 physical region physical region extended region extended region Extended regions contain data in physical regions of other CPUs.
Allocated region provides simple over allocation scheme. physical region Allocated Region extended region
Working with current framework introduces restrictions. • Boundaries can be adjusted by at most one cell in each direction. • Decomposition description is restricted to prevent irregular domains. Impossible Normal Direction 1 Direction 1 Direction 0 Direction 0
Two strategies exist to accommodate decomposition adjustment. • Over allocate all fields to accommodate future decomposition adjustment. • Resize and copy all field data as needed for each decomposition adjustment.
Over Allocation overflow overflow Region in use Advantage: Minimal overhead. Disadvantage: Decreases cache hits, resulting in lower efficiency
Over allocation introduces minimal overhead. overflow Region in use
Over Allocation in direction of maximum stride is optimal. overflow Region in use
Resizing New memory block requested, values are copied over Advantage: Does not affect efficiency. Disadvantage: Large overhead
Optimal performance is achieved through both methods New memory block requested, values are copied over Memory is over allocated to prevent future resizes.
Decomposition adjustment occurs at end of update Update Load Balancing CPU time measured each iteration
DLB is achieved in eight steps. • All nodes send processing times to node zero. • Node zero decides whether to perform an adjustment. • Node zero constructs an adjustment description and sends to all other nodes. • All nodes apply the adjustment, reconfigure grid. • All fields resize as necessary. • Field iteraters are rebuilt • All messengers are rebuilt • Fields and particles are synchronized.
1. Processing times are collected to aid in adjustment decisions. • Each node measures the virtual time it took to perform its last update. Virtual time excludes time spent blocked on I/O. • This amount is sent to node zero. • The process waits for reply from node zero. Time
2. Adjustment decision made based on idle time. • Given the cost of performing a load balance, VORPAL only does so only if any node during the last time step was idle for more than 10% of the time. Time
3. Adjustment is computed to eliminate bottlenecks • Using a greedy algorithm, node zero constructs adjustment information for all processors. • This is sent to all nodes. Time
Boundaries are shrunk around processors with high load. highest CPU1 Direction 1 CPU0 CPU2 CPU3 lowest CPU Load Direction 0
4. Decomposition object is modified on each processor • Each node applies the adjustment. • The local grid is adjusted to match the new size. • The allocated region is modified if it cannot support the new size. Time
5. Fields resize if allocated region has changed. • All fields check the allocated region to see if it has grown. • If so, the field allocates additional memory to accommodate 25 more cells in the direction of growth. Time
6. Outdated information in Field iteraters is rebuilt. • Pointers to specific memory locations may have changed if a resize was performed. • Physical and extended regions may have changed size. Time
7. Outdated message passing objects are rebuilt. • Intersecting regions may have changed so the must be reconstructed. Time
8. New boundaries must be synchronized with neighbors. • Field data on physical boundaries is sent to neighboring processors and extended regions are filled from neighbors. • Particles that may have crossed outside the boundary of the current node are sent to neighboring nodes. • Unfortunately, since there is nothing to do while synchronization takes place, an enormous overhead is seen at this step. Time
When to use load balancing. • When running a PIC simulations. • When plasma concentration is expected to change. • When decomposition is along the zero direction. • When a large number of time steps are used.
Case study: DLB can beat best static decomposition by 23%. CPU1 CPU0 Boundary at midpoint Particles loaded into right region
Sliding window moves particles left to CPU0 CPU1 CPU0 Particles shifted into left region
Conclusion • Load balancing performs desired functions. • Overhead involved in message passing is quite significant, somewhat limiting usefulness.