Leanpub Header

Skip to main content

CUDA C++: High-Performance GPU Programming

CUDA C++: High-Performance GPU Programming
This book is 100% completeLast updated on 2026-09-20

CUDA C++: High-Performance GPU Programming

Master the GPU from the Streaming Multiprocessor to Production-Grade High-Performance Kernels

CUDA C++: High-Performance GPU Programming is an advanced technical guide to GPU programming, CUDA execution, memory systems, kernel optimization, low-level hardware control, and high-throughput AI workloads.

Minimum price

$29.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
512
Pages
About

About

About the Book

CUDA C++: High-Performance GPU Programming

Master the GPU from the Streaming Multiprocessor to Production-Grade High-Performance Kernels

CUDA C++: High-Performance GPU Programming is an advanced technical guide to GPU programming, CUDA execution, memory systems, kernel optimization, low-level hardware control, and high-throughput AI workloads.

Designed for engineers who want to move beyond basic CUDA programming, this 53-chapter reference progressively explores the NVIDIA GPU programming stack—from Streaming Multiprocessor architecture and SIMT execution to PTX/SASS analysis, Tensor Cores, asynchronous data movement, multi-GPU systems, NCCL, and production inference engines.

The book takes a hardware-aware approach to performance engineering. Rather than treating CUDA as a black box, it examines how threads execute, how warps communicate, how memory transactions are formed, how registers and caches affect performance, and how compiler and hardware behavior can be analyzed and optimized.

What You Will Learn

You will explore:

* Modern NVIDIA GPU architecture and Streaming Multiprocessors

* SIMT execution, warp mechanics, scheduling, and execution behavior

* The CUDA compilation pipeline from C++ to PTX and SASS

* Grid, block, and thread execution configuration

* Global memory coalescing and transaction alignment

* Shared memory architecture, bank conflicts, and access optimization

* Register allocation, spilling, and local memory behavior

* L1, L2, constant, texture, and read-only cache mechanisms

* CUDA memory fences, atomics, and memory consistency

* Warp-level primitives including shuffle, ballot, and match intrinsics

* Branchless kernel design and warp divergence mitigation

* Warp-level reductions, scans, and bit-manipulation techniques

* CUDA streams, events, hardware work queues, and Hyper-Q

* CUDA Graphs and launch-latency optimization

* Asynchronous memory-transfer pipelines

* Unified Memory and heterogeneous memory management

* Low-level CUDA virtual memory mechanisms

* Inline PTX assembly and hardware-level control

* SASS disassembly and instruction-level analysis

* Instruction-level parallelism, latency hiding, and register-pressure optimization

* Loop unrolling, arithmetic optimization, and fast-math techniques

* Tensor Core architecture and matrix computation

* WMMA and low-level `mma.sync` programming

* Sub-byte and micro-tile matrix operations

* Tensor Memory Accelerator programming on modern NVIDIA architectures

* FP8, BF16, TF32, and mixed-precision pipelines

* Roofline analysis and hardware bottleneck identification

* NVIDIA Nsight Compute and Nsight Systems profiling

* Automated kernel benchmarking and performance characterization

* High-performance GEMM, transpose, scan, sorting, SpMV, stencil, and FFT kernels

* Fused attention, FlashAttention, normalization, activation, and MoE kernels

* INT8, INT4, and FP4 quantized inference kernels

* Cooperative Groups and advanced synchronization

* CUDA Dynamic Parallelism

* Multi-GPU programming, NVLink, NVSwitch, and peer-to-peer transfers

* GPUDirect RDMA and high-performance interconnects

* NCCL-based collective communication

* CUDA debugging, memory sanitization, and race-condition detection

* Architecture of high-throughput production inference engines

* Emerging GPU architectures and the future evolution of CUDA

A Hardware-Aware Approach to CUDA

The central theme of this book is understanding why a CUDA kernel performs the way it does.

