Let's revisit the Mandelbrot set that we looked at in Chapter 1, Why GPU Programming?, and Chapter 3, Getting Started with PyCUDA. First, we will write a full-on CUDA kernel that will compute the Mandelbrot set, given a particular set of parameters, along with an appropriate host-side wrapper function that we may interface to from Ctypes later. We will first be writing these functions into a single CUDA-C .cu source file and then compile this into a DLL or .so binary with the NVCC compiler. Finally, we will write some Python code so that we can run our binary code and display the Mandelbrot set.
We will now apply our knowledge of Ctypes to launch a pre-compiled CUDA kernel from Python without any assistance ...