Online course · Development

CUDA C++ Programming: From GPU Basics to Optimised Kernels

Write, verify and profile fast CUDA C++ kernels, from first launch to tuned pipelines

Created by TrainSkool Trainer

CUDA C++ Programming: From GPU Basics to Optimised Kernels course cover

Coming soon Launch price ₹2,499

This course is not open for enrolment yet.

About this course

For developers who know C or C++ and want real workloads to run fast on NVIDIA GPUs. You follow one running example: a sample analytics pipeline moving transaction analytics, rainfall grids, drone images and pump-vibration signals from CPUs to GPUs (all data synthetic). You will write and launch kernels, master thread and grid indexing, use shared, constant, pinned and unified memory, fix coalescing, bank-conflict and occupancy problems, profile with Nsight tools, build reductions, scans, histograms, stencils and tiled matrix multiply, overlap work with streams and CUDA Graphs, split work across GPUs, and use Thrust, CUB, cuBLAS and cuFFT. Current to CUDA Toolkit 13.5 at the time of writing; code also builds with CUDA 12.x. The capstone is gpupipe, a verified image and signal pipeline with a profiling report and a speed-up table you measure on your own GPU. Kernels need an NVIDIA GPU or a free notebook GPU; auto-checked exercises run in the browser without one. Prerequisite: C & C++ Programming Fundamentals or equivalent. Included: 30 text lessons with slides and quick checks, 28 auto-checked C++ exercises, 7 chapter projects, chapter quizzes, a rubric-graded capstone, a 20-question final exam and a certificate of completion. Lessons are text and slides; trainer videos are coming later. Not affiliated with or endorsed by NVIDIA. CUDA is a trademark of NVIDIA Corporation. Google Colab is a trademark of Google LLC; not affiliated with or endorsed by Google. What you will be able to do: - You will be able to set up a CUDA toolkit or a notebook GPU, choose the right -arch for your hardware, and write, launch and error-check kernels. - You will be able to map threads, blocks and grids onto 1D, 2D and 3D data, with bounds checks, grid-stride loops and pitched memory. - You will be able to place data in the right memory space: registers, shared tiles with halos, constant memory, pinned and unified memory. - You will be able to diagnose and fix coalescing, bank-conflict, occupancy and divergence problems using effective bandwidth and the roofline model. - You will be able to implement and verify reductions, scans, histograms, stencils and tiled matrix multiplication, including warp shuffles and cooperative groups. - You will be able to overlap copies and compute with streams and events, cut launch overhead with CUDA Graphs, and split work across several GPUs. - You will be able to use Thrust, CUB, cuBLAS and cuFFT correctly, including column-major GEMM and batched FFTs, and decide when a library beats your own kernel. - You will be able to profile with Nsight Systems and Nsight Compute and report speed-ups measured honestly on your own GPU.

What you'll learn

  • Set up a CUDA toolkit or a notebook GPU, choose the right -arch for your hardware, and write, launch and error-check kernels
  • Map threads, blocks and grids onto 1D, 2D and 3D data, with bounds checks, grid-stride loops and pitched memory
  • Place data in the right memory space: registers, shared tiles with halos, constant memory, pinned and unified memory
  • Diagnose and fix coalescing, bank-conflict, occupancy and divergence problems using effective bandwidth and the roofline model
  • Profile with Nsight Systems and Nsight Compute and report speed-ups measured honestly on your own GPU
  • Implement and verify reductions, scans, histograms, stencils and tiled matrix multiplication, including warp shuffles and cooperative groups
  • Overlap copies and compute with streams and events, cut launch overhead with CUDA Graphs, and split work across several GPUs
  • Use Thrust, CUB, cuBLAS and cuFFT correctly, including column-major GEMM and batched FFTs, and decide when a library beats your own kernel

Course content

Chapter 1 · Module 1: GPU Foundations — The CUDA Model, Setup and Your First Kernel

  • Video: Why GPUs: One Job, Two Ways — When a GPU Really HelpsLet's start with one simple job. You have a greyscale image, and you want to make it brighter.15 topics · 30 min
  • Code lab: The CUDA Platform at the Time of Writing: Toolkit 13.5, Compute Capability and the nvcc Compilation FlowSay you have three GPUs within reach: an older desktop with a GTX 1060, a laptop with an RTX 3050, and a Colab T4.14 topics · 34 min
  • Code lab: Setting Up: Local Install on Windows and Linux, Cloud and Notebook GPUs, and Checking Your GPUEvery lesson from here on asks you to compile and run real kernels. So you need a working CUDA setup: a GPU, a driver, the toolkit, and a host C++ compiler that the toolkit accepts.15 topics · 36 min
  • Code lab: Your First Kernel: __global__, the Launch Syntax, Device Memory and Error CheckingYour setup works.16 topics · 36 min

