
Blaze2D: A High-Performance Solver for Photonic Crystals
Introducing Blaze: the design, validation, and performance of a Rust-based 2D Maxwell solver.
Photonic band structure calculations commonly rely on the Plane Wave Expansion (PWE) method, and MIT Photonic Bands (MPB) has long served as a widely used reference implementation for it.[1][2] MPB is trusted for its accuracy and is therefore a natural baseline for performance comparisons.
Blaze is a Rust solver using LOBPCG and mixed-precision arithmetic.[3][4] This report presents historical measurements of band calculations. It separates observed timings and memory use from hypotheses about their causes.
These historical benchmarks use square and hexagonal lattice configurations from Joannopoulos and colleagues' 1997 paper.[5] Unless otherwise specified, all data reflects the square lattice configuration at a resolution of 64, computing the lowest 8 bands with 20 k-points per segment between high-symmetry points. Series 4 and 5 record MPB tolerance 1e-7 and Blaze tolerance 1e-4. The archived web datasets do not consistently record hardware identifiers or solver revisions, which limits reproducibility and cross-release comparisons.
Single-Core Performance
The computational cost of PWE solvers is dominated by Fast Fourier Transforms (FFTs).[1] In this plane-wave formulation, Transverse Electric (TE) modes are more expensive to solve than Transverse Magnetic (TM) modes, because each operator application requires six FFTs rather than two for TM.
In these recorded single-core workloads, the f64 and mixed-precision Blaze runs are faster than the MPB runs. The mixed-precision measurements give an average speed ratio of about 2.9×. This ratio depends on the geometry, numerical settings, and execution environment.
Multi-Core Performance
The benchmark compares MPB threading within individual solves with Blaze scheduling independent configurations.[6][7] The cost of synchronization and data movement can limit scaling for small problems.
Blaze avoids this overhead by parallelizing entire jobs rather than individual operations, a strategy optimized for large-scale parameter sweeps.
The recorded 16-thread runs give an average speed ratio of 11.9×. Blaze f64 times are approximately 240–350 ms, while mixed-precision times are about 160 ms. These timings alone do not identify a unique hardware bottleneck.
All subsequent benchmarks for Blaze are performed in Mixed Precision mode, unless otherwise specified.
Memory Efficiency
The recorded process-memory measurements are approximately 190 MB for MPB over much of this sweep. Process memory includes runtime and library allocations, so this observation does not establish that MPB reserves a fixed solver workspace.[7]
Blaze uses less measured peak memory in these runs. A smaller working set can reduce data movement, but cache residency requires direct profiling and cannot be inferred from the memory ratio alone.
For a square grid with side length , field storage grows as per band. Eigensolver workspaces also depend on band count, precision, and retained outputs. Process-level measurements may conceal that growth over a limited range.
Both recorded process-memory curves remain nearly flat over the tested band-count range. This does not imply that storing more eigenvectors has no memory cost.[3]
Memory Scaling Laws
The measured MPB-to-Blaze memory ratio is about 20× at the smallest grids and decreases as the grid grows. These finite-range measurements do not determine an asymptotic memory ratio.
Power-law fits over the recorded range give exponents for MPB and for Blaze. These are empirical fits to process-memory measurements, not asymptotic storage laws or proof of a particular allocation strategy.
Resolution and Geometry
The viewer below illustrates grid resolution and interface smoothing for a circle. Blaze implements analytic subpixel averaging motivated by established dielectric-interface methods.[8] Its present rasterizer does not guarantee MPB overlap precedence. Choose resolution through convergence tests for the geometry and quantities of interest.
Accuracy Validation
The reduction in precision and memory footprint raises a direct question: do we gain speed at the cost accuracy? To answer this question, we compared the eigenfrequencies from Blaze against a high-precision MPB reference along the full path. In the plots below, the MPB bands are drawn as lines and the Blaze eigenvalues as markers.
The comparison computes 20 bands and displays the lowest 10. Frequencies are compared as sorted eigenvalue sets at each wavevector, avoiding sensitivity to band labels near crossings and the upper edge of the solved window. This historical plotting convention differs from the current API, which preserves the tracked path returned by the solver.
Deviation Analysis
The recorded median relative frequency difference from MPB is about . The maximum is approximately for TM and for TE. These discrepancies measure agreement between runs; they are not certified bounds on discretization error.
The f32 and f64 Blaze runs differ by a median of about and a maximum below . Storage precision therefore has a smaller effect than the observed MPB difference in this dataset. Prior mixed-precision eigensolver studies provide related context.[4]
Parallel Scaling
The two solvers parallelize in different ways. MPB splits the work inside a single solve across threads, while Blaze runs many independent solves at the same time, one per thread, which suits the parameter sweeps it is built for. The charts sweep the thread count from 1 to 16 and measure throughput in solves per second, for a small problem () and a large one ().
For the recorded problem, Blaze throughput increases from about 28 to 220 solves per second across 16 threads. MPB threaded throughput stays near 14 solves per second. Separate MPB processes scale better than its threaded mode in this experiment.
For , Blaze throughput increases by about 3× across the thread-count sweep. This supports scheduling independent configurations for these workloads; it does not establish a general limit on MPB parallelism.
Scaling with Resolution
Resolution sets the overall cost: the number of plane waves grows as and the FFTs as . The bar chart sweeps the grid from to and compares wall-clock time against MPB.
Blaze is faster at each sampled resolution in this dataset. At , the recorded times are approximately 8.0 s versus 39 s for TM and 12 s versus 70 s for TE. MPB timings vary non-monotonically with some grid sizes. FFT factorization and planning are possible contributors, requiring separate profiling.
The log-log plot compares empirical trends over the sampled resolutions. Its fitted slopes should not be extrapolated beyond this range without further measurements.
Convergence and Iteration Count
Beyond the cost of the entire single iteration, the number of iterations needed to converge each -point matters.
Mean iteration counts are approximately 4.5 for Blaze TM and 5.6 for Blaze TE, compared with 7.5 and 11.9 for MPB. The recorded tolerances are 1e-4 for Blaze and 1e-7 for MPB, so these are not equal-tolerance iteration comparisons. Both implementations use eigenvalue changes in their stopping criteria. MPB documents this convention explicitly. Fresh residuals must be checked separately.
Maximum recorded iteration counts are 39 for MPB TM and 85 for MPB TE, compared with 12 and 24 for Blaze. Their locations vary along the path. The measurements do not isolate whether preconditioning, subspace updates, or stopping settings cause the difference.
Dielectric Contrast
The dielectric-contrast sweep covers rod permittivities from to . Blaze times vary little over these sampled configurations; MPB times vary more. This is an observation about the recorded sweep, not a guarantee of contrast-independent cost.
Scaling with Band Count
The band-count sweep requests 4 to 20 bands. Solve time increases for both solvers. The recorded 20-band TM times are 1.9 s for Blaze and 3.9 s for MPB. Workspace size still depends on band count even where the process-memory measurements appear flat.
Conclusion
The recorded experiments show lower Blaze wall-clock times and peak process memory for the tested configurations. The reported ratios are specific to those measurements and their numerical settings. A matched comparison of release 0.7 requires new runs with explicit solver revisions, hardware, retained outputs, and residual checks.
Blaze schedules independent configurations and uses mixed-precision storage with f64 critical reductions. These design choices support repeated crystal calculations and scientific data extraction.
Blaze exports projected operator and derivative data, including velocity matrices, effective masses, and formulation-specific geometric terms.[9][10][11] MPB also exposes fields, eigenvectors, and group velocities. Blaze integrates parameter studies and projected extraction in one configuration and result contract.
References
- [1]
S. G. Johnson and J. D. Joannopoulos, "Block-iterative frequency-domain methods for Maxwell's equations in a planewave basis," Optics Express 8, 173–190 (2001). [DOI]
- [2]
K. Sakoda, Optical Properties of Photonic Crystals, 2nd ed. Springer, 2005. [DOI]
- [3]
A. V. Knyazev, "Toward the Optimal Preconditioned Eigensolver: Locally Optimal Block Preconditioned Conjugate Gradient Method," SIAM Journal on Scientific Computing 23, 517–541 (2001). [DOI]
- [4]
J. Woo, S. Kim and W. Y. Kim, "Dynamic Precision Approach for Accelerating Large-Scale Eigenvalue Solvers in Electronic Structure Calculations on Graphics Processing Units," Journal of Chemical Theory and Computation 19, 1457–1465 (2023). [DOI]
- [5]
Joannopoulos, J., Villeneuve, P. & Fan, S. Photonic crystals: putting a new twist on light. Nature 386, 143–149 (1997). [DOI]
- [6]
J. L. Hennessy and D. A. Patterson, Computer Architecture: A Quantitative Approach, 5th ed. Morgan Kaufmann, 2011, Fig. 2.2. [PDF]
Figure 2.2 illustrates differing trends in performance trends between processor speed and memory bandwidth, showing how memory access has become the dominant bottleneck in modern computing systems.
- [7]
S. Williams, A. Waterman and D. Patterson, "Roofline: an insightful visual performance model for multicore architectures," Communications of the ACM 52, 65–76 (2009). [DOI]
- [8]
A. Farjadpour, D. Roundy, A. Rodriguez, M. Ibanescu, P. Bermel, J. D. Joannopoulos, S. G. Johnson and G. W. Burr, "Improving accuracy by subpixel smoothing in the finite-difference time domain," Optics Letters 31, 2972–2974 (2006). [DOI]
- [9]
M. V. Berry, "Quantal Phase Factors Accompanying Adiabatic Changes," Proceedings of the Royal Society of London. Series A 392, 45–57 (1984). [DOI]
- [10]
F. Wilczek and A. Zee, "Appearance of Gauge Structure in Simple Dynamical Systems," Physical Review Letters 52, 2111–2114 (1984). [DOI]
- [11]
P.-O. Löwdin, "A Note on the Quantum-Mechanical Perturbation Theory," The Journal of Chemical Physics 19, 1396–1401 (1951). [DOI]