التقاط العمل في رسم بياني
تسجيل تدفق في رسم بياني لـ CUDA
التقاط العمل في رسم بياني درس مجاني في CUDA Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في CUDA Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة CUDA Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What a CUDA Graph Is
A CUDA graph records a whole sequence of kernels and copies as one reusable unit of work you can submit again and again.
Launches Add Up
Each individual kernel launch has a tiny CPU overhead. Across thousands of launches per iteration, that cost becomes real.
Define Once, Run Many
A graph lets you describe the work once, then replay it cheaply, paying the setup cost a single time.
Stream Capture Mode
The easiest way to build one is stream capture: you record the normal launches you already issue into a stream.
cudaStreamBeginCapture(stream, cudaStreamCaptureModeGlobal);Issue Work Normally
Between begin and end, you launch kernels and copies as usual. Nothing runs yet; the operations are recorded, not executed.
kernelA<<<g, b, 0, stream>>>(d);
kernelB<<<g, b, 0, stream>>>(d);End the Capture
You stop recording with cudaStreamEndCapture, which hands back a cudaGraph_t describing all the work.
cudaGraph_t graph;
cudaStreamEndCapture(stream, &graph);Dependencies Inferred
Capture figures out the dependencies between operations automatically from how you used the stream.
Instantiate Before Running
A graph is just a description. You compile it into a runnable graph exec object before you can launch it.
cudaGraphExec_t exec;
cudaGraphInstantiate(&exec, graph, 0);Building Graphs by Hand
You can also add nodes explicitly with the graph API for full control over structure and edges.
cudaGraphAddKernelNode(&n, graph, deps, 1, ¶ms);Multiple Streams, One Graph
Capture can span several streams, so independent branches that run concurrently all land in the same graph.
Reuse Across Many Iterations
Once instantiated, the same exec object is launched repeatedly, which is exactly where graphs earn their keep.
Quick Check
What does cudaStreamEndCapture produce?
Recap: Capturing Graphs
Wrap launches in stream capture to record a cudaGraph_t, instantiate it once, and capture infers the dependencies for you. Great progress! 🎉
الأسئلة الشائعة
هل درس «التقاط العمل في رسم بياني» مجاني؟
نعم — نص درس «التقاط العمل في رسم بياني» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة CUDA Academy، انتقل إلى CoddyKit PRO. تتضمن دورة CUDA Academy 4 دروس في المجموع.
ماذا ستتعلم في «التقاط العمل في رسم بياني»؟
تسجيل تدفق في رسم بياني لـ CUDA تتمرن على CUDA Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ CUDA Academy؟
لا تُشترط خبرة سابقة. CUDA Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «التقاط العمل في رسم بياني»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس CUDA Academy هذا؟
نعم. كل درس في CUDA Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- إطلاق النوى من نواة أخرى
- متى يكون التوازي الديناميكي مجديًا
- التقاط العمل في رسم بياني
- إعادة تشغيل الرسوم البيانية لتقليل العبء