-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ch. 17: create a diagram showing blocked parallelism
- Loading branch information
1 parent
8f63245
commit 3111eda
Showing
11 changed files
with
348 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
digraph { | ||
rankdir = RL; | ||
overlap = false; | ||
dpi = 300.0; | ||
|
||
rankdir = "LR"; | ||
splines = false; | ||
cluster = true; | ||
|
||
node [shape = "plaintext";]; | ||
node [shape = diamond;]; | ||
|
||
// The graphs end up with the correct order, i.e. Task 1 *above* Task 2, when | ||
// this is first. | ||
subgraph cluster_ColleagueB { | ||
label = "Task A"; | ||
A1; | ||
A2; | ||
A0_1 [style = invis;]; | ||
A3; | ||
|
||
A1 -> A2; | ||
A2 -> A0_1 [arrowhead = "tee"; headport = "A0_1:c"; headclip = false;]; | ||
A0_1; | ||
A0_1 -> A3 [dir = both; arrowtail = "tee"; tailclip = false;]; | ||
} | ||
|
||
fut1 [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td sides="B">fut1</td></tr> | ||
<tr><td>0</td></tr> | ||
<tr><td port="target">1</td></tr> | ||
<tr><td port="source"> </td></tr> | ||
</table>>;]; | ||
subgraph cluster_ColleagueA { | ||
newrank = true; | ||
label = "Task B"; | ||
B1 -> B2 -> B3 -> B4; | ||
} | ||
|
||
edge [tailclip = "false";]; | ||
fut1:source:c -> fut1:target [dir = forward;]; | ||
B3 -> A3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,32 @@ | ||
digraph { | ||
rankdir = LR; | ||
rankdir = RL; | ||
overlap = false; | ||
dpi = 300.0; | ||
splines = false; | ||
cluster = true; | ||
|
||
node [shape = "plaintext";]; | ||
|
||
pinned_box [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td sides="B">Pin</td></tr> | ||
<tr><td port="source"> </td></tr> | ||
</table>>;]; | ||
|
||
subgraph cluster_box { | ||
label = ""; | ||
peripheries = 0; | ||
// Group the two together, which results in the desired alignment. | ||
subgraph { | ||
// But don't show the frame! | ||
style = "invis"; | ||
|
||
subgraph cluster_box_internal { | ||
peripheries = 1; | ||
label = "b1"; | ||
shape = box; | ||
style = solid; | ||
pin [shape = "point";]; | ||
} | ||
} | ||
|
||
subgraph cluster_deref { | ||
style = bold; | ||
label = "pinned"; | ||
fut1 [label = <<table border="0" cellborder="1" cellspacing="0" bgcolor="gray"> | ||
<tr><td sides="B">fut1</td></tr> | ||
<tr><td>?</td></tr> | ||
<tr><td port="target">?</td></tr> | ||
<tr><td>?</td></tr> | ||
</table>>;]; | ||
|
||
box [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td sides="B">fut</td></tr> | ||
<tr><td port="target">0</td></tr> | ||
fut2 [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td sides="B">fut2</td></tr> | ||
<tr><td>0</td></tr> | ||
<tr><td>1</td></tr> | ||
<tr><td port="source"> </td></tr> | ||
<tr><td style="dashed">...</td></tr> | ||
<tr><td port="internal">1</td></tr> | ||
</table>>;]; | ||
|
||
edge [tailclip = "false"; dir = forward]; | ||
fut2:source:c -> fut1:target:e; | ||
} | ||
|
||
edge [tailclip = false;]; | ||
pinned_box -> pin [tailport = "source:c"; arrowhead = "none";]; | ||
pin -> box [headport = "target";]; | ||
box -> box [tailport = "source:c"; headport = "internal";]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,64 @@ | ||
digraph { | ||
rankdir = LR; | ||
overlap = false; | ||
dpi = 300.0; | ||
splines = false; | ||
cluster = true; | ||
newrank = true; | ||
outputorder = in; | ||
compound = true; | ||
labelloc = "c"; | ||
dpi = 300.0; | ||
|
||
node [shape = "plaintext";]; | ||
|
||
pinned_box [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td sides="B">Pin</td></tr> | ||
<tr><td port="source"> </td></tr> | ||
</table>>;]; | ||
|
||
|
||
subgraph cluster_deref { | ||
style = dashed; | ||
label = "String"; | ||
subgraph cluster_not_fut { | ||
peripheries = 0; | ||
|
||
pin [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td sides="B">Pin</td></tr> | ||
<tr><td port="source"> </td></tr> | ||
</table>>;]; | ||
|
||
pin [shape = "point";]; | ||
subgraph cluster_boxes { | ||
peripheries = 0; | ||
rank = same; | ||
|
||
subgraph cluster_box_1 { | ||
subgraph cluster_box_2_internal { | ||
label = "b1"; | ||
shape = box; | ||
style = solid; | ||
style = filled; | ||
peripheries = 1; | ||
box1 [shape = "point";style = "invis";]; | ||
} | ||
} | ||
|
||
subgraph cluster_box_2 { | ||
subgraph cluster_box_2_internal { | ||
label = "b2"; | ||
shape = box; | ||
style = solid; | ||
peripheries = 1; | ||
box2 [shape = "point";]; | ||
} | ||
} | ||
} | ||
} | ||
subgraph cluster_target { | ||
style = bold; | ||
label = "pinned"; | ||
|
||
fut [label = <<table border="0" cellborder="1" cellspacing="0"> | ||
<tr><td port="target">5usize</td> | ||
<td>h</td> | ||
<td>e</td> | ||
<td>l</td> | ||
<td>l</td> | ||
<td>o</td></tr> | ||
<tr><td sides="B">fut</td></tr> | ||
<tr><td port="target">0</td></tr> | ||
<tr><td port="source"> </td></tr> | ||
<tr><td style="dashed">...</td></tr> | ||
<tr><td port="internal">1</td></tr> | ||
</table>>;]; | ||
} | ||
|
||
|
||
box1 -> box2 [rankdir = TB; style = invis;]; | ||
|
||
edge [tailclip = false;]; | ||
pinned_box -> pin [tailport = "source:c"; arrowhead = "none";]; | ||
pin -> fut [headport = "target";]; | ||
pin -> box1 [style = "invis";]; | ||
pin -> box2 [tailport = "source:c"; arrowhead = "none";]; | ||
box2 -> fut [headport = "target";]; | ||
fut -> fut [tailport = "source:c"; headport = "internal";]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.