FDE and EME on the GPU
psmeme's CUDA mode solver and EME against its own CPU backend on an RTX 4090 - same modes to 1e-13, 13x to 41x faster.
psmeme is the PhotonStack full-vector finite-difference eigenmode (FDE) solver and eigenmode-expansion (EME) solver. This page benchmarks its CUDA backend against its CPU backend on a silicon strip waveguide, refined from 0.06 to 2.2 million unknowns, with and without PML, plus a 16-section EME taper. Two things are checked: that the GPU returns the same modes as the CPU (effective index difference and mode overlap), and how much faster it is.
Setup
Mode-solver geometry. Silicon strip waveguide, 500 × 220 nm, n = 3.48, in silica n = 1.444, in a 4 × 3 µm window, at a wavelength of 1.55 µm. The grid is uniform and refined from 200 × 150 to 1200 × 900 cells. 10 modes are requested.
Two variants.
strip: no PML, real arithmetic.strip + PML: PML enabled withnum_pml = 12on both transverse axes, complex arithmetic.
Solvers. Both backends run the same shift-invert Krylov-Schur algorithm in FP64. The CPU backend uses a supernodal sparse LU; the CUDA backend performs a multifrontal factorization on the GPU and keeps the Krylov basis in device memory. Every case is solved on the GPU twice: cold (fresh multifrontal plan and device upload) and warm (structure reused from the previous solve, as happens for successive cross sections of an EME device; warm time from 3 repeats).
EME case. A linear taper of 16 cross sections on a 400 × 300 grid, strip width from 400 nm to 1.2 µm, each section 1 µm long, 12 modes per cross section. The CPU backend solves the cross sections concurrently (one per thread, 16 threads); the CUDA backend solves them one after the other on the GPU.
Hardware. NVIDIA GeForce RTX 4090 (24.0 GiB, sm_89); CPU side of the same machine with 32 threads available. Run dated 2026-09-29. One-off CUDA initialization (context, cuBLAS/cuSOLVER load, first solve) took 0.215 s and is not included in the per-case times.
Results
All times are wall-clock seconds on the RTX 4090 machine. "eig" is the eigensolve phase alone.
| Case | Grid | Unknowns | CPU total (s) | CUDA cold (s) | CUDA warm (s) | Speedup cold / warm | CPU eig (s) | CUDA eig (s) | eig speedup | max |Δneff| | min overlap | GPU mem (MiB) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| strip | 200×150 | 59650 | 2.97 | 0.231 | 0.201 | 12.9× / 14.8× | 2.75 | 0.113 | 24× | 4.3e-14 | 1.0000000000 | 129 |
| strip | 400×300 | 239300 | 13.8 | 0.702 | 0.607 | 19.6× / 22.7× | 12.6 | 0.281 | 45× | 2.5e-14 | 1.0000000000 | 574 |
| strip | 600×450 | 538950 | 32.8 | 1.76 | 1.37 | 18.6× / 24.0× | 29.5 | 0.608 | 48× | 3.7e-14 | 1.0000000000 | 1414 |
| strip | 800×600 | 958600 | 62.9 | 3.00 | 2.46 | 21.0× / 25.6× | 56.6 | 1.06 | 53× | 1.1e-13 | 1.0000000000 | 2519 |
| strip | 1000×750 | 1498250 | 104.1 | 4.49 | 3.88 | 23.2× / 26.8× | 93.0 | 1.65 | 56× | 1.7e-13 | 1.0000000000 | 4529 |
| strip | 1200×900 | 2157900 | – | 6.56 | 5.91 | – | – | 2.45 | – | – | – | 6176 |
| strip + PML | 200×150 | 59650 | 22.9 | 0.761 | 0.712 | 30.0× / 32.1× | 22.5 | 0.599 | 38× | 3.0e-13 | 1.0000000000 | 242 |
| strip + PML | 400×300 | 239300 | 275.7 | 7.05 | 6.76 | 39.1× / 40.8× | 273.6 | 6.28 | 44× | 6.0e-11 | 1.0000000000 | 1080 |
| strip + PML | 800×600 | 958600 | – | 23.3 | 22.6 | – | – | 20.3 | – | – | – | 4762 |
Rows with "–" in the CPU columns were solved on the GPU only.
EME taper (16 cross sections, 400×300, 12 modes):
| CPU (16 threads) | CUDA | Speedup | max |Δneff| | max |ΔS21| | |
|---|---|---|---|---|---|
| Wall time | 119.60 s | 9.44 s | 12.7× | 8.1e-14 | 2.2e-11 |
The fundamental-mode transmission of the taper, |S21[0,0]|², is 0.998933.
For reference, the fundamental-mode effective index of the lossless strip returned by the CUDA backend is 2.42151 on the 200×150 grid and 2.45098 on the 400×300 grid.

