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.

SymbolMeaningIntroduced
β€˜cpβ€˜`cp`CuPy module alias (import cupy as cp)s01
β€˜npβ€˜`np`NumPy module alias (host-side arrays)s01
Adev\mathbf{A}_{\mathrm{dev}}Array residing in GPU (device) memorys01
TH2DT_{\mathrm{H2D}}, TD2HT_{\mathrm{D2H}}Host-to-device and device-to-host transfer timess01
βŠ—\otimesKronecker product of two matricess06
vec(X)\mathrm{vec}(\mathbf{X})Vectorization operator β€” stacks columns into a vectors06
nnznnzNumber of nonzero elements in a sparse matrixs04
F\mathcal{F}Discrete Fourier Transform operators03