FieldKernels

Overview
FieldKernels is an open-source Rust library that computes the Biot-Savart magnetic field of current-carrying coil filaments. The core evaluates the exact analytic field of straight segments on a multithreaded Rayon CPU kernel and on cross-platform wgpu compute kernels (Vulkan, Metal, DX12), with a naive and a shared-memory tiled variant. Python bindings built with PyO3 and maturin expose a NumPy interface, and a local web app lets you drag coil parameters and see field slices, field lines, a live benchmark and a validation report.
Speed
On an AMD Radeon RX 9070 XT with 20,000 field points, the GPU overtakes the 16-thread CPU at about 100 filaments and reaches 88x the CPU Rayon kernel end to end at 100,000 filaments. The GPU kernel alone sustains roughly 170 to 190 billion filament-point interactions per second.
I tuned the tiled kernel by profiling memory access and sweeping workgroup size. Staging filaments through workgroup memory is fastest at workgroup sizes of 64 to 128, about 15% ahead of the naive kernel.

Correctness
Every kernel is checked against closed-form solutions: the exact field of a regular polygon, the elliptic-integral solution for a circular loop, the infinite-wire limit and a divergence-free check. The CPU f64 path reaches machine precision (1e-15) against the polygon solution, and the GPU f32 kernels stay under 5e-5 against the f64 reference. The checks run in CI on Linux, macOS and Windows.
Limits
GPU precision is f32 only because WGSL has no portable f64, so double precision uses the CPU path. There is no CUDA backend; wgpu covers NVIDIA, AMD, Intel and Apple GPUs. Hosted CI runners have no GPU, so the GPU tests skip themselves there and run locally.
Stack
Rust · wgpu / WGSL · Rayon · PyO3 · Python · NumPy