6.1.12 · D4 · HinglishParallelism & Multicore

ExercisesHeterogeneous computing concepts

2,200 words10 min read↑ Read in English

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

Poore note mein, hum parent note ke symbols reuse karte hain. Contract maintain karne ke liye, yahan sabhi ek jagah plain words mein hain:


Level 1 — Recognition

L1.1

Har chip ko CPU-like (latency-optimised) ya GPU-like (throughput-optimised) classify karo: (a) 8 powerful cores with megabytes of cache aur branch prediction; (b) 2048 tiny ALUs ek small cache share karte hue, many threads mein ek instruction run karte hue; (c) ek fixed-function block jo sirf AES encryption karta hai.

Recall Solution
  • (a) CPU-like — kuch strong cores + bade caches + branch prediction sab ek task ki latency serve karte hain.
  • (b) GPU-like — hazaron simple lanes SIMT (Single Instruction, Multiple Threads) run karte hue many tasks ka throughput serve karte hain. Dekho SIMD and Vector Processing.
  • (c) Koi bhi general type nahi — ye ek specialized accelerator hai (fixed-function). Narrow domain hai, isliye hardwired logic energy mein jeet jaata hai.

L1.2

Ek system mein 4 identical ARM cores hain. Kya ye heterogeneous hai? Ab usme 1 GPU aur 1 NPU add hote hain. Ab?

Recall Solution
  • 4 identical cores = homogeneous (same instruction set, same strengths).
  • GPU + NPU add karna = heterogeneous — do ya zyada different processor types jinke distinct computational models hain.

Level 2 — Application

L2.1

PCIe link jahan GB/s hai. Aapko GB GPU ko move karna hai aur result wapas lana hai. Round-trip transfer mein kitna time lagega?

Recall Solution

Round-trip ka matlab hai data do baar cross karta hai, isliye moved amount hai.

L2.2

Same link. Aapka GPU TFLOP/s pe run karta hai; aapka CPU TFLOP/s pe. Parent ki break-even formula use karke, us 1 GB ke liye minimum work kya hai jo GPU ko worthwhile banata hai?

Recall Solution

, , , plug in karo (sab matching TFLOP/s aur GB/s units mein, TFLOP deta hai): Iska matlab: jab tak task ko kam se kam ~69 billion operations nahi chahiye, 62.5 ms ki trip jo bachat ho sakti thi usse zyada cost karta hai. Arithmetic intensity floor hai FLOP/byte.

L2.3

Do matrices ka matrix–matrix multiply FLOPs leta hai aur bytes move karta hai (teen float32 matrices). ke liye arithmetic intensity compute karo. Kya ye 69 FLOP/byte floor se upar hai?

Recall Solution

FLOP. bytes MB. Intensity FLOP/byte. ✓ — matrix multiply floor aaram se clear karta hai. Yahi wajah hai ki GEMM GPUs ko love karta hai. Contrast — vector add. Do length- float32 arrays add karne mein FLOPs lagte hain (ek add per element) lekin bytes move hote hain (do operands read, ek result write, 4 bytes each). Toh intensity FLOP/byte — ek akeela add per 12 bytes moved, GPU ke liye bilkul bekar. Dekho Roofline Performance Model.


Level 3 — Analysis

L3.1

Heterogeneous Amdahl's Law. Ek program parallel, serial hai, GPU speedup , transfer tax (original time ka 5%) hai. Overall speedup nikalo.

Recall Solution

20× engine ke bawajood, hum ~5× milta hai. serial floor plus tax hume cap karta hai. Dekho Amdahl's Law and Scalability.

L3.2

L3.1 lo aur set karo (infinitely fast GPU). Speedup ki hard ceiling kya hai? Kaun sa ek change us ceiling ko sabse zyada raise karega?

Recall Solution

Jab , toh term : Ceiling poori tarah serial fraction + transfer tax se set hoti hai, GPU speed se nahi. Sabse bada lever: kam karo (zyada code parallelize karo) ya (unified memory copies remove karta hai — dekho Memory Hierarchy and Caching). Is point ke baad faster GPU kharidna paisa barbad karna hai.

