Skip to content

Commit dcee9e4

Browse files
New page
1 parent 27c1fa8 commit dcee9e4

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed

content/exercises.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ <h2>!! Under Construction, the following is currently being updated and will inc
4141
</ol>
4242
<li><h2>Load Balancing</h2></li>
4343
<ol>
44-
<li>Particle Exercise with multiple types of particles</li>
44+
<li><a href="loadbalancing">Particle Exercise with multiple types of particles</a></li>
4545
<ol>
4646
<li>Add load balancing</li>
4747
<li>Add projections and show impact of load balancing via time-profile and timeline</li>
20 KB
Loading

content/exercises/loadbalancing.html

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Load Balancing Particle Exercise (Extension)
3+
homec: home
4+
tutorialc: tutorial
5+
applicationsc: applications
6+
miniAppsc: miniApps
7+
downloadc: download
8+
toolsc: tools
9+
helpc: help
10+
---
11+
12+
<link rel="stylesheet" type="text/css" href="../../tutorial/TutorialStyle.css">
13+
14+
<h1>Load Balancing: Particle Exercise <em>(Extension)</em></h1>
15+
16+
<table class="StandardFigure" align="right" border="0">
17+
<tr><td align="center" valign="middle">
18+
<a href="../images/particlescode_lb.png">
19+
<img class="StandardFigure" src="../images/particlescode_lb.png" border="0" width="375">
20+
</a>
21+
</td></tr>
22+
<tr><td align="center" valign="middle"><b>Figure&nbsp;1</b></td></tr>
23+
</table>
24+
<h2>Part&nbsp;1 – Introducing Imbalance</h2>
25+
26+
<p>The very first task is to create measurable imbalance so that load balancers have something meaningful to fix.</p>
27+
28+
<ol>
29+
<li>
30+
Let <code>m&nbsp;×&nbsp;m</code> be the chare-array dimensions and <code>k</code> the baseline number of particles per chare. Update the number of particles per chare to be
31+
<span lang="latex">N_{x,y} = k + \frac{2k(x + y)}{2m}</span>.
32+
</li>
33+
34+
<li>
35+
Build with tracing enabled using the <code>-tracemode projections</code> flag.
36+
</li>
37+
<li>
38+
Install <a href="https://github.com/charmplusplus/projections">projections</a>, and focus on the time profile view to see how the imbalance affects performance and efficiency.
39+
</li>
40+
</ol>
41+
42+
<!-- =================================================================== -->
43+
<h2>Part&nbsp;2 – Adding Migration Support &amp; Load-Balancing</h2>
44+
45+
<p>Now enable dynamic migration so Charm++ balancers can actually move work around.</p>
46+
47+
<ol>
48+
<li>
49+
Implement <code>PUP</code> serialization for your chare array as <a href="https://charm.readthedocs.io/en/latest/charm++/manual.html#arraymigratable">documented</a>.
50+
</li>
51+
<li>
52+
At appropriate intervals, call <code><a href="https://charm.readthedocs.io/en/latest/charm++/manual.html#load-balancing-chare-arrays">AtSync()</a></code> so the runtime knows the chare is ready for potential migration.
53+
</li>
54+
<li>
55+
Select a load-balancing strategy. For this exercise we will use
56+
<code>GreedyRefineLB</code> (use option <code>-balancer GreedyRefineLB</code>).
57+
</li>
58+
59+
<li>
60+
Re-run the application as in Part&nbsp;1 and compare how the program behaves differently.
61+
</li>
62+
</ol>
63+
64+
<h2>Part&nbsp;3 – Visualising with LiveViz</h2>
65+
66+
<p>Add colour to emphasise the skew and watch the balancer work.</p>
67+
68+
<ol>
69+
<li>
70+
Extend each chare to contain particles of three different colors. Each color should move at different speeds - green should move at the default speed, red should move twice as fast and green should move half as fast.
71+
</li>
72+
73+
<li>
74+
Distribute colours to reproduce the imbalance as shown in the figure: reds bunched in the centre, greens in the upper-left, blues in the lower-right.
75+
</li>
76+
77+
<li>
78+
Compile with <a href="https://github.com/UIUC-PPL/ccs_tools">LiveViz</a> using the <code>-module liveViz</code> flag.
79+
</li>
80+
81+
<li>
82+
Run your C++ code using <code>++server</code> and <code>++server-port 1234</code>, and then run the liveViz client using <code>liveVize localhost 1234</code>, and observe how the particles behave.
83+
</li>
84+
</ol>

0 commit comments

Comments
 (0)