Measuring Effective Bandwidth
Comparing achieved to peak throughput.
Measuring Effective Bandwidth is a free CUDA Academy lesson on CoddyKit — lesson 4 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.
From Theory to Numbers
Coalescing helps, but you should prove it. The metric that tells the truth is your kernel's effective bandwidth in gigabytes per second.
What Effective Means
Effective bandwidth counts the bytes your kernel actually needed, divided by the time it took. It reflects useful work, not wasted lines.
The Simple Formula
Add the bytes you read to the bytes you wrote, then divide by the elapsed seconds. That ratio is your achieved throughput.
double gbps = (bytesRead + bytesWritten) / seconds / 1e9;Time It with Events
Use CUDA events to bracket the kernel. They time GPU work precisely without the noise of CPU-side clocks.
cudaEventRecord(start);
myKernel<<<g, b>>>(...);
cudaEventRecord(stop);Read the Elapsed Time
After syncing on the stop event, ask CUDA for the gap. It returns milliseconds, so divide by a thousand before plugging into the formula.
float ms;
cudaEventElapsedTime(&ms, start, stop);Know Your Byte Count
For C = A + B over n floats, you read 2n and write n, so 3n floats move. Multiply by four to get bytes moved.
size_t bytes = 3 * n * sizeof(float);Find Your Peak
Every GPU lists a theoretical peak bandwidth. Your effective number only makes sense as a fraction of that ceiling.
The Efficiency Ratio
Divide effective by peak to get a percentage. Coalesced memory-bound kernels often reach 70 to 90 percent of peak; strided ones crash far lower.
Warm Up First
The first launch pays one-time setup costs. Run the kernel once to warm up, then average several timed runs for a stable number.
Let Profilers Confirm
Nsight Compute reports memory throughput directly, so you can check your math. It also flags wasted bytes from poor coalescing. 🔧
Use It to Decide
A low ratio means memory is your bottleneck, so chase coalescing and layout. A high ratio means look elsewhere for speed.
Quick Check
Compute an effective bandwidth.
Recap
You can now measure effective bandwidth with events, compare it to peak, and use the ratio to decide whether memory is your bottleneck. 🎉
Frequently asked questions
Is the “Measuring Effective Bandwidth” lesson free?
Yes — the full text of “Measuring Effective Bandwidth” 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 “Measuring Effective Bandwidth”?
Comparing achieved to peak throughput. 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 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Measuring Effective Bandwidth” 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
- What a Memory Transaction Is
- Coalesced vs Strided Reads
- Structure of Arrays vs Array of Structs
- Measuring Effective Bandwidth