Repository navigation
Install with pip install torchfdtd==1.4.0; add [cuda-kernels] for the fused CUDA path and [mcp] for the MCP server.
Projects that do not choose a CUDA kernel now run the fused kernels when CuPy works, 7.6 to 8.6 times faster per step on an RTX 3060.
Changed
Region.cuda_kernelandRegion.cuda_monitor_kerneldefault to"auto": a resident run on CUDA uses the fused kernels for real fields when CuPy imports and compiles a kernel for the device and the grid is within the fused index range, and the Torch kernels otherwise. An explicit"torch"or"fused"is kept;"auto"is not written to project JSON, and the result summary names the kernels that ran (EXECUTION_MODES.md, 0575762).
Results change
- Projects that set no kernel and run on CUDA with CuPy installed move from the Torch to the fused kernels. Fields and point traces were bit-identical for the sphere scenes measured at 64^3, 128^3 and 256^3 (RTX 3060, FP32). Plane-monitor spectra differ by rounding: the largest flux difference of the 128^3 scene was 3.8e-9 of the peak, and the tests accept 3e-6 in FP32. Earlier result files stay readable;
cuda_kernel="torch"restores the previous kernels.
Performance
- A run that sets no kernel steps 7.6 to 8.6 times faster than in 1.3.0 and completes 4.9 to 6.3 times sooner with CuPy installed (64^3 to 256^3 cells, RTX 3060, medians of three alternated runs) (0575762).
- The resident grid holds one unit inverse permeability instead of a full array of ones, and is built without full-size temporaries. The fused kernels step 6 to 11% faster on the same scenes, with bit-identical fields, and the peak memory of fused dielectric runs of 16 million cells and more falls by 17 to 33% (baba365).
Fixed
- The memory estimate bounds dispersive runs with
cuda_graph_stepsabove 1 again. In 1.2.0 and 1.3.0 the cached temporaries of the uncaptured steps stayed reserved beside the graph pools, and a 4.1-million-cell Lorentz run reserved 1300 MiB against an estimate of 1149 MiB (1c4d02b).
Validation scope
- RTX 3060 (Windows, torch 2.10, CuPy 13.6): the CUDA suite without the long tests, 1099 passed; the one failure, the memory check of
test_tensor_slab_acceptance, fails in the same order on 1.3.0 and passes alone. The CPU suite passed except the clean-install record, which this release regenerates. The resident memory record was measured again (48 cases) and the workbench journeys recorded again on a CPU-only server. Other GPUs and the full release suite remain outside this release's validation scope.
Full list: CHANGELOG.md.