lightsim
Rust-native simulation engine for photonic chips, with a Python API.
lightsim's core is a GPU-first FDTD solver. Around it are waveguide mode solvers, eigenmode expansion, finite-element heat, electrostatics and modes, circuit simulation and inverse design, all without external programs. On one RTX PRO 6000 it runs at 22–27 Gcells/s, 2.2–2.4× faster than FDTDX from 17 M cells up (benchmarks).
Features
- CUDA: kernels written in Rust and compiled to PTX with NVIDIA's cuda-oxide; one build runs on Ampere through Blackwell (tested on RTX PRO 6000 and GB10), on one GPU, several GPUs (peer-to-peer halos) or several machines (TCP halos).
- Vulkan and Metal: a portable GPU backend for AMD, Intel and NVIDIA GPUs through Vulkan and Apple GPUs through Metal (Rust kernels compiled to SPIR-V with rust-gpu, run through wgpu).
- FDTD in 3-D and 2-D on non-uniform meshes, with dispersive, nonlinear (χ², χ³), anisotropic and magneto-optic media, gain media and conducting sheets; CPML, Bloch and mirror-symmetry boundaries.
- Inverse design: adjoint gradients and exact gradients through reverse mode, density and shape optimisation.
- RF and electro-optics: antennas, transmission lines and RF circuits; the Pockels chain from the RF field to the optical response.
- gdsfactory: layout import, port-driven S-parameters, and
lightsim.gpluginswith the interface of gdsfactory's Meep plugin. - Process design kits: load a fab's kit (gdsfactory, KLayout technology, lightsim's technology file, a licensed kit on disk) and simulate its cells.
- Fabrication Monte Carlo: width, thickness, etch, sidewall and overlay spreads and tiny defects (line-edge roughness, particles, missing elements) per sample, run in batches on CPUs and GPUs, with yield.
- Quantum light (
lightsim.quantum): photons and Gaussian states through circuits built from simulated or measured S-matrices, with loss, partly distinguishable photons, sources, detectors and heralded gates; permanents and hafnians on CPUs and GPUs; gradients for inverse design.
Install
pip install lightsim
Wheels for Linux (x86-64 and arm64: the CPU, NVIDIA GPUs through CUDA with
only the driver installed, and any GPU with a Vulkan driver) and macOS
(Apple silicon and Intel: the CPU and the Mac's GPU through Metal), for
Python 3.10 and newer. The package holds the Python API and the lightsim
command:
python -c "import lightsim; print(lightsim.__version__, lightsim.devices())"
lightsim info
From source (Rust 1.99.1; for NVIDIA GPUs, CUDA 13):
git clone https://github.com/su3co/lightsim && cd lightsim
pip install maturin
maturin develop --release # CPU only
maturin develop --release --features cuda # with GPU support (NVIDIA, CUDA)
maturin develop --release --features vulkan # portable GPU backend (metal on macOS)
cargo build --release -p lightsim-cli # the `lightsim` program alone (same --features)
Details: installation guide.
Example
S-parameters of a gdsfactory component (pip install "gdsfactory>=8"), on a
laptop CPU in seconds:
import gdsfactory as gf
import numpy as np
from lightsim.sparams import write_sparameters
gf.gpdk.PDK.activate() # gdsfactory's generic PDK
c = gf.components.straight(length=2) # 2 um of 500 x 220 nm silicon strip
sp = write_sparameters(c, wavelengths=np.linspace(1.5e-6, 1.6e-6, 5),
steps_per_wavelength=12, device="cpu")
print(sorted(k for k in sp if "@" in k))
print(np.round(np.abs(sp["o2@0,o1@0"]) ** 2, 3)) # power transmission o1 -> o2
print(round(sp["mode_neff"]["o1"].real, 3)) # effective index of the port mode
['o1@0,o1@0', 'o1@0,o2@0', 'o2@0,o1@0', 'o2@0,o2@0']
[0.999 1. 1. 1. 0.999]
2.422
With device="cuda:0" the same call runs on a GPU. The
quick start
continues with a simulation built by hand.
Links
MIT licence.
Metadata
Release files for lightsim 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lightsim-0.1.0.tar.gz | 1.9 MB | With provenance | Details for lightsim-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| lightsim-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details for lightsim-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl |
| lightsim-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for lightsim-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl |
| lightsim-0.1.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for lightsim-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
| lightsim-0.1.0-cp310-abi3-macosx_10_13_x86_64.whl | CPython 3.10 | abi3 | macOS 10.13+ x86-64 | Details for lightsim-0.1.0-cp310-abi3-macosx_10_13_x86_64.whl |
Total release size: 41.1 MB
Release files / lightsim-0.1.0.tar.gz
| Download URL | lightsim-0.1.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c5bb8b5ab6d78e653953e7574c0f3c6405214d5e71655b16b0e37ec5a1b1796
|
|
BLAKE2b-256 checksum How to use checksums |
797395586f63ed7acdc7258d05b185df0054e65db8ce0c7ababfdc80623054bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / lightsim-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | lightsim-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
227165785363dcd19faa8c91354256b51685318252dc57b882a67b673853d4d0
|
|
BLAKE2b-256 checksum How to use checksums |
b111db78bb0e97ee748e408a6d68d1e76a2c10860723ff1352f8e40be23cb9db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / lightsim-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | lightsim-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 9.9 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
2047a5b504882e1920a3ac96b00a730d3bf766b7f9152f76cb06f83596c912f7
|
|
BLAKE2b-256 checksum How to use checksums |
d83664d06ea6cf04913277d23991ea3fc841a400babd04047f384495ffe909c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / lightsim-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | lightsim-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.7 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c36ba2eeb338615b7c60eb239cabbc77f19443c1f31e62626b7119d2a037be53
|
|
BLAKE2b-256 checksum How to use checksums |
26d6548925d3d2157a2368d904aeb058c561dd0ed8d8c725f795d818a169d9ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / lightsim-0.1.0-cp310-abi3-macosx_10_13_x86_64.whl
| Download URL | lightsim-0.1.0-cp310-abi3-macosx_10_13_x86_64.whl |
|---|---|
| Size | 9.6 MB |
| Tags | CPython 3.10 abi3 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
62496a9635301a0cf620233a037747442810a52571bfad5865cd510ae5d73edc
|
|
BLAKE2b-256 checksum How to use checksums |
2598aff8e50732e06b7657ef31a543b3603372bfb21332735a8646a99ea78e69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logSecurity for lightsim 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for lightsim-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.