Skip to Content
Installation
Install, Run and Test Blaze
January 9, 2026

Install, Run and Test Blaze

Get started with Blaze.


Contents

  1. Quick Install via PyPI
  2. Running Blaze
  3. Building from Source
  4. Reproducing Benchmarks

Blaze is designed to be accessible. Whether you’re a researcher looking for a quick photonic band structure calculation or a developer who wants to explore the codebase, there’s an installation path for you.

Quick Install via PyPI

The fastest way to get started is through Python’s package manager:

pip install blaze2d

This installs the pre-built binaries and Python bindings. For usage examples and API documentation, visit the PyPI project page .

Running Blaze

Blaze offers two interfaces for running simulations:

InterfaceBest For
CLI flagsQuick single runs, scripting
TOML filesReproducible simulations, parameter sweeps

CLI Flags

For quick, one-off calculations, you can specify all parameters directly on the command line:

blaze2d --lattice square --eps-bg 13.0 --radius 0.3 --polarization TM --resolution 24

This is ideal for rapid prototyping or when integrating Blaze into shell scripts.

TOML Configuration Files

Recommended: TOML configuration files are the intended way to use Blaze for serious work. They make your simulations reproducible, shareable, and version-controllable; without sharing actual code.

TOML files separate your simulation parameters from the execution environment. This modern, modular approach means you can:

  • Share configurations with collaborators without compatibility issues
  • Track changes in version control more easily
  • Reproduce results months or years later with identical parameters
  • Organize parameter sweeps in a clean, readable format
blaze2d run examples/square_eps13_r0p3_tm_res24.toml

The repository includes numerous example configurations in the examples/ directory, covering square and hexagonal lattices, various polarizations, and bulk parameter sweeps.

Building from Source

For those who want to modify Blaze, contribute to development, or simply prefer building from source:

git clone https://github.com/RnLe/blaze2d.git cd blaze2d cargo build --release

The compiled binary will be available at target/release/blaze2d.

Requirements

  • Rust 1.91+ (install via rustup )
  • Python 3.9+ (for Python bindings, optional)

Running Tests

If you want to inspect the testing infrastructure or verify your build:

cargo test

This runs the full test suite, including unit tests for the core solver algorithms, integration tests for the CLI, and validation tests that compare results against reference solutions.

Reproducing Benchmarks

All performance benchmarks shown in the Blaze introduction can be reproduced from the benchmarks/ directory. The suite is organized with a clean Makefile that automates the entire process.

Quick Start

cd benchmarks # Run everything (takes 10-20 minutes) make all # Or run specific categories make single # Single-core benchmarks (MPB vs Blaze) make multi # Multi-core benchmarks (16 threads) # Generate all plots from existing data make plot

Benchmark Series

The benchmarks are organized into focused series, each targeting a specific aspect of solver performance:

SeriesTargetCommand
Series 1Epsilon sweep (dielectric contrast)make series1
Series 2Number of bands scalingmake series2
Series 3Grid resolution scalingmake series3
Series 4LOBPCG iteration countmake series4
Series 5Memory usage comparisonmake series5
Series 6Accuracy validation (f32 vs f64)make series6
Series 7Multi-threading scalingmake series7

Each series has a corresponding make plot-seriesX target to regenerate its plots independently.

Benchmark Requirements

The benchmark suite compares Blaze against MIT Photonic Bands (MPB) , which requires a dedicated conda environment. The Makefile will automatically check for this environment and guide you through setup if needed.

First-time setup:

cd benchmarks # Option 1: Let the Makefile create the environment (auto-detects mamba/conda) make setup-env # Option 2: Create manually mamba env create -f environment.yml # recommended (faster) conda env create -f environment.yml # alternative

The environment.yml file includes MPB, meep, and all required dependencies. Once installed, the environment will be auto-detected whether you use conda or mamba.

Verify your setup:

make check-env

If the environment is missing, you’ll see clear instructions on how to set it up.

Summary of requirements:

  • MPB: Auto-installed via make setup-env or conda env create -f environment.yml
  • Blaze2D: Rust toolchain (automatically built by the Makefile)
  • Plotting: Python with matplotlib and numpy (included in the environment)

Run make help for a comprehensive overview of all available targets and their parameters.

Last updated on