6.1.12 · D3 · HinglishParallelism & Multicore

Worked examplesHeterogeneous computing concepts

1,997 words9 min read↑ Read in English

6.1.12 · D3 · Hardware › Parallelism & Multicore › Heterogeneous computing concepts

Parent topic par wapas jao: parent topic.


Scenario matrix

Is topic ka har problem kuch giney-chune shapes mein se ek hota hai. Neeche ki table poora menu hai. Har worked example neeche us cell ke saath tagged hai jo wo cover karta hai, aur saath milake har row ko touch karte hain.

Cell Scenario class Yeh kya test karta hai Degenerate / limiting edge
A High arithmetic intensity Kya itna bada hai ki transfer ko beat kare? : GPU hamesha jeetega
B Low arithmetic intensity Same, lekin task data-heavy hai : kabhi offload mat karo
C Exact break-even Kahan hetero = CPU-only?
D Amdahl with serial floor Kitna serial fraction speedup ko maar deta hai? : pure parallel
E Amdahl, infinite GPU Woh ceiling jo koi nahi tod sakta
F Transfer-tax dominance Jab PCIe tax, compute nahi, rule karta hai large
G Pipeline, balanced stages par Speedup sab equal
H Pipeline, one bottleneck Sabse slow stage throughput cap karti hai ek baaki
I Real-world word problem English → symbols translate karo
J Exam twist (unified memory) ko poori tarah hataana

Hum parent se yeh master formulas baar baar use karte hain, ek baar restate kiye taaki har symbol earned ho:


Example 1 — Cell A: high arithmetic intensity (GPU badi jeet)

Forecast: matrix multiply GPUs ka poster child hai ( work, data). Guess: haan, asaani se.

  1. Break-even work threshold compute karo. Yeh step kyun? Formula humein woh minimum batata hai jisse offloading pay kare; phir hum apna real usse compare karte hain.
  2. Compare karo. Kyun? Offload tab worth it hai jab actual work threshold se zyada ho. Actual FLOP GFLOP.

Verify: actual hetero time . CPU-only ms. Hetero faster hai — "offload" ke consistent. ✓


Example 2 — Cell B: low arithmetic intensity (GPU haarta hai)

Forecast: teen memory touches par ek add — yahi woh "GPUs ke liye terrible" case hai jiske baare mein parent ne warning di thi. Guess: offload mat karo.

  1. Break-even threshold. Kyun? Pehle jaisa test, ab ek data-heavy task ke saath.
  2. Compare karo. Kyun? Actual GFLOP.

Verify: hetero time ms; CPU-only ms. Hetero 750× slower hai — transfer tax ne trivial compute ko daba diya. ✓ (Arithmetic intensity FLOP/byte, 70 FLOP/byte crossover se kaafi neeche.)


Example 3 — Cell C: exact break-even point

Forecast: parent ne yeh kaam kiya tha aur GFLOP mila tha. Confirm karte hain aur dekhte hain.

Figure — Heterogeneous computing concepts
  1. Donon times barabar set karo. Kyun? Break-even by definition hai.
  2. ke liye solve karo. Kyun? Hum crossover work chahte hain.

Verify: TFLOP par, hetero s aur CPU s — barabar. ✓ Figure dekho: amber line ke daayein GPU jeetega (Cell A), baayein CPU jeetega (Cell B). Ek line poori duniya split kar deti hai.


Example 4 — Cell D & F: Amdahl with serial floor aur transfer tax

Forecast: GPU 50× hai lekin serial + tax isko crush kar denge — guess low double digits.

  1. Heterogeneous Amdahl mein plug karo. Kyun? Yeh master speedup formula hai.
  2. Loss attribute karo. Kyun? Dekhne ke liye ki kaunsa term hurt karta hai. Serial contribute karta hai, tax , parallel sirf denominator mein. Donon fixed costs () compute term ko dwarf karte hain.