Chapter 2 · Module 2: Threads, Blocks and Grids — Indexing and Launch Configuration

  • Code lab: The Thread Hierarchy: threadIdx, blockIdx, blockDim, gridDim and the Global Indexx. Get it wrong and some elements are touched twice, others never, with no error (you'll run that below).14 topics · 32 min
  • Code lab: Bounds Checks, Ceiling Division and Grid-Stride LoopsReal batches never come in neat sizes. Today you have 16,777,216 amounts, tomorrow 16,777,219, a test file has 7, and a holiday file has none.14 topics · 32 min
  • Code lab: 2D and 3D Grids: Indexing Images, Matrices and the Rainfall GridSome data isn't a list. Our sample rainfall grid has 129 rows and 135 columns, with 30 days stacked behind it, and an image frame is rows of pixels.14 topics · 36 min
  • Code lab: Warps, SIMT and the Hardware: How Blocks Are Scheduled onto SMsHere's one job done two ways. cu scores 1,048,576 generated exam marks, half of them passes, with the same work for every mark.16 topics · 34 min

Chapter 3 · Module 3: The CUDA Memory Hierarchy

  • Code lab: Global Memory, Registers and Local MemoryChapter 2 made every thread find its own data. This chapter is about where that data lives, because on a GPU the place decides the speed.15 topics · 32 min
  • Code lab: Shared Memory and __syncthreads: Your First Tiled KernelHere is one job done two ways. You have 16,777,216 temperature readings and you want each one smoothed: every output is the average of a reading and the 4 on each side.14 topics · 36 min
  • Code lab: Constant Memory and the Read-Only PathHere's one table and one job. A table of 64 coefficients (256 bytes) sits in your GPU's memory, and each of 1,048,576 threads reads it 256 times.14 topics · 32 min
  • Code lab: Host Memory and Transfers: Pinned Memory, Unified Memory, Prefetching and Asynchronous CopiesHere's one job done two ways. One batch of 16,777,216 amounts, 64 MiB, goes to the GPU with the same cudaMemcpy call: once from ordinary host memory and once from pinned memory.16 topics · 36 min

Chapter 4 · Module 4: Performance — Coalescing, Bank Conflicts, Occupancy and Profiling

  • Code lab: Memory Coalescing and Effective Bandwidth5 percent). Store each transaction as a 16-byte struct, or keep the amounts in a plain array: the arithmetic is identical.14 topics · 34 min
  • Code lab: Shared-Memory Banks, Bank Conflicts and PaddingHere's one job and four ways to do it. You have a 4096 x 4096 matrix of floats, 64 MiB, and you want it turned the other way round: row r, column c goes to row c, column r.14 topics · 32 min
  • Code lab: Occupancy, Registers and Warp Divergence1 showed that registers are a budget per SM. An SM has three more budgets, and a kernel is held back by whichever runs out first.15 topics · 34 min
  • Code lab: Profiling with Nsight Systems and Nsight Compute: Timelines, Roofline and a Tuning LoopYou time a kernel, change one line, and the number goes down. Keep it?20 topics · 38 min

Chapter 5 · Module 5: Parallel Patterns — Reduction, Scan, Histogram, Stencil and Tiled Matrix Multiply

  • Code lab: Parallel Reduction: From Atomics to Shared-Memory Trees and Warp ShufflesEvery kernel so far gave each thread its own output. A reduction is different: many inputs, one answer.15 topics · 36 min
  • Code lab: Prefix Sum (Scan) and Stream CompactionHere is one job and two ways to do it. You have 16,777,216 transaction amounts in paise and you want the large ones, copied into a small array, in their original order.13 topics · 36 min
  • Code lab: Histograms with Atomics and Stencils with HalosTwo patterns turn up in almost every GPU code base, and each hides a trap.13 topics · 34 min
  • Code lab: Tiled Matrix Multiplication and Cooperative GroupsYou have a table of marks, one row per student and one column per test, and a table of weights, one column per grading scheme.15 topics · 38 min

