-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtp-cp-pp-dp.html
276 lines (238 loc) · 13.7 KB
/
tp-cp-pp-dp.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- HTML Meta Tags -->
<title>Malaysia-AI blog learn CUDA</title>
<meta name="description" content="Malaysia-AI blog learn CUDA">
<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://malaysia-ai.org/learn-cuda">
<meta property="og:type" content="website">
<meta property="og:title" content="Malaysia-AI blog learn CUDA">
<meta property="og:description" content="Malaysia-AI blog learn CUDA">
<meta property="og:image" content="https://malaysia-ai.org/learn-cuda.png">
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="malaysia-ai.org">
<meta property="twitter:url" content="https://malaysia-ai.org/learn-cuda">
<meta name="twitter:title" content="Malaysia-AI blog learn CUDA">
<meta name="twitter:description" content="Malaysia-AI blog learn CUDA">
<meta name="twitter:image" content="https://malaysia-ai.org/learn-cuda.png">
<!-- Meta Tags Generated via https://www.opengraph.xyz -->
<style>
body {
line-height: 1.4;
font-size: 16px;
padding: 0 10px;
margin: 50px auto;
max-width: 1000px;
}
#maincontent {
max-width: 62em;
margin: 15 auto;
}
pre {
margin-top: 0px;
white-space: break-spaces;
}
</style>
</head>
<body>
<div id="maincontent" style="margin-top: 70px">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800">
<defs>
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#000" />
</marker>
</defs>
<!-- GPU Rectangles -->
<rect x="50" y="50" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="150" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="250" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="350" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="450" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="550" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<!-- GPU Labels -->
<text x="60" y="90" font-family="Arial" font-size="20">GPU 0</text>
<text x="60" y="190" font-family="Arial" font-size="20">GPU 1</text>
<text x="60" y="290" font-family="Arial" font-size="20">GPU 2</text>
<text x="60" y="390" font-family="Arial" font-size="20">GPU 3</text>
<text x="60" y="490" font-family="Arial" font-size="20">GPU 4</text>
<text x="60" y="590" font-family="Arial" font-size="20">GPU 5</text>
<!-- Hidden Layers -->
<rect x="150" y="60" width="80" height="60" fill="#ffcccc" stroke="#000" />
<rect x="250" y="60" width="80" height="60" fill="#ffddcc" stroke="#000" />
<rect x="150" y="160" width="80" height="60" fill="#ffcccc" stroke="#000" />
<rect x="250" y="160" width="80" height="60" fill="#ffddcc" stroke="#000" />
<rect x="350" y="260" width="80" height="60" fill="#ffeedd" stroke="#000" />
<rect x="450" y="260" width="80" height="60" fill="#ffeecc" stroke="#000" />
<rect x="350" y="360" width="80" height="60" fill="#ffeedd" stroke="#000" />
<rect x="450" y="360" width="80" height="60" fill="#ffeecc" stroke="#000" />
<rect x="550" y="460" width="80" height="60" fill="#eeffcc" stroke="#000" />
<rect x="650" y="460" width="80" height="60" fill="#ddeeff" stroke="#000" />
<rect x="550" y="560" width="80" height="60" fill="#eeffcc" stroke="#000" />
<rect x="650" y="560" width="80" height="60" fill="#ddeeff" stroke="#000" />
<!-- Layer Labels -->
<text x="170" y="95" font-family="Arial" font-size="12">HL 0</text>
<text x="270" y="95" font-family="Arial" font-size="12">HL 1</text>
<text x="170" y="195" font-family="Arial" font-size="12">HL 0</text>
<text x="270" y="195" font-family="Arial" font-size="12">HL 1</text>
<text x="370" y="295" font-family="Arial" font-size="12">HL 2</text>
<text x="470" y="295" font-family="Arial" font-size="12">HL 3</text>
<text x="370" y="395" font-family="Arial" font-size="12">HL 2</text>
<text x="470" y="395" font-family="Arial" font-size="12">HL 3</text>
<text x="570" y="495" font-family="Arial" font-size="12">HL 4</text>
<text x="670" y="495" font-family="Arial" font-size="12">HL 5</text>
<text x="570" y="595" font-family="Arial" font-size="12">HL 4</text>
<text x="670" y="595" font-family="Arial" font-size="12">HL 5</text>
<!-- Tensor Parallelism Arrows -->
<line x1="190" y1="120" x2="190" y2="160" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<line x1="290" y1="120" x2="290" y2="160" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<line x1="390" y1="320" x2="390" y2="360" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<line x1="490" y1="320" x2="490" y2="360" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<line x1="590" y1="520" x2="590" y2="560" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<line x1="690" y1="520" x2="690" y2="560" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<!-- Pipeline Parallelism Arrows -->
<line x1="330" y1="120" x2="350" y2="260" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<line x1="530" y1="320" x2="550" y2="460" stroke="#000" stroke-width="2" marker-end="url(#arrowhead)" />
<!-- Legend -->
<rect x="50" y="10" width="20" height="20" fill="#ffcccc" stroke="#000" />
<text x="75" y="25" font-family="Arial" font-size="12">HL 0</text>
<rect x="150" y="10" width="20" height="20" fill="#ffddcc" stroke="#000" />
<text x="175" y="25" font-family="Arial" font-size="12">HL 1</text>
<rect x="250" y="10" width="20" height="20" fill="#ffeedd" stroke="#000" />
<text x="275" y="25" font-family="Arial" font-size="12">HL 2</text>
<rect x="350" y="10" width="20" height="20" fill="#ffeecc" stroke="#000" />
<text x="375" y="25" font-family="Arial" font-size="12">HL 3</text>
<rect x="450" y="10" width="20" height="20" fill="#eeffcc" stroke="#000" />
<text x="475" y="25" font-family="Arial" font-size="12">HL 4</text>
<rect x="550" y="10" width="20" height="20" fill="#ddeeff" stroke="#000" />
<text x="575" y="25" font-family="Arial" font-size="12">HL 5</text>
</svg>
<br><br><br>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 800">
<defs>
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#000" />
</marker>
</defs>
<!-- Front layer (original 2D structure) -->
<g id="front-layer">
<!-- GPU Rectangles -->
<rect x="50" y="50" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="150" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="250" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="350" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<rect x="50" y="450" width="700" height="80" fill="#e6f3ff" stroke="#000" stroke-width="2" />
<!-- GPU Labels -->
<text x="60" y="90" font-family="Arial" font-size="20">GPU 0</text>
<text x="60" y="190" font-family="Arial" font-size="20">GPU 1</text>
<text x="60" y="290" font-family="Arial" font-size="20">GPU 2</text>
<text x="60" y="390" font-family="Arial" font-size="20">GPU 3</text>
<text x="60" y="490" font-family="Arial" font-size="20">GPU 4</text>
<!-- Hidden Layers -->
<g id="hl-layer-1">
<rect x="150" y="60" width="80" height="60" fill="#ffcccc" stroke="#000" />
<rect x="250" y="60" width="80" height="60" fill="#ffddcc" stroke="#000" />
<rect x="150" y="160" width="80" height="60" fill="#ffcccc" stroke="#000" />
<rect x="250" y="160" width="80" height="60" fill="#ffddcc" stroke="#000" />
</g>
<g id="hl-layer-2">
<rect x="350" y="260" width="80" height="60" fill="#ffeedd" stroke="#000" />
<rect x="450" y="260" width="80" height="60" fill="#ffeecc" stroke="#000" />
<rect x="350" y="360" width="80" height="60" fill="#ffeedd" stroke="#000" />
<rect x="450" y="360" width="80" height="60" fill="#ffeecc" stroke="#000" />
</g>
<g id="hl-layer-3">
<rect x="550" y="460" width="80" height="60" fill="#eeffcc" stroke="#000" />
<rect x="650" y="460" width="80" height="60" fill="#ddeeff" stroke="#000" />
</g>
<!-- Layer Labels -->
<g font-family="Arial" font-size="12">
<text x="170" y="95">HL 0</text>
<text x="270" y="95">HL 1</text>
<text x="170" y="195">HL 0</text>
<text x="270" y="195">HL 1</text>
<text x="370" y="295">HL 2</text>
<text x="470" y="295">HL 3</text>
<text x="370" y="395">HL 2</text>
<text x="470" y="395">HL 3</text>
<text x="570" y="495">HL 4</text>
<text x="670" y="495">HL 5</text>
</g>
<!-- Tensor Parallelism Arrows -->
<g stroke="#000" stroke-width="2" marker-end="url(#arrowhead)">
<line x1="190" y1="120" x2="190" y2="160" />
<line x1="290" y1="120" x2="290" y2="160" />
<line x1="390" y1="320" x2="390" y2="360" />
<line x1="490" y1="320" x2="490" y2="360" />
</g>
<!-- Pipeline Parallelism Arrows -->
<g stroke="#000" stroke-width="2" marker-end="url(#arrowhead)">
<line x1="330" y1="120" x2="350" y2="260" />
<line x1="530" y1="320" x2="550" y2="460" />
</g>
</g>
<!-- Back layer (duplicated 2D structure) -->
<g id="back-layer" transform="translate(100, 100) scale(0.9)">
<!-- GPU Rectangles -->
<rect x="50" y="50" width="700" height="80" fill="#d1e8ff" stroke="#777" stroke-width="2"
stroke-dasharray="5,5" />
<rect x="50" y="150" width="700" height="80" fill="#d1e8ff" stroke="#777" stroke-width="2"
stroke-dasharray="5,5" />
<rect x="50" y="250" width="700" height="80" fill="#d1e8ff" stroke="#777" stroke-width="2"
stroke-dasharray="5,5" />
<rect x="50" y="350" width="700" height="80" fill="#d1e8ff" stroke="#777" stroke-width="2"
stroke-dasharray="5,5" />
<rect x="50" y="450" width="700" height="80" fill="#d1e8ff" stroke="#777" stroke-width="2"
stroke-dasharray="5,5" />
<!-- Hidden Layers -->
<g id="hl-layer-1-back">
<rect x="150" y="60" width="80" height="60" fill="#ffdddd" stroke="#777" stroke-dasharray="5,5" />
<rect x="250" y="60" width="80" height="60" fill="#ffeedd" stroke="#777" stroke-dasharray="5,5" />
<rect x="150" y="160" width="80" height="60" fill="#ffdddd" stroke="#777" stroke-dasharray="5,5" />
<rect x="250" y="160" width="80" height="60" fill="#ffeedd" stroke="#777" stroke-dasharray="5,5" />
</g>
<g id="hl-layer-2-back">
<rect x="350" y="260" width="80" height="60" fill="#ffeeee" stroke="#777" stroke-dasharray="5,5" />
<rect x="450" y="260" width="80" height="60" fill="#ffefdd" stroke="#777" stroke-dasharray="5,5" />
<rect x="350" y="360" width="80" height="60" fill="#ffeeee" stroke="#777" stroke-dasharray="5,5" />
<rect x="450" y="360" width="80" height="60" fill="#ffefdd" stroke="#777" stroke-dasharray="5,5" />
</g>
<g id="hl-layer-3-back">
<rect x="550" y="460" width="80" height="60" fill="#efffdd" stroke="#777" stroke-dasharray="5,5" />
<rect x="650" y="460" width="80" height="60" fill="#deefff" stroke="#777" stroke-dasharray="5,5" />
</g>
</g>
<!-- Context Parallelism Connections -->
<g id="cp-connections" stroke="#ff00ff" stroke-width="2" stroke-dasharray="5,5">
<line x1="150" y1="60" x2="235" y2="154" />
<line x1="230" y1="60" x2="315" y2="154" />
<line x1="250" y1="60" x2="335" y2="154" />
<line x1="330" y1="60" x2="415" y2="154" />
<line x1="150" y1="160" x2="235" y2="254" />
<line x1="230" y1="160" x2="315" y2="254" />
<line x1="250" y1="160" x2="335" y2="254" />
<line x1="330" y1="160" x2="415" y2="254" />
</g>
<!-- Legend -->
<g font-family="Arial" font-size="12" transform="translate(0, 600)">
<rect x="50" y="10" width="20" height="20" fill="#ffcccc" stroke="#000" />
<text x="75" y="25">HL 0</text>
<rect x="150" y="10" width="20" height="20" fill="#ffddcc" stroke="#000" />
<text x="175" y="25">HL 1</text>
<rect x="250" y="10" width="20" height="20" fill="#ffeedd" stroke="#000" />
<text x="275" y="25">HL 2</text>
<rect x="350" y="10" width="20" height="20" fill="#ffeecc" stroke="#000" />
<text x="375" y="25">HL 3</text>
<rect x="450" y="10" width="20" height="20" fill="#eeffcc" stroke="#000" />
<text x="475" y="25">HL 4</text>
<rect x="550" y="10" width="20" height="20" fill="#ddeeff" stroke="#000" />
<text x="575" y="25">HL 5</text>
<line x1="650" y1="10" x2="670" y2="30" stroke="#ff00ff" stroke-width="2" stroke-dasharray="5,5" />
<text x="675" y="25" fill="#ff00ff">Context Parallelism (CP)</text>
</g>
</svg>
</div>
</body>
</html>