Expand description
Unified GPU backend trait for tile-based FDTD simulation.
This module provides an abstraction layer over CUDA and WGPU backends, enabling GPU-resident state with minimal host transfers.
§Design
The key optimization is keeping simulation state on the GPU:
- Pressure buffers persist on GPU across steps (no per-step upload/download)
- Only halo data (64 bytes per tile edge) transfers for K2K messaging
- Full grid readback only when GUI needs to render
§Buffer Layout
Each tile uses an 18x18 buffer (324 floats = 1,296 bytes):
+---+----------------+---+
| NW| North Halo |NE | <- Row 0 (from neighbor)
+---+----------------+---+
| | | |
| W | 16x16 Tile | E | <- Rows 1-16 (owned)
| | Interior | |
+---+----------------+---+
| SW| South Halo |SE | <- Row 17 (from neighbor)
+---+----------------+---+Structs§
- Fdtd
Params - Parameters for FDTD computation.
- Tile
GpuBuffers - GPU buffers for a single tile.
Enums§
- Boundary
Condition - Boundary condition type for domain edges.
- Edge
- Edge direction for halo exchange.
Traits§
- Tile
GpuBackend - Unified trait for GPU backends (CUDA and WGPU).
Functions§
- buffer_
index - Calculate buffer index for interior coordinates (0-indexed).
- halo_
col_ index - Calculate halo column index.
- halo_
row_ start - Calculate halo row index (row 0 or row buffer_width-1).