You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let the kernels take their array library from their inputs
The propagation kernels are the only part of this worth a GPU: a loop over FFTs
on a long array, where everything else is scalar arithmetic or a closed form
evaluated a few dozen times. They were written as array-to-array functions from
the beginning so this could be added without touching anything above them, and
`maiman.backend` is the whole of the addition.
The arrays decide, not a setting. A kernel handed CuPy arrays runs on CuPy and
returns CuPy arrays; handed NumPy arrays it runs on NumPy. No global mode and no
flag on the context — the kernels are pure functions, and a hidden mode would be
the one piece of state that could make the same inputs give two answers.
Dispatch is on the array's own type, so there is no registry to keep in sync.
CuPy is not exercised here and the docs say so: there is no device and no
install in CI. What is tested is the half that would break a port. A second
array library sets `__array_function__` to None — NumPy's own way for a type to
say it is not NumPy's — so `np.fft.fft` on one of its arrays raises. Universal
functions are deliberately left working, because `np.exp` on a CuPy array
dispatches and comes back a CuPy array; refusing them would be testing a rule
that is not true. What breaks a port is anything that *allocates*, and that is
what the guard covers.
Every converted kernel runs on both libraries and the results are compared, and
the names the second was asked for are recorded and asserted as an equality
rather than a lower bound: thirteen, all of which CuPy provides. A change that
reaches for something only NumPy has now fails in this repository rather than on
somebody's GPU, and one that stops needing something fails too.
Only the propagation path is converted, and a test names which functions are in
and which are out so the line is a decision rather than an oversight.
9 of 9 sabotages caught, after two got through. One was a host copy taken with
`np.asarray` instead of the array's own `get`, which works on a NumPy subclass
and raises on a real device array — the stub grew a `get` that records being
called. The other was the split-step building its frequency grid on the host:
the numbers come out right, because multiplying a host array by a device array
works by transferring the host one, once per step, over a bus. Correctness could
not see it, so the test asserts the allocation instead.
860 tests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|**2 — Coherent transceiver** ✅ | Gray-coded M-QAM to 256, IQ modulator with bias and quadrature error, 90° hybrid, balanced detection, blind carrier phase recovery, dual polarization with a blind butterfly equaliser, root-raised-cosine shaping and matched filtering, differential quadrant encoding, receiver-side dispersion compensation over spans to 1000 km with blind estimation of the accumulated value, EVM/MER, constellation diagram, validated against closed-form SER |~3 months |
969
-
|**3 — GUI & WDM**| ✅ Wavelength-selective filters, an OSA, coupled-channel propagation (XPM with walk-off, FWM accumulating coherently across spans), the session server, a schematic editor — add, wire, move and delete blocks, edit parameters, run, sweep, open and save — and 400G/800G reference designs validated against the OSNR relations · CuPy back-end |~6 months |
1006
+
|**3 — GUI & WDM**| ✅ Wavelength-selective filters, an OSA, coupled-channel propagation (XPM with walk-off, FWM accumulating coherently across spans), the session server, a schematic editor — add, wire, move and delete blocks, edit parameters, run, sweep, open and save — and 400G/800G reference designs validated against the OSNR relations, and a back-end indirection the propagation kernels dispatch through — CuPy runs it where a device exists; it is not exercised in CI|~6 months |
970
1007
|**4 — PIC**| Waveguides, ring resonators, MMI, MZI via integration with an existing S-matrix solver; PDK import | — |
971
1008
972
1009
¹ One developer, part-time. Estimates, not commitments.
0 commit comments