0Pricing
CUDA Academy · درس

استخدام وحدات GPU متعددة مع NCCL

الاتصال الجماعي للتوسّع

استخدام وحدات GPU متعددة مع NCCL درس مجاني في CUDA Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في CUDA Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة CUDA Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Hand-Rolled Gets Hard

Wiring peer copies by hand across many GPUs becomes messy fast. For real scaling you want a library built for collective communication.

Meet NCCL

NVIDIA's answer is NCCL, the collective communications library. It moves data among GPUs using the fastest links it can find, automatically.

What a Collective Is

A collective is one operation that every GPU joins together, like summing a value held on each card. All devices cooperate in a single call.

The Star Collective: AllReduce

The workhorse is AllReduce. It combines a buffer from every GPU, say by adding, and hands the same result back to all of them.

ncclAllReduce(send, recv, n, ncclFloat, ncclSum, comm, stream);

More Collectives

NCCL also offers Broadcast to share one GPU's data with all, plus AllGather and ReduceScatter for other common exchange patterns.

The Communicator

The GPUs that talk together form a group tracked by a communicator. Every collective call passes this handle so NCCL knows the participants.

Ranks Identify GPUs

Inside a communicator each GPU gets a number called its rank, from 0 up. Ranks let you say who sends, who receives, and who is the root.

Building the Communicators

For GPUs in one process, ncclCommInitAll sets up every communicator at once from the list of device ids you provide.

ncclCommInitAll(comms, nGpus, devs);

Stream Aware

Every NCCL call takes a stream. Operations queue there and run alongside your kernels, so communication overlaps computation.

Grouping Calls

To issue collectives on many GPUs without deadlock, wrap them between ncclGroupStart and ncclGroupEnd so NCCL launches them together.

ncclGroupStart();
// per-GPU calls
ncclGroupEnd();

Why Training Loves It

Deep learning syncs gradients across GPUs every step. AllReduce is exactly that, which is why NCCL powers nearly all multi-GPU training.

Quick Check

Recall the NCCL collective that sums a buffer across GPUs and returns the result to all of them.

Recap

NCCL runs collectives like AllReduce over fast links, organized by a communicator of ranked GPUs. It is the backbone of multi-GPU training. Course complete. ✨

الأسئلة الشائعة

هل درس «استخدام وحدات GPU متعددة مع NCCL» مجاني؟

نعم — نص درس «استخدام وحدات GPU متعددة مع NCCL» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة CUDA Academy، انتقل إلى CoddyKit PRO. تتضمن دورة CUDA Academy 4 دروس في المجموع.

ماذا ستتعلم في «استخدام وحدات GPU متعددة مع NCCL»؟

الاتصال الجماعي للتوسّع تتمرن على CUDA Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ CUDA Academy؟

لا تُشترط خبرة سابقة. CUDA Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «استخدام وحدات GPU متعددة مع NCCL»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس CUDA Academy هذا؟

نعم. كل درس في CUDA Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. حصر الأجهزة واختيارها
  2. تقسيم العمل بين وحدات GPU
  3. الوصول إلى الذاكرة من نظير إلى نظير
  4. استخدام وحدات GPU متعددة مع NCCL
← العودة إلى CUDA Academy