load balancing - cs.umd.edu

21
Load Balancing Abhinav Bhatele, Department of Computer Science Introduction to Parallel Computing (CMSC416 / CMSC818X)

Upload: others

Post on 18-Dec-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Load Balancing - cs.umd.edu

Load BalancingAbhinav Bhatele, Department of Computer Science

Introduction to Parallel Computing (CMSC416 / CMSC818X)

Page 2: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Announcements

• No lecture on Tuesday Nov 16

• recorded video will be uploaded to panopto for watching

• Virtual (zoom) lecture on Thursday Nov 18

• Quiz 3 due on Thursday at 11:59 pm

• In-person class on Tuesday Nov 23

2

Page 3: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Performance issues• Sequential performance issues

• Load imbalance

• Communication performance issues / parallel overhead

• Insufficient parallelism

• Algorithmic overhead / replicated work

• Speculative loss

• Critical paths

• Bottlenecks

3

Page 4: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Load imbalance

4

Page 5: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Load imbalance

• Definition: unequal amounts of “work” assigned to different processes

• Work could be computation or communication or both

4

Page 6: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Load imbalance

• Definition: unequal amounts of “work” assigned to different processes

• Work could be computation or communication or both

• Why is load imbalance bad?

• Overloaded processes can slow down everyone

4

Page 7: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Load imbalance

• Definition: unequal amounts of “work” assigned to different processes

• Work could be computation or communication or both

• Why is load imbalance bad?

• Overloaded processes can slow down everyone

4

Load imbalance =max_loadmean_load

Page 8: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Load balancing

• The process of balancing load across threads, processes etc.

• Goal: to bring the maximum load close to average as much as possible

• Determine if load balancing is needed

• Determine when to load balance

• Determine what information to gather/use for load balancing

5

Page 9: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Is load balancing needed?

• Need the distribution of load (“work”) across processes

• Collect empirical information using performance tools

• Developer knowledge

• Analytical models of load distribution

6

Page 10: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

When to load balance?

• Initial work distribution or static load balancing

• At program startup

• Or sometimes in a separate run to determine load distribution

• Dynamic load balancing: does load distribution evolve over time?

• During program execution

7

Page 11: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Information gathering for load balancing

• Centralized load balancing

• Gather all load information at one process — global view of data

• Distributed load balancing

• Every process only knows the load of a constant number of “neighbors”

• Hybrid or hierarchical load balancing

8

Page 12: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Hierarchical load balancing

9

0

0

0

1024 63488 64512

1023 1024 2047 63488 64511 64512 65535

Token

Object

Load Data

Load Data

Greedy load balancing

Refinement load balancing

Figure 2: Hierarchical token-based load balancing scheme

balancing algorithm is invoked to make global load balancing decisions across the sub-domains. When load

balancing decisions are made, lightweight tokens that carry only the objects’ workload data are created and

sent to the destination group leaders of the sub-domains. The tokens represent the movement of objects

from an overloaded domain to an underloaded domain. When the tokens that represent the incoming objects

arrive at the destination group leader, their load data are integrated into the existing load database on that

processor. After this phase, the load database of all the group leaders at the lower level domains is updated,

reflecting the load balancing decisions made – new load database entries are created for the incoming objects,

and load database entries corresponding to the outgoing objects are removed from the database. This new

database can then be used to make load balancing decisions at that level. At the intermediate levels of the

tree, load balancing decisions are made in the form of which object migrates to which sub-domain. This

process repeats until load balancing reaches the lowest level, where final load balancing decisions are made

on migrating objects and their final destination processors.

At this point, tokens representing a migration of an object may have traveled across several load balancing

domains, therefore its original processor needs to know which final destination processor the token has

traveled to. In order to match original processors with their tokens, a global collective operation is performed

on the tree. By sending tokens instead of actual object data in the intermediate load balancing phases of

the hierarchical tree, this load balancing scheme ensures that objects are only migrated once after all the

final migration decisions are made.

Page 13: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

What information is used for load balancing

• Computational load

• Possibly, communication load (number/sizes of messages)

• Communication graph

10

Page 14: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Load balancing algorithms

• Input: Amount of work (ni) assigned to each process pi

• Output: New assignments of work units to different processes

• Goals:

• Bring maximum load close to average

• Minimize the amount of load migration

• Secondary goals:

• Balance (possibly reduce) communication load

• Keep the time for doing load balancing short

11

Page 15: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Examples of static load balancing• Decomposition of 2D Stencil

• Using orthogonal recursive bisection (ORB)

12

http://datagenetics.com/blog/march22013/

https://en.wikipedia.org/wiki/Z-order_curve

Page 16: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Examples of static load balancing• Decomposition of 2D Stencil

• Using orthogonal recursive bisection (ORB)

12

http://datagenetics.com/blog/march22013/

https://en.wikipedia.org/wiki/Z-order_curve

Page 17: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Examples of static load balancing• Decomposition of 2D Stencil

• Using orthogonal recursive bisection (ORB)

12

http://datagenetics.com/blog/march22013/

https://en.wikipedia.org/wiki/Z-order_curve http://charm.cs.uiuc.edu/workshops/charmWorkshop2011/slides/CharmWorkshop2011_apps_ChaNGa.pdf

Space-filling

curves

ORB

Page 18: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Simple greedy strategy

• Sort all the processes by their load

• Take some load from the heaviest process and assign it to the most lightly loaded process

13

Page 19: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Work stealing

• Decentralized strategy where processes steal work from nearby processes when they have nothing to do

14

Page 20: Load Balancing - cs.umd.edu

Abhinav Bhatele (CMSC416 / CMSC818X) LIVE RECORDING

Other considerations

• Communication-aware load balancing

• Network topology-aware load balancing

15

Page 21: Load Balancing - cs.umd.edu

Abhinav Bhatele

5218 Brendan Iribe Center (IRB) / College Park, MD 20742

phone: 301.405.4507 / e-mail: [email protected]