|
Static Assignment
- Given a decomposition it is possible to assign tasks statically
- For example, some computation on an array of size N can be decomposed statically by assigning a range of indices to each process: for k processes P 0 operates on indices 0 to (N/k)-1, P 1 operates on N/k to (2N/k)-1,…, P k-1 operates on (k-1)N/k to N-1
- For regular computations this works great: simple and low-overhead
- What if the nature of computation depends on the index?
- For certain index ranges you do some heavy-weight computation while for others you do something simple
- Is there a problem?
Dynamic Assignment
- Static assignment may lead to load imbalance depending on how irregular the application is
- Dynamic decomposition/assignment solves this issue by allowing a process to dynamically choose any available task whenever it is done with its previous task
- Normally in this case you decompose the program in such a way that the number of available tasks is larger than the number of processes
- Same example: divide the array into portions each with 10 indices; so you have N/10 tasks
- An idle process grabs the next available task
- Provides better load balance since longer tasks can execute concurrently with the smaller ones
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|