Verify: — parent ke se match karta hai. ✓


Example 5 — Cell E: infinite GPU (ceiling)

Forecast: term vanish ho jaayega, sirf fixed costs bachenge. Guess: around 14×.

  1. Limit lo. Kyun? Woh hard ceiling dhundho jo koi hardware nahi tod sakta.
Figure — Heterogeneous computing concepts

Verify: ✓ Figure mein curve 14.29 par rise karke flatten ho jaata hai — proof ki ek point ke baad faster GPU khareedna tumhe kuch nahi deta. Yeh exactly Amdahl's Law and Scalability hai heterogeneous kapdon mein.


Example 6 — Cell D edge: zero serial fraction

Forecast: koi serial floor nahi — 50× ke kaafi kareeb hona chahiye.

  1. Substitute karo. Kyun? Degenerate best case dekhne ke liye.

Verify: . ✓ Notice karo: zero serial code ke saath bhi answer 25 hai, 50 nahi — sirf transfer tax ne ise half kar diya. Tax ek serial cost hai chhupe hue roop mein.


Example 7 — Cell J: unified memory tax hataa deta hai

Forecast: denominator se 0.02 hatane se hum 14× se upar jaayenge.

  1. Recompute karo. Kyun? Data movement eliminate karne ki value isolate karo.
  2. Ex. 4 se compare karo. Kyun? Jeet quantify karne ke liye. vs — sirf unified memory se 29% improvement.

Verify: ; ratio . ✓ Directly Memory Hierarchy and Caching aur DMA and I/O Controllers se juda hai — DMA/unified memory ka poora point hi hai woh term ko chhota karna.


Example 8 — Cell G: balanced pipeline

Forecast: teen equal stages → speedup 3 ke paas jaayega.

Figure — Heterogeneous computing concepts
  1. Sequential time. Kyun? Koi overlap nahi wala baseline.
  2. Pipelined time. Kyun? Pehla item full latency pay karta hai, phir hum slowest stage ki rate par sustain karte hain.
  3. Speedup. , aur jab .

Verify: . ✓ Figure ka staircase dikhata hai ki stages fully overlap kar rahi hain — pipe full hone ke baad har 4 ms mein ek nayi image start hoti hai.


Example 9 — Cell H: ek bottleneck stage

Forecast: compute baaki se 5× hai — throughput 10 ms se limit hoga, toh speedup ≈ , 3 nahi.

  1. Sequential. ms. Kyun? Baseline.
  2. Pipelined. . Kyun? Pipe fill hone ke baad har 10 ms mein ek result deta hai.
  3. Speedup. , limit .

Verify: ✓ Lesson: pipeline utni hi fast hoti hai jitna uska slowest station — stages balance karo (relates to load balancing in Parallel Programming Models).


Example 10 — Cell I: real-world word problem

Forecast: 4 GB par 8 TFLOP work → intensity FLOP/byte, bahut zyada. Guess: strongly offload.

  1. Break-even threshold. Kyun? Decision test.
  2. Compare karo. Actual GFLOP GFLOP offload karo. Kyun? Work threshold se 30× zyada hai.
  3. Jeet quantify karo. Kyun? Managers ko number chahiye.

Verify: ; threshold TFLOP. ✓ Units check: . ✓


Recall Self-test — answers chhupa lo

Infinite GPU ke saath bhi speedup kahan cap hota hai? ::: Cell E — par cap hota hai. Vector add vs matrix multiply: Cell B (offload mat karo) kaun sa hai? ::: Vector add (low arithmetic intensity, work / data). Balanced 3-stage pipeline mein speedup ___ ke paas jaata hai? ::: 3, yaani . Unified memory speedup improve karta hai kaunsa term zero set karke? ::: (Cell J). Break-even threshold kis quantity ke saath badhta hai, offload ko hurt karta hai? ::: Data size (bade transfers ko justify karne ke liye zyada work chahiye).