L3.3

Pipeline. Chaar stages ms per image lete hain. images process karo. Sequential vs pipelined time compare karo aur speedup do.

Neeche figure (alt: ek Gantt-style timeline). Top strip sequential schedule dikhata hai — har image ki har stage end-to-end laid out hai, isliye time bas add hota jaata hai. Bottom strip pipelined schedule dikhata hai — har naya image ek bottleneck-length ( ms) baad shuru hota hai, isliye sab chaar stages concurrently run karti hain aur sabse lamba bar () rhythm set karta hai. Horizontal axis time in ms hai; har colour ek stage hai.

Figure — Heterogeneous computing concepts
Recall Solution

Stages ka sum ms. Slowest stage ms. Sequential: ms. Pipelined: ms. Speedup: . Jab tab limit hai . 5 ms wali slow stage bottleneck hai — kisi bhi doosri stage ko fast karna kuch nahi karta. Dekho Parallel Programming Models.


Level 4 — Synthesis

L4.1

Aapko CPU-only vs heterogeneous decide karna hai ek task ke liye jisme GFLOP aur GB hai, L2 machine pe (, , TFLOP/s). Dono times compute karo aur decide karo.

Recall Solution

CPU akela: s. Heterogeneous: s. , isliye CPU jeeetta hai. Samajh aata hai: GFLOP L2.2 ke 69.4 GFLOP floor se neeche hai. Transfer toll pay karne ke liye kaafi kaam nahi hai.

L4.2

Redesign: GB rakho lekin work GFLOP tak badhao (denser algorithm). Dono recompute karo. Ab kaun jeeeta hai, aur kitne se?

Recall Solution

CPU: s. Hetero: s. Speedup: . GPU ab clearly jeetta hai — same data, zyada kaam per byte ne break-even line cross ki. Lesson: arithmetic intensity badhana, sirf chip speed nahi, GPU ko unlock karta hai.

L4.3

Ek 3-stage pipeline di gayi hai (CPU pe read, GPU pe compute, CPU pe write) per-image times ms ke saath, aur images — choose karo ki kaun sa stage optimize karein agar aap exactly ek stage ko aadha kar sakte ho. Har choice ke liye pipelined time compute karo aur justify karo.

Recall Solution

Baseline pipelined: ms.

  • Read aadha karo (4→2): , still 10 → ms. Barely hilta hai.
  • Compute aadha karo (10→5): , new ms. Bahut bada.
  • Write aadha karo (3→1.5): , still 10 → ms. Negligible. Compute choose karo — ye bottleneck hai (). Sirf sabse lamba stage chhota karne se sustained throughput girta hai.

Level 5 — Mastery

L5.1

Full system design. Ek neural-net training step: (matrix ops), , , current . (a) Current speedup nikalo. (b) Aap unified memory kharidite ho jo tak drop karta hai. Naya speedup? (c) Absolute ceiling () naye tax ke saath kya hai, aur aapko aage kya attack karna chahiye?

Recall Solution

(a) (b) replace karo: (c) Ceiling: Kyunki GPU speed almost maxed hai ( term chhota hai), agla target hai serial fraction — data loading / loss / parameter updates parallelize karo. Bhi relevant hai: Power and Energy Optimization aur DMA and I/O Controllers un transfers ko overlap karne ke liye.

L5.2

Cost-effectiveness ranking. L5.1 baseline ke liye (), teen upgrades ko resulting speedup se rank karo: (i) GPU speed double karo ; (ii) serial fraction aadhi karo (us 2.5% ko mein move karo, toh ); (iii) transfer tax aadhi karo .

Recall Solution
  • (i)
  • (ii)
  • (iii) Ranking: (ii) 15.50× > (iii) 12.66× > (i) 12.58×. Serial fraction attack karna badi jeet se jeetta hai — kyunki pe parallel term already tiny hai, isliye GPU double karna barely help karta hai. Amdahl's ceiling boss hai.