Harmony: Collec.on and Analysis of Parallel Block Vectors - PowerPoint PPT Presentation
Harmony: Collec.on and Analysis of Parallel Block Vectors Melanie Kambadur Kui Tang, Martha Kim Columbia University 1 Parallelism Time 2
Harmony: ¡Collec.on ¡and ¡Analysis ¡ of ¡Parallel ¡Block ¡Vectors ¡ Melanie ¡Kambadur ¡ Kui ¡Tang, ¡Martha ¡Kim ¡ Columbia ¡University ¡ ¡ 1 ¡
Parallelism ¡ Time ¡ 2 ¡
Parallelism ¡ Time ¡ Code ¡currently ¡execu.ng ¡ 3 ¡
Parallel ¡Block ¡Vector ¡Profiles ¡(PBVs) ¡ • Maps ¡between ¡dynamic ¡parallelism ¡ and ¡program ¡code ¡ • Harmony: ¡low ¡overhead ¡collec.on ¡of ¡ PBVs ¡ ¡ 4 ¡
In ¡a ¡mul.threaded ¡program ¡ execu.on… ¡ T4 ¡ T3 ¡ T2 ¡ T1 ¡ Start ¡ Program ¡execu.on ¡.me ¡ End ¡ 5 ¡
…there ¡are ¡parallel ¡and ¡serial ¡phases ¡ T4 ¡ T3 ¡ T2 ¡ T1 ¡ Parallel ¡ Serial ¡ Serial ¡ 6 ¡
To ¡see ¡how ¡parallel, ¡ ¡ count ¡threads ¡at ¡each ¡change: ¡ ¡ T4 ¡ T3 ¡ T2 ¡ T1 ¡ Thread ¡ ¡ Count ¡ =1 ¡ =3 ¡ =1 ¡ =4 ¡ 7 ¡
What ¡can ¡already ¡be ¡measured? ¡ Sta.c ¡analysis ¡can ¡track ¡thread ¡ crea.on ¡and ¡destruc.on ¡calls ¡ Tools ¡like ¡Vtune, ¡Gprof ¡+ ¡Quartz ¡give ¡ the ¡dynamic ¡length ¡of ¡each ¡phase ¡ No ¡way ¡to ¡link ¡dynamic ¡parallelism ¡ phases ¡and ¡code ¡ 8 ¡
What ¡parts ¡of ¡the ¡program ¡execute ¡in ¡ different ¡parallelism ¡phases? ¡ T4 ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ T3 ¡ BB6 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ads ¡ dynamic ¡run ¡ EffecBve ¡ – ¡Threads ¡not ¡ Diff. ¡with ¡nominal ¡to ¡ wai.ng ¡for ¡a ¡blocking ¡ see ¡blocking ¡call ¡ call ¡e.g. ¡pthread_wait ¡ slowdown ¡ Running ¡ – ¡Threads ¡ More ¡specific ¡count ¡if ¡ granted ¡access ¡to ¡a ¡core ¡ there ¡are ¡more ¡ by ¡the ¡O/S ¡ threads ¡than ¡cores ¡ 14 ¡
Harmony: ¡A ¡tool ¡for ¡PBV ¡Collec.on ¡ • Downloadable ¡tool: ¡ ¡ ¡ ¡ ¡ ¡arcade.cs.columbia.edu/harmony ¡ • LLVM ¡Pass ¡− ¡easy ¡for ¡people ¡to ¡use, ¡just ¡run ¡ compile ¡program ¡then ¡run ¡normally ¡ • Precise, ¡not ¡sampled ¡− ¡otherwise ¡might ¡not ¡ see ¡outliers ¡ • OpBmized ¡for ¡low ¡overheads ¡− ¡don’t ¡want ¡to ¡ perturb ¡parallel ¡programs! ¡ 15 ¡
Collec.ng ¡PBV ¡Profiles ¡ Main ¡Idea: ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ Low ¡overhead ¡ collec.on ¡via ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ sta.cally ¡inserted ¡ instrumenta.on ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ points ¡to ¡collect ¡ ¡ BB1 ¡ BB2 ¡ BB3 ¡ BB4 ¡ BB5 ¡ data ¡dynamically ¡ upon ¡execu.on. ¡ 16 ¡
Collec.ng ¡PBV ¡Profiles ¡ At ¡program ¡start ¡ and ¡end: ¡ create ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ data ¡structures ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ BB1 ¡ BB2 ¡ BB3 ¡ BB4 ¡ BB5 ¡ 17 ¡
Collec.ng ¡PBV ¡Profiles ¡ At ¡program ¡start ¡ and ¡end ¡ ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ At ¡thread ¡create ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ and ¡exit: ¡ ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ adjust ¡global ¡ thread ¡counts ¡ BB1 ¡ BB2 ¡ BB3 ¡ BB4 ¡ BB5 ¡ 18 ¡
Collec.ng ¡PBV ¡Profiles ¡ At ¡program ¡start ¡ and ¡end ¡ ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ At ¡thread ¡create ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ and ¡exit ¡ ¡ ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ At ¡blocking ¡calls: ¡ adjust ¡global ¡ BB1 ¡ BB2 ¡ BB3 ¡ BB4 ¡ BB5 ¡ thread ¡counts ¡ 19 ¡
Collec.ng ¡PBV ¡Profiles ¡ At ¡program ¡start ¡ and ¡end ¡ ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ At ¡thread ¡create ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ and ¡exit ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ Per ¡basic ¡block: ¡ BB1 ¡ BB2 ¡ BB3 ¡ BB4 ¡ BB5 ¡ Increment ¡counter ¡ 20 ¡
Strategies ¡for ¡Keeping ¡Overheads ¡Low ¡ Strategy ¡ Effect ¡ Sta.c ¡instrumenta.on ¡ Overhead ¡in ¡compile, ¡not ¡ run.me ¡ Push ¡instrumenta.on ¡ Min. ¡overhead ¡(single ¡ outside ¡of ¡basic ¡blocks ¡ incr.) ¡per ¡block ¡ Thread ¡specific ¡ No ¡excessive ¡locking ¡ structures ¡& ¡counters ¡ Organize ¡data ¡for ¡cache ¡ L1-‑I ¡and ¡L1-‑D ¡miss ¡rates ¡ locality ¡ increased ¡<=0.06, ¡0.2% ¡ 21 ¡
Harmony ¡Overheads ¡on ¡Parsec ¡ Max ¡overhead ¡= ¡44% ¡ 50 % Keep Thread Count Increment Histogram 40 % Overhead 30 % 20 % 10 % 0 % blackscholes bodytrack dedup facesim fluidanimate streamcluster swaptions x264 blackscholes bodytrack dedup facesim fluidanimate streamcluster swaptions x264 Profiling (Nominal Threads) Profiling (Effective Threads) Avg. ¡overhead ¡= ¡16% ¡ Avg. ¡overhead ¡= ¡21% ¡ 22 ¡
Harmony ¡Overheads ¡on ¡Parsec ¡ Avg. ¡overhead ¡= ¡16.2% ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ 2.5% ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ 0.8% ¡ BB6 ¡ BB7 ¡ BB8 ¡ BB9 ¡ 13.0% ¡ BB1 ¡ BB2 ¡ BB3 ¡ BB4 ¡ BB5 ¡ 23 ¡
PBV ¡Profiles ¡of ¡Parsec ¡Applica.ons ¡ fluidanimate fluidanimate streamcluster streamcluster swaptions swaptions x264 x264 (3054 BBLs) (3054 BBLs) (3547 BBLs) (3547 BBLs) (374 BBLs) (374 BBLs) (286 BBLs) (286 BBLs) (147 BBLs) (147 BBLs) (3054 BBLs) (3054 BBLs) 1e+12 TC= ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ # ¡of ¡Dynamic ¡Execu.ons ¡ BB1 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 1e+10 BB2 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ StaBc ¡BBLs ¡ 1e+08 BB3 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ BB4 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 1e+06 BB5 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ BB6 ¡ 0 ¡ 0 ¡ 0 ¡ 3 ¡ 10000 BB7 ¡ 0 ¡ 0 ¡ 0 ¡ 3 ¡ BB8 ¡ 0 ¡ 0 ¡ 0 ¡ 3 ¡ 100 BB9 ¡ 0 ¡ 0 ¡ 1 ¡ 2 ¡ 1 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 Nominal ¡Thread ¡Count ¡ 5 5 24 ¡ Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC Nominal TC
Recommend
More recommend
Explore More Topics
Stay informed with curated content and fresh updates.