-
Book Overview & Buying
-
Table Of Contents
GPU-Accelerated Computing with Python 3 and CUDA
By :
In this section, we will write and execute a CUDA kernel to calculate an image of the Julia set fractal from Chapter 1. CUDA kernels are at the heart of GPU programming. However, kernels behave very differently from synchronous programs, and writing them requires a perspective shift. To start, let's first go over the basics of the CUDA programming model.
GPUs speed up calculations through massive parallelism, where a large task is divided into smaller subtasks. These subtasks are distributed across hundreds or thousands of GPU cores and executed simultaneously.
In the CUDA programming model, the parallel execution of a task is organized using a grid and a CUDA kernel.
The grid represents the entire workload, logically divided into smaller units of execution. It consists of thousands of threads, where each thread acts as an independent worker responsible for a subtask. Logically, all threads can run concurrently. Grids...