Build a solid foundation in CUDA with Python, from kernel design to execution and debugging
Optimize GPU performance with efficient memory access, CUDA streams, and multi-GPU scaling
Use JAX, CuPy, RAPIDS, and Numba to accelerate numerical computing and machine learning
Create practical GPU applications, from PDE solvers to image processing and transformers
Description
Writing high-performance Python code doesn’t have to mean switching to C++. This book shows you how to accelerate Python applications using NVIDIA’s CUDA platform and a modern ecosystem of Python tools and libraries. Aimed at researchers, engineers, and data scientists, it offers a practical yet deep understanding of GPU programming and how to fully exploit modern GPU hardware.
You’ll begin with the fundamentals of CUDA programming in Python using Numba-CUDA, learning how GPUs work and how to write, execute, and debug custom GPU kernels. Building on this foundation, the book explores memory access optimization, asynchronous execution with CUDA streams, and multi-GPU scaling using Dask-CUDA. Performance analysis and tuning are emphasized throughout, using NVIDIA Nsight profilers.
You’ll also learn to use high-level GPU libraries such as JAX, CuPy, and RAPIDS to accelerate numerical Python workflows with minimal code changes. These techniques are applied to real-world examples, including PDE solvers, image processing, physical simulations, and transformer models.
Written by experienced GPU practitioners, this hands-on guide emphasizes reproducible workflows using Python 3.10+, CUDA 12.3+, and tools like the Pixi package manager. By the end, you’ll have future-ready skills for building scalable GPU applications in Python.
Who is this book for?
Python developers, (data) scientists, engineers, and researchers looking to accelerate numerical computations without switching to low-level languages. This book is ideal for those with experience in scientific Python (NumPy, Pandas, SciPy) and a basic understanding of computing fundamentals who want deeper control over performance in GPU environments.
What you will learn
Understand GPU execution, parallelism, and the CUDA programming model
Write, launch, and debug custom CUDA kernels in Python with CUDA
Profile GPU code with NVIDIA Nsight and optimize memory access
Use CUDA streams and async execution to overlap compute and transfers
Apply JAX, CuPy, and RAPIDS to numerical computing and machine learning
Scale GPU workloads across devices using Dask and multi-GPU strategies
Accelerate PDE solvers, simulations, and image processing on the GPU
Build, train, and run a transformer model from scratch on the GPU
Dr. Niels Cautaerts has 10 years of experience writing Python for scientific applications. Five years ago he became interested to leverage hardware acceleration in his code. Soon after, he began contributing CUDA kernels to open source projects in his field of research. He has since applied his expertise to build GPU accelerated code in various projects, including a low latency framework for object detection in continuous image streams. Niels maintains a small following on YouTube and Medium, where he shares educational content about tech. Currently Niels works as a research software developer and data scientist. He has also worked as a big-data engineer. Niels has a background in materials science and holds a Ph.D. in applied Physics.
Hossein Ghorbanfekr is a computational physicist with over a decade of expertise in scientific programming for material modeling, specializing in C/C++ and Python. During his Ph.D., he wrote various codes, utilizing parallel computing and GPU acceleration. Since 2020, he has been working as a data scientist, focusing on machine learning and high-performance computing in research projects. Hossein has contributed to the development of an object detection framework for waste stream analysis and created GEOBERTje, a domain-specific large language model in geology. His recent work includes Pantea, an open-source, GPU-accelerated machine learning framework for molecular simulations.
Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.
If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.
Please Note: Packt eBooks are non-returnable and non-refundable.
Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:
You may make copies of your eBook for your own use onto any machine
You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website?
If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:
Register on our website using your email address and the password.
Search for the title by name or ISBN using the search option.
Select the title you want to purchase.
Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title.
Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook?
If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
To view your account details or to download a new copy of the book go to www.packtpub.com/account
Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.
You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.
What are the benefits of eBooks?
You can get the information you need immediately
You can easily take them with you on a laptop
You can download them an unlimited number of times
You can print them out
They are copy-paste enabled
They are searchable
There is no password protection
They are lower price than print
They save resources and space
What is an eBook?
Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.
When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.
For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.