SLIDE 1 Message Driven Programming with S-Net Methodology and Performance
Frank ¡Penczek ¡ S.A. ¡Herhut, ¡S.-‑B. ¡Scholz, ¡A. ¡Shafarenko, ¡J. ¡Yang, ¡C.Y. ¡Chen, ¡N. ¡Bagherzadeh, ¡C. ¡Grelck ¡
SLIDE 2
What is S-Net
Coordination & Concurrency Engineering
SLIDE 3
What is S-Net
Applications as Streaming Networks
SLIDE 4
What is S-Net
Basic Building Blocks
SLIDE 5
What is S-Net
Basic Building Blocks
α β
{A, ¡B, ¡ ¡…} ¡ {X, ¡Y, ¡ ¡…} ¡
net ¡myNet ¡{ ¡ ¡ ¡ ¡ ¡box ¡MyBox( ¡(A,B) ¡-‑> ¡(X,Y)); ¡ } ¡connect ¡MyBox; ¡
SLIDE 6
Raytracing Application
The Principle
SLIDE 7
Raytracing Application
...in S-Net
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
SLIDE 8
Raytracing Application
...in S-Net
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
{scn_name} ¡ {scene} ¡ {raster} ¡ {img} ¡
SLIDE 9
Raytracing Application
...in S-Net
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
{scn_name} ¡ {scene} ¡ {raster} ¡ {img} ¡ net net raytrace raytrace { { box box ReadScene ReadScene( ( ( (scn_name scn_name) -> (scene)); ) -> (scene)); box Solve( (scene) -> (raster)); box Solve( (scene) -> (raster)); box box GenImage GenImage( (raster) -> ( ( (raster) -> (img img)); )); } connect } connect ReadScene ReadScene .. Solve .. .. Solve .. GenImage GenImage; ;
SLIDE 10
Raytracing Application
Parallelised Approach
SLIDE 11
Raytracing Application
Parallelised Approach in S-Net
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
Merge ¡
Solve ¡ Solve ¡
SLIDE 12
S-Net Combinators
Split Combinator
Solve ¡ Solve ¡ Solve ¡
net ¡split ¡{ ¡ ¡ ¡box ¡Solve( ¡(scene) ¡-‑> ¡(raster)); ¡ } ¡connect ¡Solve; ¡ net ¡split ¡{ ¡ ¡ ¡box ¡Solve( ¡(scene) ¡-‑> ¡(raster)); ¡ } ¡connect ¡Solve!<task>; ¡
Solve ¡
SLIDE 13
Raytracing Application
Parallelised Approach
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
Merge ¡
Solve ¡ Solve ¡
SLIDE 14
Raytracing Application
Extended Read Scene
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
Merge ¡
Solve ¡ Solve ¡
{scn_name, ¡ <num_tasks>} ¡ ¡ ¡ ¡{scene, ¡<task>, ¡<num_tasks>} ¡ {scene} ¡ ¡ ¡{raster, ¡<task>, ¡<num_tasks>} ¡ {raster} ¡
SLIDE 15
S-Net Features
Flow Inheritance
Read ¡ Scene ¡
Gen ¡ Image ¡
Merge ¡
Solve ¡
¡ ¡{scene, ¡<task>, ¡<num_tasks>} ¡ {scene} ¡ ¡{raster, ¡<task>, ¡<num_tasks>} ¡ {raster} ¡ ¡{<task>, ¡<num_tasks>} ¡
SLIDE 16
Raytracing Application
Parallelised Approach
Read ¡ Scene ¡ Solve ¡
Gen ¡ Image ¡
Solve ¡ Solve ¡
Merge ¡
SLIDE 17
S-Net Combinators
Iteration
Merge ¡ {accu} ¡ {sub_res} ¡ {result} ¡
SLIDE 18
S-Net Combinators
Star Combinator
Merge ¡ {accu} ¡ {sub_res} ¡ {result} ¡ net ¡merge ¡{ ¡ ¡ ¡box ¡Merge( ¡(accu, ¡sub_res) ¡-‑> ¡ ¡ ¡ ¡(accu) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡(result)); ¡ ¡ ¡ } ¡connect ¡Merge*{result}; ¡
SLIDE 19
S-Net Features
Synchronisation
{accu} ¡ {sub} ¡
Merge ¡ {accu} ¡ net ¡merge ¡{ ¡ ¡ ¡box ¡Merge( ¡(accu, ¡sub_res) ¡-‑> ¡ ¡ ¡ ¡(accu) ¡| ¡(result)); ¡ } ¡connect ¡( ¡[|{accu}, ¡{sub_res} ¡|] ¡.. ¡Merge)*{result}; ¡
SLIDE 20 Raytracing Application
Runtime on Shared Memory
Read ¡ Scene ¡
Solve ¡
Gen ¡ Image ¡
Merge ¡
Solve ¡ Solve ¡ 0 ¡ 50 ¡ 100 ¡ 150 ¡ 200 ¡ 250 ¡ 300 ¡ 350 ¡ 400 ¡ 450 ¡ 500 ¡ 1 ¡ 2 ¡ 4 ¡ 8 ¡ 16 ¡ 32 ¡ RunQme ¡in ¡Seconds ¡ Number ¡of ¡Cores ¡
SLIDE 21 Raytracing Application
Speed-Up vs. original C Code
0.00 ¡ 2.00 ¡ 4.00 ¡ 6.00 ¡ 8.00 ¡ 10.00 ¡ 12.00 ¡ 14.00 ¡ 1 ¡ 2 ¡ 4 ¡ 8 ¡ 16 ¡ 32 ¡ Speed-‑Up ¡ Number ¡of ¡Cores ¡ 1 ¡ 2 ¡ 4 ¡ 8 ¡ 16 ¡ 32 ¡ SpeedUp ¡ 0.97 ¡ 1.27 ¡ 2.13 ¡ 3.62 ¡ 6.22 ¡ 12.11 ¡
Read ¡ Scene ¡
Solve ¡
Gen ¡ Image ¡
Merge ¡
Solve ¡ Solve ¡
SLIDE 22
S-Net Features
Splitting using Distributed Memory
Solve ¡ Solve ¡ Solve ¡
net ¡split ¡{ ¡ ¡ ¡box ¡Solve( ¡(scene) ¡-‑> ¡(raster)); ¡ } ¡connect ¡Solve!<task>; ¡
Solve ¡ Solve ¡ Solve ¡
net ¡split ¡{ ¡ ¡ ¡box ¡Solve( ¡(scene) ¡-‑> ¡(raster)); ¡ } ¡connect ¡Solve!@<task>; ¡
SLIDE 23 Raytracing Application
Runtime on Cluster
Read ¡ Scene ¡
Solve ¡
Gen ¡ Image ¡
Merge ¡ Solve ¡ Solve ¡
0 ¡ 50 ¡ 100 ¡ 150 ¡ 200 ¡ 250 ¡ 300 ¡ 350 ¡ 400 ¡ 450 ¡ 1 ¡ 2 ¡ 4 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡ RunQme ¡in ¡Seconds ¡ Number ¡of ¡Nodes ¡
SLIDE 24 Raytracing Application
Speed-Up vs. original C Code and MPI
Read ¡ Scene ¡
Solve ¡
Gen ¡ Image ¡
Merge ¡ Solve ¡ Solve ¡
0.00 ¡ 1.00 ¡ 2.00 ¡ 3.00 ¡ 4.00 ¡ 5.00 ¡ 6.00 ¡ 1 ¡ 4 ¡ 8 ¡ 12 ¡ Speed-‑Up ¡ Number ¡of ¡Nodes ¡ 1 ¡ 2 ¡ 4 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡ MPI/SN ¡ 0.99 ¡ 1.04 ¡ 1.06 ¡ 1.04 ¡ 1.05 ¡ 1.06 ¡ 1.06 ¡ Seq/SN ¡ 0.98 ¡ 1.23 ¡ 2.06 ¡ 3.19 ¡ 3.57 ¡ 4.13 ¡ 4.79 ¡
SLIDE 25 Utilising Resources Efficiently
Dynamic Load Scheduling
Problem ¡
Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡
SLIDE 26 Problem ¡
Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡
Utilising Resources Efficiently
Dynamic Load Scheduling
SLIDE 27 Problem ¡
Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Prob ¡ Sub-‑ ¡ Result ¡ Sub-‑ ¡ Prob ¡
Utilising Resources Efficiently
Dynamic Load Scheduling
SLIDE 28 Problem ¡
Sub-‑ ¡ Result ¡
Result ¡
Sub-‑ ¡ Result ¡ Sub-‑ ¡ Result ¡ Sub-‑ ¡ Result ¡ Sub-‑ ¡ Result ¡
Utilising Resources Efficiently
Dynamic Load Scheduling
SLIDE 29
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
Utilising Resources Efficiently
Dynamic Load Scheduling in S-Net
Solve ¡ Read ¡ Scene ¡ Merge ¡
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
{<cpu>} ¡
SLIDE 30
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
Utilising Resources Efficiently
Dynamic Load Scheduling in S-Net
Solve ¡ Read ¡ Scene ¡ Merge ¡
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
{<cpu>} ¡
{scn_name, ¡ <num_tasks>, ¡ <num_cpus>} ¡ ¡ ¡ ¡{scene, ¡<task>, ¡<num_tasks>, ¡<cpu>} ¡ | ¡{scene, ¡<task>, ¡<num_tasks>} ¡
SLIDE 31
S-Net Combinators
Choice
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
Solve ¡
{cpu} ¡ {sub} ¡ {cpu} ¡ {scn} ¡ ¡ ¡ ¡{scene, ¡<task>,<cpu>} ¡ ¡ ¡ ¡{raster, ¡<task>} ¡ | ¡{<cpu>} ¡ ¡ ¡ ¡{<cpu>} ¡ | ¡{scene, ¡<task>} ¡ ¡ ¡ ¡{<cpu>, ¡scene} ¡
net ¡solving ¡{ ¡ ¡ ¡ ¡... ¡ } ¡connect ¡(Solve ¡| ¡[|{cpu},{scene}|]) ¡*{raster}; ¡
SLIDE 32 {cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
Raytracing Application
Parallelised Approach
Read ¡ Scene ¡ Merge ¡
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
{<cpu>} ¡
Solve ¡ Solve ¡ Solve ¡
SLIDE 33 Raytracing Application
Runtime in Shared Memory
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
Read ¡ Scene ¡
Merge ¡
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
{<cpu>} ¡
Solve ¡ Solve ¡ Solve ¡
0 ¡ 100 ¡ 200 ¡ 300 ¡ 400 ¡ 500 ¡ 1 ¡ 2 ¡ 4 ¡ 8 ¡ 16 ¡ 32 ¡ RunQme ¡in ¡Seconds ¡ Number ¡of ¡Cores ¡
SLIDE 34 Raytracing Application
Runtime on Cluster + Shared Memory
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
Read ¡ Scene ¡
Merge ¡
{cpu} ¡ {sub} ¡ {cpu} ¡ {sub} ¡
{<cpu>} ¡
Solve ¡ Solve ¡ Solve ¡
0 ¡ 50 ¡ 100 ¡ 150 ¡ 200 ¡ 250 ¡ 300 ¡ 350 ¡ 400 ¡ 450 ¡ 1 ¡ 2 ¡ 4 ¡ 8 ¡ 12 ¡ RunQme ¡in ¡Seconds ¡ Number ¡of ¡Nodes ¡
SLIDE 35
S-Net on one Slide
Combinators
A B A ¡ B ¡ A ¡ A A A … A .. B A*{p} A | B A!<t>
SLIDE 36
Thank you! End.
SLIDE 37
S-Net Tool-Chain
Overview
S-‑Net ¡ Compiler ¡ Box ¡ Compiler ¡ S-‑Net ¡ RunQme ¡ Box ¡ Interface ¡
Executable ¡
S-‑Net ¡ Module ¡ Library ¡/ ¡ Objects ¡