1
Why GPU Programming with CUDA in Python 3?
What do blockchain and artificial intelligence (AI) have in common?
At a surface level, both technologies have, in recent years, garnered a lot of media attention and investment and formed the basis for many start-ups. But beneath these applications lies a common technological foundation: general-purpose computing on graphics processing units (GPGPUs) to accelerate massively parallel computations. While the long-term impact of AI and blockchain is yet to be felt, GPGPU has already demonstrated its immense value across a multitude of fields and application areas, despite receiving significantly less public attention.
GPU programming is traditionally taught through low-level programming languages such as C or C++. This book takes a different approach and teaches GPGPU through various libraries available in Python 3. This makes the subject more accessible to our target audience: data scientists and researchers who primarily use Python and seek to accelerate computationally intensive code. This book focuses entirely on the CUDA platform, which is the most popular GPU programming framework that runs exclusively on NVIDIA hardware.
In this chapter, we will learn what GPGPU and CUDA are and how to recognize scenarios that benefit from GPGPU. We will also learn how to estimate and measure the benefits of accelerating our computations using GPGPU. We will also review the limitations of GPGPU, because unfortunately, it is not a magic bullet that can speed up any computation:
- Understand the benefits, application areas, and limitations of GPU computing
- Calculate the theoretical compute capacity of devices
- Identify which types of problems benefit from massive parallelization, and estimate performance gains with Amdahl's law
- Recognize additional factors, such as data transfers, that influence computing performance
- Use
cProfileand Scalene to discover bottlenecks in Python code
Your purchase includes a free PDF copy + exclusive extras
Your purchase includes a DRM-free PDF copy of this book, 7-day trial to the Packt+ library (no credit card required), and additional exclusive extras. See the Free benefits with your book section in the Preface to unlock them instantly and maximize your learning.