Mode-field plot saved by psmeme as modes_cuda.png: four modes of a circular step-index example, with neff 1.451254, 1.451252, 1.441390 and 1.441316. This is a separate small example and not one of the benchmark cases above.
Comparison
The CUDA backend is compared only against psmeme's own CPU backend, on the same machine, grid and algorithm.
- Accuracy. Wherever both backends ran, the effective indices agree to between 2.5e-14 and 3.0e-13, with one case (strip + PML, 400×300) at 6.0e-11. The minimum mode overlap between CPU and GPU modes is 1.0000000000 in every compared case. For the EME taper the S-matrix element S21 differs by at most 2.2e-11.
- Speed, lossless strip. Total solve time is 12.9× to 23.2× faster cold and 14.8× to 26.8× faster warm; the eigensolve phase alone is 24× to 56× faster. The speedup grows with problem size.
- Speed, with PML. 30.0× / 32.1× (cold / warm) at 200×150 and 39.1× / 40.8× at 400×300.
- EME. 12.7× against a CPU run that already uses 16 threads across cross sections.
Limitations
- This is a self-consistency and speed benchmark, not an accuracy validation. Agreement between the two backends shows that the GPU reproduces the CPU solver; it says nothing about discretization error. The fundamental neff still changes between the 200×150 and 400×300 grids (2.42151 vs 2.45098), and the benchmark geometry is staircased by cell centres without sub-pixel smoothing. No external solver or analytic reference is used on this page.
- The largest cases have no CPU reference. strip 1200×900 and strip + PML 800×600 were run on the GPU only, so they have timings but no Δneff or overlap check.
- PML cases are much more expensive on both backends. With PML the eigensolver needs far more operator applications (for example 3488 on the GPU at 400×300, against 224 without PML), and the 400×300 PML case takes 7.05 s on the GPU against 0.702 s without PML. The backend agreement in that case (6.0e-11) is also looser than in the others.
- The single-solve CPU baseline is single-threaded in the eigensolve. The CPU backend runs one mode solve on one thread and parallelizes across EME cross sections instead. The per-solve speedups (13× to 41×) are therefore against one CPU core's worth of eigensolve; the EME figure (12.7× against 16 threads) is the fairer whole-device comparison.
- GPU memory grows to 6176 MiB at 2.2 million unknowns (lossless) and 4762 MiB at 0.96 million unknowns with PML.
- The CPU model is not recorded in the benchmark report (only "CPU threads: 32"), and the mode-field figure has no accompanying report describing how it was produced.
- The report gives one wall time per configuration (warm GPU solves use 3 repeats) and no run-to-run spread.
Reproduce
Requires the CUDA toolkit (12.x), CMake ≥ 3.20 and a host compiler.
# the benchmark on this page; writes report.md and report.json to outputs/benchmarks/cuda/
cargo run --release -p eme --features cuda --example cuda_bench
# options (defaults shown)
cargo run --release -p eme --features cuda --example cuda_bench -- \
--sizes 200,400,600,800,1000,1200 --pml-sizes 200,400,800 \
--cpu-max 1000 --cpu-max-pml 400 \
--modes 10 --repeats 3 --eme-nx 400 --eme-sections 16 --eme-modes 12 \
--out outputs/benchmarks/cuda
# per-stage timing on the device
cargo run --release -p fde --features cuda --example cuda_profile -- 800
# CPU/CUDA comparison tests (skipped automatically without a GPU)
cargo test --release -p fde -p eme --features eme/cudaFor the FDTD side of the GPU story see GPU performance and roofline.