- GPU आधुनिक मशीन लर्निंग में केंद्रीय भूमिका निभाता है, और इसकी संरचना में उच्च-गति matrix multiplication के लिए विशेषीकृत अनेक Streaming Multiprocessors(SMs) और HBM(High Bandwidth Memory) का संयोजन होता है
- GPU का SM, Tensor Core (matrix multiplication) और CUDA Core (vector operations) में बंटा होता है, और बड़े पैमाने की parallel computation तथा flexible programming को सपोर्ट करता है
- GPU और TPU में आंतरिक संरचना और नेटवर्क कॉन्फ़िगरेशन के स्तर पर अंतर होता है; GPU की general-purpose क्षमता और scalability अधिक होती है, लेकिन optimal performance पाने के लिए अधिक बातों पर ध्यान देना पड़ता है
- Node के भीतर NVLink और NVSwitch के ज़रिये GPUs के बीच ultra-fast communication संभव है, और nodes के बीच InfiniBand जैसे नेटवर्क के माध्यम से कनेक्शन बनाकर large-scale distributed training को सपोर्ट किया जाता है
- GPU पर collective operations (जैसे: AllReduce, AllGather आदि) का प्रदर्शन hardware structure और network hierarchy पर काफी निर्भर करता है, और यह अक्सर सैद्धांतिक bandwidth से व्यावहारिक रूप से कम रहता है
GPU क्या है?
- नवीनतम ML(मशीन लर्निंग) GPU (जैसे: H100, B200) में matrix multiplication के लिए विशेषीकृत दर्जनों से सैकड़ों Streaming Multiprocessor(SM) और तेज़ HBM memory का संयोजन होता है
- हर SM में Tensor Core (matrix multiplication), Warp Scheduler (vector operations), SMEM (on-chip cache) शामिल होते हैं
- TPU के विपरीत, GPU 100 से अधिक SMs के माध्यम से अधिक flexible और बड़े पैमाने की parallel processing उपलब्ध कराता है
SM की विस्तृत संरचना
- SM को 4 sub-partitions में बांटा जाता है, और हर sub-partition में अलग-अलग Tensor Core, CUDA Core (vector operations), Warp Scheduler, register file आदि होते हैं
- CUDA Core vector arithmetic operations (SIMD/SIMT) संभालता है, जबकि Tensor Core matrix multiplication के लिए विशेषीकृत होता है
- Tensor Core FLOPs बहुत अधिक होते हैं, और low-precision operations में processing speed और भी तेज़ हो जाती है
- नवीनतम GPU (जैसे: B200) में बड़े TMEM की अतिरिक्त सुविधा है, जो बड़े Tensor Core inputs को सपोर्ट करती है
CUDA Core की लचीलापन
- GPU का CUDA Core SIMT(Single Instruction Multiple Threads) मॉडल का उपयोग करता है, जिसमें एक instruction कई threads पर parallel execute होती है
- हर thread के पास स्वतंत्र instruction pointer (program counter) होता है, जिससे conditional branching जैसी flexibility मिलती है; लेकिन warp के भीतर instruction divergence ज़्यादा होने पर performance घटती है
- हर CUDA Core को individual state और memory access की स्वतंत्रता होती है (TPU केवल contiguous memory को संभाल सकता है)
Scheduling/Parallelism
- SM अनेक warps (अधिकतम 64) को schedule करके एक साथ execute करता है, और हर warp scheduler एक समय में एक program चलाता है
- इसी संरचना की वजह से GPU काफ़ी flexible होने के साथ-साथ high concurrency भी उपलब्ध कराता है
GPU memory structure
- GPU में HBM सबसे बड़ी memory होती है, और इसके अलावा L2/L1(SMEM)/TMEM/registers जैसी memory hierarchy भी होती है
नवीनतम GPU specifications का सारांश
- SM(Streaming Multiprocessor) की संख्या, clock, memory, FLOPs, bandwidth(BW) आदि हर model के अनुसार अलग होते हैं
- memory capacity(HBM), bandwidth, FLOPs (floating point/integer/low precision) आदि हर generation के साथ बढ़ते गए हैं
- तालिका (हटाई गई) में मुख्य विशेषताएँ: Blackwell(B200) में HBM 192GB, HBM BW 8.0TB/s, FP8 FLOPs 4.5e15 आदि
- हर generation में register और on-chip cache(SMEM) capacity, TMEM का जुड़ना आदि hardware advancement स्पष्ट रूप से दिखते हैं
GPU/TPU तुलना
- GPU general-purpose होने के साथ कई छोटे SMs (parallel units) में modular होता है, और इसमें hardware control अधिक होने के कारण इसे समझना/optimize करना कठिन होता है
- TPU कुछ बड़े Tensor Cores और कई vector ALU(VPU) से बना होता है, और single-thread control structure के कारण hardware को सरल बनाना और लागत कम करना संभव होता है
- इसी वजह से TPU में compiler optimization अनिवार्य है, जबकि GPU कई kernels को स्वतंत्र रूप से execute कर सकता है, जिससे usability बढ़ती है
- performance/price के लिहाज़ से हाल का H200 GPU, TPU v5p की तुलना में FLOPs/s में 2 गुना, HBM में 1.5 गुना, और कीमत में लगभग 2.5 गुना है
- TPU में VMEM(on-chip cache) अधिक और तेज़ होता है, जिससे LLM model inference जैसे कार्यों में बड़ा लाभ मिल सकता है
GPU hardware quiz Q&A के मुख्य बिंदु
- H100 के fp32 CUDA cores की कुल संख्या 16,896 (132 SM x 4 x 32) है, और B200 में 18,944 हैं
- vector operation FLOPs, H100 के आधार पर अधिकतम 33.5TFLOPs/s के स्तर पर हैं, जो Tensor Core के matrix multiplication FLOPs (990TFLOPs/s) से 30 गुना कम हैं
- H100 की L1/SMEM और registers की कुल capacity 66MB है, जबकि TPU VMEM 120MB है
- Bandwidth और FLOPs का ratio (सैद्धांतिक arithmetic intensity) H100/B200 दोनों में लगभग 280-300 है, जो TPU के समान है
GPU networking (communication structure)
Node/cluster structure
- GPU node आमतौर पर 8 GPUs के समूह में होता है, जिन्हें NVLink (ultra-fast) और NVSwitch (switch) के ज़रिये full bandwidth direct connection मिलता है
- Nodes के बीच InfiniBand (या Ethernet आदि) का उपयोग करके scale-out किया जा सकता है
- नवीनतम (Blackwell) GPU संरचना 72 nodes तक विस्तार योग्य है
Network hierarchy के अनुसार विशेषताएँ
- node के भीतर (NVLink area): हर GPU के लिए egress 450GB/s(H100), 900GB/s(B200), और हर NVSwitch के लिए अधिकतम 1.6TB/s
- node के ऊपर (InfiniBand Leaf/Spine): Leaf Switch(8) से Spine Switch(16) संरचना, और GPU-से-GPU के बीच सैद्धांतिक रूप से 400GB/s full bandwidth बरकरार
- SuperPod जैसी बड़ी architecture में 1024 GPUs (128 nodes), GB200(72GPU Node) में 9 गुना बढ़ी हुई bandwidth (3600GB/s)
Network performance के मुख्य बिंदु
- सैद्धांतिक रूप से network structure (Full Fat Tree) इस तरह डिज़ाइन की जाती है कि node-से-node के बीच भी अधिकतम bandwidth मिले
- hardware port limitations आदि के कारण 1024~4096 GPU तक scale होने पर Spine/Core Switch को और जोड़ने वाली hierarchical पद्धति अपनाई जाती है
- Node के भीतर bandwidth(450GB/s) → Node के बीच bandwidth(400GB/s) में बदलाव = collective operations में performance difference
collective operations की संरचना
- AllGather, AllReduce (sum reduction), AllToAll (distribution) जैसी high-level collective operations का समर्थन
- node के भीतर NVLink के ज़रिये direct connection होने से optimal performance संभव है (सैद्धांतिक B/W), जबकि node-से-node के बीच InfiniBand के माध्यम से संचार होता है
- NVIDIA की NCCL, NVSHMEM libraries का उपयोग किया जाता है
collective operations performance analysis
- AllGather/ReduceScatter: B/W (H100 के लिए 450GB/s) पर ring method से implement, छोटे message में tree method भी संभव
- AllToAll: हर GPU सीधे target GPU को data भेजता है; यह B/W को N से विभाजित करने वाली संरचना है, इसलिए node के भीतर सैद्धांतिक रूप से 2 गुना तेज़
- वास्तविक measurement में AllReduce लगभग 370GB/s के स्तर पर दिखता है, जो hardware maximum तक नहीं पहुँचता
- TPU की तुलना में बड़े आकार (दर्जनों MB ~ GB) पर ही hardware peak bandwidth के करीब पहुँचा जाता है
समग्र सारांश और insights
- GPU की ताकत general-purpose क्षमता और scalability है, लेकिन hardware/network structure के कारण performance optimization की कठिनाई और observability, TPU की तुलना में अधिक हो सकती है
- networking (Intra-Node/NVLink/InfiniBand/Leaf/Spine आदि) large-scale training performance की कुंजी है, और वास्तविक bandwidth तथा सैद्धांतिक bandwidth के अंतर पर ध्यान देना ज़रूरी है
- collective operations और network structure की समझ ultra-large distributed model training/serving में अनिवार्य तत्व है
- वास्तविक benchmark और hardware की detailed structure की समझ के आधार पर performance bottleneck और optimal conditions की पहचान करने वाली प्रक्रिया आवश्यक है
अभी कोई टिप्पणी नहीं है.