返回课程
AI021 专业级

CUDA 编程指南

开发者学习CUDA编程模型以及如何编写在NVIDIA GPU上高效执行的代码的官方全面资源。本指南涵盖平台架构、编程接口、高级硬件功能和技术规格。

5.0
30.0h
1762 名学生
5 lessons
1 点赞
人工智能
开始学习

课程概述

📚 内容概要

官方、全面的开发者资源,用于学习 CUDA 编程模型以及如何编写在 NVIDIA GPU 上高效运行的代码。本指南涵盖平台架构、编程接口、高级硬件特性及技术规格。

掌握并行计算的艺术,使用行业标准的 NVIDIA CUDA 指南。

作者: NVIDIA 公司

致谢: 版权所有 © 2007–2024 NVIDIA 公司及其关联方。保留所有权利。

🎯 学习目标

  1. 定义异构系统中主机(CPU)和设备(GPU)的角色。
  2. 解释 SIMT 编程模型以及线程、块和网格的分层组织结构。
  3. 区分 PTX(并行线程执行)与二进制代码(cubins),并解释即时(JIT)编译如何实现兼容性。
  4. 开发与编译 CUDA 内核:编写 __global__ 函数,使用三重尖括号语法配置执行,并管理 NVCC 编译流程。
  5. 优化内存与数据传输:区分统一内存、显式内存和映射内存模型,并实现页面锁定的主机内存以实现高效传输。
  6. 管理并行执行:使用 CUDA 流、事件和协作组来管理异步任务,并同步 CPU-GPU 操作。
  7. 执行复杂的指针运算,并识别体系结构瓶颈(冯·诺依曼与哈佛架构对比)。
  8. 实现高级 CUDA 执行模式,包括程序化依赖内核启动和异构批处理内存传输。
  9. 利用硬件特定功能,如线程作用域、异步代理和流水线,以最大化并发性。
  10. 使用预取、使用提示和页大小管理等方法配置并调优统一内存性能。

课程

Lesson

This lesson introduces the fundamental shift from latency-optimized CPU architectures to throughput-oriented GPU computing. Students will learn to distinguish between these processing models and understand how the CUDA programming platform enables massive parallel execution for data-intensive tasks.

This lesson introduces the fundamentals of CUDA kernel development, focusing on the SIMT execution model and the use of the __global__ specifier to launch parallel functions on GPU Streaming Multiprocessors. Students will learn how to manage asynchronous kernel execution, handle device memory, and structure code to ensure effective hardware utilization.

This lesson explores the fundamental differences between von Neumann and Harvard architectures, focusing on how memory access pathways impact computational performance. Students will learn to identify the von Neumann bottleneck, understand the benefits of split-cache Harvard designs, and analyze how modern systems utilize a Modified Harvard Architecture to balance throughput with programming flexibility.

AI021: Optimization, Graphs, and Hardware Accelerators (Lesson 4) explores the shift from CPU-bottlenecked stream execution to GPU-autonomous workflows. Students will learn to utilize modern primitives like CUDA Graphs, lazy loading, and asynchronous memory prefetching to minimize host-side overhead and maximize hardware efficiency.

This lesson explores the technical reference and language extensions in CUDA, focusing on the relationship between virtual architectures (PTX) and real hardware (SASS). Students will learn to manage compute capabilities, utilize architecture-specific macros, and navigate language constraints to ensure code portability and performance.