The CUDA backend runs the field updates on an NVIDIA GPU. It keeps the field arrays and update coefficients in device memory, uploads source samples, and records probes on the device. The simulation can therefore advance many steps without copying the full grid back to the CPU.
The four variants build on one another. v1 launches separate magnetic and electric update kernels. v2 adds CUDA graphs to reduce submission overhead. v3 reuses coefficient tuples through a table, while v4 combines the field updates with tiling. The default is v4 with a 32 by 8 thread block.
Select the backend and variant through the simulation options:
fdtd::TMz::Simulation::Options options; options.backend = fdtd::TMz::BackendType::Cuda; options.variant = "v4:16x16"; fdtd::TMz::Simulation sim(512, 512, options);
The numerical setup stays the same when switching from the serial or OpenMP backend. Host-visible results require a transfer: probe records are collected after an advance, while snapshots download the fields at selected steps.