0Pricing
CUDA Academy · Lesson

Global Memory Tradeoffs

Large, slow, and visible to every thread.

Global Memory Tradeoffs is a free CUDA Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CUDA Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The Biggest Space You Have

Global memory is the GPU's main DRAM, often many gigabytes. It is where your big input and output arrays naturally live during a kernel.

Visible to Everyone

Every thread in every block can read and write global memory. That shared visibility is exactly why you copy your data there before launching. 🌍

You Allocate It with cudaMalloc

You reserve global memory from the host with cudaMalloc, which hands you a device pointer to that DRAM region.

float *d_a;
cudaMalloc(&d_a, n * sizeof(float));

Large but Slow

The catch is latency. A single global memory read can cost hundreds of clock cycles, far more than a register access ever would.

Bandwidth Is the Real Limit

Many kernels are bound not by math but by how fast bytes flow from DRAM. We call these memory-bound kernels.

Hiding Latency with Threads

The GPU hides slow reads by switching to other ready warps while one waits. This latency hiding is why having many threads matters so much.

It Persists Across Launches

Data in global memory stays put between kernel launches until you free it. You can run several kernels over the same buffers.

Cached by L2

A unified L2 cache sits in front of global memory for the whole GPU. Reused addresses can be served from it instead of slow DRAM.

Access Pattern Decides Speed

How threads map to addresses hugely affects throughput. Neighboring threads touching neighboring addresses is what later lessons call coalescing.

Minimize the Trips

The core strategy is simple: touch global memory as few times as possible. Read once, reuse on-chip, then write once.

Free What You Allocate

Because global memory is a finite resource, release it with cudaFree when you are done to avoid leaking device memory.

cudaFree(d_a);

Quick Check

Which statement best captures the tradeoff of global memory?

Recap: Big, Shared, Slow

You now know global memory is the GPU's large, all-visible DRAM that trades capacity for high latency. Touch it rarely and reuse data on-chip. 🚀

Frequently asked questions

Is the “Global Memory Tradeoffs” lesson free?

Yes — the full text of “Global Memory Tradeoffs” is free to read here on the web, and the CUDA Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CUDA Academy course, upgrade to CoddyKit PRO.

What will I learn in “Global Memory Tradeoffs”?

Large, slow, and visible to every thread. You practise CUDA Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start CUDA Academy?

No prior experience is required. CUDA Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Global Memory Tradeoffs” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this CUDA Academy lesson?

Yes. Every CUDA Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Registers and Local Memory
  2. Global Memory Tradeoffs
  3. Constant Memory and Its Cache
  4. A Mental Model of the Hierarchy
← Back to CUDA Academy