You will move from CUDA abstractions toward the underlying execution model, examining the interaction between warps, schedulers, registers, caches, shared memory, memory transactions, instruction pipelines, and specialized GPU execution units.

This perspective enables you to reason about performance instead of relying exclusively on trial and error.

From CUDA C++ to the Hardware

The book progressively connects high-level CUDA C++ with lower-level representations and hardware behavior.

You will examine the complete path from source code through compilation and optimization to PTX and SASS, learning how to investigate generated machine instructions and identify performance-critical behavior.

This makes the book particularly relevant for developers working on performance-sensitive GPU software, scientific computing, HPC, machine learning infrastructure, and custom AI kernels.

Building Real High-Performance Kernels

The later chapters move from individual mechanisms to complete algorithmic implementations.

You will study the architecture and optimization of kernels for:

* Dense matrix multiplication

* Matrix transposition

* Prefix sums and compaction

* Radix and bitonic sorting

* Sparse matrix-vector multiplication

* Stencil computation

* FFT

* Attention and FlashAttention

* Layer normalization and Softmax

* Fused activation pipelines

* Mixture-of-Experts routing

* Low-bit inference

The objective is not merely to implement these algorithms on the GPU, but to understand the architectural decisions required to make them high-throughput, memory-efficient, and performance-aware.

Who This Book Is For

This book is intended for:

* CUDA C++ developers

* GPU programmers

* HPC engineers

* AI/ML infrastructure engineers

* Performance engineers

* Systems programmers

* Compiler and low-level software engineers

* Researchers working with GPU acceleration

* Engineers developing custom AI inference kernels

* Developers who want a deeper understanding of NVIDIA GPU execution

A solid foundation in C++ and basic CUDA programming is recommended.

A Deep Dive into GPU Performance Engineering

CUDA C++: High-Performance GPU Programming is designed as a technical reference for engineers who want to understand the GPU beyond the API surface.

From warp-level communication and memory transactions to PTX/SASS, Tensor Cores, profiling, distributed GPU communication, and production inference, the book builds a continuous path toward increasingly sophisticated GPU software engineering.

The result is a practical and hardware-conscious framework for designing, analyzing, optimizing, and deploying high-performance CUDA software.

Author

About the Author

Krzysztof Rybiński

I am an independent technology developer and AI engineer focused on building advanced software systems across AI, cybersecurity, cloud engineering, systems programming, and automation.

My work combines practical engineering with research-oriented experimentation. I develop and publish projects involving agentic AI, autonomous defense systems, SIEM/EDR integration, secure software architecture, C/C++, Go, Python, CUDA, quantum computing, cryptography, and local AI infrastructure.

I also work on aerospace and high-assurance software concepts, including safety-critical architectures, multi-level security, cross-domain solutions, and advanced computational systems.

Alongside software development, I publish technical projects and long-form engineering titles covering AI, cybersecurity, cloud engineering, quantum computing, GPU programming, cryptography, automation, and aerospace engineering.

My current focus is on autonomous AI systems, local and privacy-oriented AI infrastructure, intelligent software agents, and the engineering of reliable systems capable of operating with a high degree of independence.

Open to opportunities involving AI engineering, cybersecurity, software engineering, autonomous systems, cloud infrastructure, and advanced technology development.

https://businessofmachines.blogspot.com/

https://learn.microsoft.com/en-us/users/machinadeusex/

https://g.dev/machinadeusex

https://github.com/porucznikswext-source

https://www.linkedin.com/in/krzysztof-r-93a37b287/

Contents

Table of Contents

CUDA C++: High-Performance GPU Programming Master the GPU from the Streaming Multiprocessor to Production-Grade High-Performance Kernels CUDA C++: High-Performance GPU Programming is an advanced technical guide to GPU programming, CUDA execution, memory systems, kernel optimization, low-level hardware control, and high-throughput AI workloads.

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

Also by the Author

Also by the Author

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub