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...
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 architecture, kernel optimization, low-level hardware analysis, and high-throughput AI workloads.
Designed for engineers who want to move beyond basic CUDA programming, this 53-chapter technical reference explores the NVIDIA GPU programming stack in depth, progressing 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, and how registers, caches, compiler decisions, and hardware scheduling influence performance. The emphasis is on understanding the mechanisms behind kernel behavior and using that knowledge to make informed optimization decisions.
Minimum price
$29.00
$29.00
About the Book
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 architecture, kernel optimization, low-level hardware analysis, and high-throughput AI workloads.
Designed for engineers who want to move beyond basic CUDA programming, this 53-chapter technical reference explores the NVIDIA GPU programming stack in depth, progressing 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, and how registers, caches, compiler decisions, and hardware scheduling influence performance. The emphasis is on understanding the mechanisms behind kernel behavior and using that knowledge to make informed optimization decisions.
Explore modern NVIDIA GPU architecture, Streaming Multiprocessors, SIMT execution, warp scheduling, and the mechanics of thread, block, and grid execution. Understand the CUDA compilation pipeline from C++ through PTX to SASS, and learn how to investigate generated machine instructions to identify performance-critical behavior.
Develop a detailed understanding of GPU memory systems, including global memory coalescing, transaction alignment, shared memory bank conflicts, register allocation, register spilling, and local memory behavior. Examine L1 and L2 caches, constant and texture memory, read-only cache mechanisms, memory fences, atomic operations, and memory consistency. Learn how warp-level primitives such as shuffle, ballot, and match intrinsics enable efficient communication, reductions, scans, and bit-manipulation operations while minimizing unnecessary synchronization and warp divergence.
Move beyond basic kernel launches to explore CUDA streams, events, hardware work queues, Hyper-Q, CUDA Graphs, asynchronous memory-transfer pipelines, Unified Memory, and CUDA virtual memory mechanisms. Investigate inline PTX assembly, SASS disassembly, instruction-level parallelism, latency hiding, register pressure, loop unrolling, arithmetic transformations, and fast-math techniques.
Examine specialized GPU execution capabilities, including Tensor Core architecture, WMMA, low-level mma.sync programming, sub-byte matrix operations, and Tensor Memory Accelerator programming on supported NVIDIA architectures. Understand mixed-precision computation with FP8, BF16, TF32, and other numerical formats, together with the architectural considerations involved in designing efficient matrix and inference workloads.
Develop practical performance-analysis skills using roofline models, NVIDIA Nsight Compute, and Nsight Systems. Learn how to build automated benchmarking workflows, characterize kernel performance, identify hardware bottlenecks, and distinguish between compute-bound, memory-bound, and launch-overhead-limited workloads.
The book also examines complete GPU algorithm implementations, including high-performance GEMM, matrix transposition, prefix sums, compaction, radix and bitonic sorting, sparse matrix-vector multiplication, stencil computation, and FFT. Advanced AI workloads extend this foundation into fused attention, FlashAttention, normalization, Softmax, activation pipelines, Mixture-of-Experts routing, and low-bit inference kernels using INT8, INT4, and FP4 representations.
Finally, explore advanced synchronization with Cooperative Groups, CUDA Dynamic Parallelism, multi-GPU programming, NVLink, NVSwitch, peer-to-peer transfers, GPUDirect RDMA, and NCCL collective communication. The discussion extends to CUDA debugging, memory sanitization, race-condition detection, production inference engine architecture, and emerging GPU technologies.
The central theme of this book is understanding why a CUDA kernel performs the way it does.
GPU performance depends on the interaction of many architectural mechanisms. Warp scheduling, instruction throughput, register allocation, cache behavior, shared memory, memory transaction patterns, execution pipelines, and synchronization overhead can all influence the final result. Optimizing one component in isolation does not necessarily improve the complete workload.
This book develops a systematic approach to reasoning about these interactions. By connecting CUDA programming abstractions to the hardware mechanisms beneath them, it helps readers identify the causes of performance limitations and evaluate potential optimizations using measurable evidence rather than relying exclusively on trial and error.
The result is a deeper understanding of how kernel design, resource utilization, and execution behavior combine to determine performance across different workloads and GPU architectures.
High-level CUDA C++ provides a productive programming model, but performance-critical development often requires investigating what the compiler generates and how the GPU executes it.
The book follows the path from CUDA source code through compilation, intermediate representations, instruction selection, and machine-level execution. It examines PTX and SASS analysis as practical tools for understanding instruction sequences, register usage, memory operations, and compiler optimization decisions.
This perspective is particularly valuable when working with specialized kernels, inline assembly, latency-sensitive workloads, and performance problems that cannot be explained by source code alone. It also provides a foundation for understanding the relationship between compiler behavior, hardware capabilities, and architecture-specific optimization.
The transition from individual architectural mechanisms to complete algorithms is a central part of the book. Through the study of matrix multiplication, transposition, prefix sums, sorting, sparse computation, stencil operations, and FFT, readers explore how algorithmic structure interacts with GPU execution and memory hierarchy.
The discussion then extends into modern AI workloads, where performance often depends on combining multiple operations into fused kernels, reducing intermediate memory traffic, improving data reuse, and selecting appropriate numerical representations. Attention mechanisms, FlashAttention, normalization, Softmax, activation pipelines, Mixture-of-Experts routing, and quantized inference provide examples of the engineering challenges involved in building specialized GPU software.
The objective is not merely to implement algorithms on the GPU, but to understand the architectural and algorithmic decisions that make them efficient, scalable, and measurable under realistic workloads.
Reliable optimization begins with reliable measurement. Kernel execution time alone does not explain why a workload is slow, and isolated benchmark results can be misleading when launch overhead, warm-up effects, memory allocation, synchronization, or measurement methodology are not controlled.
This book examines performance characterization through NVIDIA Nsight Compute, Nsight Systems, roofline analysis, and automated benchmarking. It connects profiler observations to architectural explanations, helping readers distinguish genuine improvements from changes that merely shift the bottleneck elsewhere.
The emphasis is on repeatable experiments, evidence-based optimization, and an understanding of the trade-offs between occupancy, instruction throughput, memory efficiency, and resource consumption.
Modern GPU workloads increasingly extend beyond a single device. Multi-GPU programming introduces additional considerations involving communication overhead, synchronization, memory ownership, interconnect bandwidth, and workload partitioning.
The book explores GPU-to-GPU communication through NVLink, NVSwitch, peer-to-peer transfers, GPUDirect RDMA, and NCCL collectives. These mechanisms are considered in the context of distributed computation and high-throughput AI workloads, where communication efficiency can be as important as individual kernel performance.
Production inference introduces another layer of engineering challenges, including memory management, execution scheduling, quantized computation, kernel fusion, concurrency, and end-to-end throughput. By examining these concerns alongside low-level CUDA optimization, the book connects kernel engineering with the architecture of larger GPU software systems.
This book is intended for CUDA C++ developers, GPU programmers, high-performance computing engineers, AI and machine learning infrastructure engineers, performance engineers, systems programmers, compiler specialists, and researchers working with GPU acceleration. It is also relevant to developers building custom AI inference kernels or seeking a deeper understanding of NVIDIA GPU execution beyond the CUDA API.
A solid foundation in C++ and basic CUDA programming is recommended. Familiarity with computer architecture, parallel algorithms, and numerical computing will help readers engage with the more advanced topics.
Understanding CUDA syntax is only the beginning of high-performance GPU programming. Developing efficient GPU software requires an understanding of execution scheduling, memory behavior, compiler transformations, specialized hardware units, synchronization, and the relationship between algorithms and architectural constraints.
CUDA C++: High-Performance GPU Programming brings these subjects together in a continuous technical progression, connecting low-level hardware analysis with practical kernel development, systematic profiling, advanced AI workloads, and multi-GPU infrastructure.
Rather than focusing exclusively on API usage or isolated optimization tricks, the book emphasizes the reasoning and engineering methods required to analyze GPU behavior, diagnose bottlenecks, and develop performance-conscious implementations.
About the Author
I am an independent technology developer and systems engineer who built my technical path largely through self-directed engineering, experimentation, and continuous learning outside a traditional academic or corporate technology career.
My professional background began far from the technology industry. I spent years working in manufacturing, while independently developing my knowledge of software engineering, computer systems, and advanced computing. Over time, that self-directed work evolved into a broad technical practice spanning autonomous AI, cybersecurity, systems programming, GPU computing, automation, and advanced computational architectures.
Today, I design, build, and publish projects involving agentic AI, autonomous defense systems, SIEM/EDR integration, secure software architecture, C/C++, Go, Python, CUDA, quantum computing, cryptography, and privacy-oriented local AI infrastructure.
I approach technology from a systems perspective — from low-level software, memory architecture, and GPU performance to distributed systems, intelligent agents, and high-assurance security architectures.
I also explore aerospace and high-assurance software concepts, including safety-critical architectures, multi-level security, cross-domain solutions, and advanced computational systems.
Alongside active development, I publish long-form engineering projects covering AI, cybersecurity, cloud engineering, quantum computing, GPU programming, cryptography, automation, blockchain, and aerospace engineering.
My current focus is on autonomous software agents, privacy-first local infrastructure, advanced computing, and reliable systems designed to operate with a high degree of independence.
I am open to opportunities involving AI engineering, cybersecurity, software engineering, autonomous systems, HPC/GPU computing, and advanced technology development.
https://businessofmachines.blogspot.com/
https://learn.microsoft.com/en-us/users/machinadeusex/
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
Also by the Author
Engineering Sovereign LLMs: From Data to Deployment
Agentic Cybersecurity: Engineering Autonomous AI Defense
Mastering NVIDIA CUDA: Expert GPU Programming
Mastering LLM Quantization: Architecture and Code
Linux GPU Drivers from Scratch
Blockchain Security: Attack and Defense
The Local AI Stack: Building a Sovereign Machine Learning Workstation with Hyper-V, WSL2, and GPU Virtualization
The Solana MEV Playbook: Building High-Frequency Arbitrage and MEV Bots in Rust
Mastering ELF: From Bytes to Execution
Building a Native LLM Inference Engine
Modern Browser Fingerprinting: Techniques and Code
Mastering AI Agents: Hands-On Production Code
Coding CERN: A Technical Developer's Guide
High-Performance Real-Time Systems in .NET
Building Advanced Algorithmic Crypto Trading Systems
Smart Contract Security: Finding DeFi Vulnerabilities
Advanced Aerospace Engineering: Lockheed & Partners
Mastering AWS: Advanced Python Engineering
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
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.)
Learn more about writing on Leanpub
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
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.