Prerequisites & Notation
Before You Begin
This chapter assumes you can write NumPy code fluently and understand basic linear algebra concepts. You do not need prior CUDA experience β CuPy's API mirrors NumPy almost exactly. A machine with an NVIDIA GPU is needed to run examples, but all concepts are explained CPU-side first so you can follow along regardless.
- NumPy array creation, slicing, broadcasting, and ufuncs (Chapter 5)(Review ch05)
Self-check: Can you create arrays, use fancy indexing, and apply broadcasting?
- Linear algebra: solve, eigh, SVD, sparse matrices (Chapter 6)(Review ch06)
Self-check: Do you know the difference between eig and eigh, and when to use sparse formats?
- FFT concepts and scipy.fft (Chapter 10)(Review ch10)
Self-check: Can you compute a 1-D FFT and interpret the frequency bins?
- Basic understanding of GPU vs CPU architecture
Self-check: Do you know that GPUs have many cores optimized for parallel arithmetic?
Notation for This Chapter
Symbols and conventions used in this chapter. We use cp for CuPy
arrays (device) and np for NumPy arrays (host) throughout.
| Symbol | Meaning | Introduced |
|---|---|---|
CuPy module alias (import cupy as cp) | s01 | |
| NumPy module alias (host-side arrays) | s01 | |
| Array residing in GPU (device) memory | s01 | |
| , | Host-to-device and device-to-host transfer times | s01 |
| Kronecker product of two matrices | s06 | |
| Vectorization operator β stacks columns into a vector | s06 | |
| Number of nonzero elements in a sparse matrix | s04 | |
| Discrete Fourier Transform operator | s03 |