Chapter 6 · Module 6: Concurrency — Streams, Events, CUDA Graphs and Multiple GPUs

  • Code lab: Streams and Events: Overlapping Copies with Compute and Timing CorrectlyYou have 16,777,216 prices in memory and one job: re-price every one of them on the GPU.13 topics · 36 min
  • Code lab: CUDA Graphs: Capturing and Replaying WorkHere's a job made of many tiny kernels. A grid of rainfall readings holds millimetres per cell.14 topics · 32 min
  • Code lab: Multi-GPU Basics: Device Selection, Peer Access and Splitting WorkOne day you may sit at a machine with several GPUs, or rent one. Code written for one GPU will happily use only the first and leave the rest idle.15 topics · 34 min

Chapter 7 · Module 7: CUDA Libraries — Thrust, CUB, cuBLAS and cuFFT

  • Code lab: Thrust: STL-Style Parallel Algorithms on the GPUYou know std::sort and std::reduce.16 topics · 32 min
  • Code lab: CUB: Block-Level and Device-Wide PrimitivesYou have 16,777,216 water-meter readings to add up and 4,194,304 exam marks to put in order.15 topics · 34 min
  • Code lab: cuBLAS: Matrix Multiply, Column-Major Layout and HandlesMatrix multiplication turns up everywhere: a table of marks times a table of weights, a grid of pixels times a filter, one layer of numbers times the next.14 topics · 34 min
  • Code lab: cuFFT: Fast Fourier Transforms for Signal ProcessingA sensor gives you thousands of numbers a second. How strong the signal is, is one question.19 topics · 34 min

Chapter 8 · Module 8: Capstone — Build, Verify and Profile an Image and Signal Pipeline

  • Reading: Capstone Brief: Requirements, Design and Step-by-Step Build Plan for gpupipeYou are going to build one CUDA C++ command-line program, gpupipe, that runs two pipelines on a GPU: one for images and one for signals.10 topics · 45 min
  • Code lab: Building, Verifying and Profiling gpupipeA GPU program that is fast but sometimes wrong is worse than a slow one, because nobody notices until the numbers are used.15 topics · 50 min
  • Assignment: Capstone Deliverables, Profiling Report, Speed-Up Table and Grading RubricYou submit one repository, or a zip of it, with five items. Together they show that your gpupipe program builds, that it is correct, where its time goes, and what its speed-up really is.13 topics · 45 min

Assessments and certificate

  • Module 1 quiz: GPU Foundations — The CUDA Model, Setup and Your First Kernel8 questions · 15 min · pass mark 70%
  • Module 2 quiz: Threads, Blocks and Grids — Indexing and Launch Configuration8 questions · 15 min · pass mark 70%
  • Module 3 quiz: The CUDA Memory Hierarchy8 questions · 15 min · pass mark 70%
  • Module 4 quiz: Performance — Coalescing, Bank Conflicts, Occupancy and Profiling7 questions · 15 min · pass mark 70%
  • Module 5 quiz: Parallel Patterns — Reduction, Scan, Histogram, Stencil and Tiled Matrix Multiply8 questions · 15 min · pass mark 70%
  • Module 6 quiz: Concurrency — Streams, Events, CUDA Graphs and Multiple GPUs8 questions · 15 min · pass mark 70%
  • Module 7 quiz: CUDA Libraries — Thrust, CUB, cuBLAS and cuFFT8 questions · 15 min · pass mark 70%
  • Module 8 quiz: Capstone - Build and Verify gpupipe7 questions · 15 min · pass mark 70%
  • CUDA C++ Programming: From GPU Basics to Optimised Kernels — final assessment20 questions · 40 min · pass mark 70%

Related courses

Frequently asked questions

Can I get a refund for CUDA C++ Programming: From GPU Basics to Optimised Kernels?

Yes. You can request a full refund within 7 days of purchase, provided you have completed no more than 25% of the lessons, not started the final exam and not been issued a certificate. Pre-orders of a course that has not launched yet can be refunded in full any time before launch. Email refunds@trainskool.com with your order reference; approved refunds go back to your original payment method.

How long do I have access to the course?

Lifetime access. A one-time payment of ₹2,499 keeps the course in your TrainSkool learning dashboard, on the web and in the TrainSkool apps, with no subscription to cancel.

Do I get a certificate?

Yes. TrainSkool issues a certificate when you meet the course requirements, including passing its 9 graded assessments. Every certificate has a public verification link that employers can check.

Are there any prerequisites?

No other course is required. The course level is intermediate, so check the curriculum to confirm it matches your experience.

How is the course delivered?

Online and self-paced: 8 modules and 30 lessons, about 17h 44m of study, including 1 video lesson, with graded assessments. Learn in your browser or the TrainSkool Android and Windows apps.