An Even Easier Introduction to CUDA (Updated)

AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.

Why it matters

Very little changes: this is a refresh of a 2017 CUDA programming tutorial, useful mainly to newcomers learning GPU programming, not a signal for practitioners.

Read this as

NVIDIA updated its beginner guide to CUDA, the system programmers use to run calculations on the company's graphics chips. It walks through turning a simple C++ program that adds two million-element arrays into one that runs on a GPU, called a kernel, using unified memory. On an NVIDIA T4 chip the tutorial's kernel drops from 75 milliseconds with one thread to about 47 microseconds after adding parallel threads and prefetching data. It targets C++ developers with an NVIDIA GPU or a cloud instance.

NVIDIA refreshed its 'Even Easier Introduction to CUDA' tutorial, originally published January 2017, updating code and profiling steps for current hardware. It shows engineers how to get large speedups: a T4 GPU running the tutorial's array-addition kernel at 75 ms single-threaded reaches roughly 47 microseconds when parallelized across thread blocks and data is prefetched to the GPU. Anyone weighing GPU programming or onboarding developers can use it as free training material, but it announces no products, pricing or timelines.

Updated NVIDIA tutorial teaching CUDA C++ basics: marking functions __global__, allocating with cudaMallocManaged(), launching via <<<>>> configuration, and grid-stride loops using blockIdx.x * blockDim.x + threadIdx.x. Profiling with Nsight Systems shows the add kernel at 75 ms on one thread, 4.2 ms with one 256-thread block, and ~47 microseconds after cudaMemPrefetchAsync() eliminates on-demand page migration, hitting 265 GB/s, over 80% of the T4's 320 GB/s peak. Limitations noted: Unified Memory page faults stall threads, and memory rather than compute is the bottleneck.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

CUDA NVIDIA T4 NVIDIA Nsight Systems AWS Azure Google Colab

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading