# Deviations from the published recipe: the laptop runtime

Dated 7 November 2026. This is the public list of differences between the server runtime and the laptop build that reran the plaids pilot for journal note 23. The recipe is `execution-003`, which built the server runtime on Ubuntu 24.04, x86-64, with GCC 11.5.0 and Python 3.9.20.

Build names, as the other files here use them:

- **First build:** Homebrew GSL 2.8, no source patch. It failed to reproduce the small regression's spike trains (15 of 1,656 equal).
- **Build N:** adds patch 0001 and GSL 2.7.1 without fused multiply-add. It reproduced them (1,656 of 1,656).
- **Build NM:** build N plus patch 0002. This is the build that ran the pilot.

"Mac" in these files means the 8 GB laptop.

## Toolchain and libraries of build NM

| Item | Server | Laptop | Reason |
| --- | --- | --- | --- |
| CPU | x86-64, 4 vCPUs | arm64, Apple M series, 8 cores | The only machine available |
| OS | Ubuntu 24.04.5 | macOS 26.2, build 25C56 (Darwin 25.2.0) | Same |
| Compiler | GCC 11.5.0 | Apple clang 17.0.0 (clang-1700.6.3.2) | Platform |
| Optimisation | -O3 | -O3 -ffp-contract=off | arm64 clang fuses multiply and add by default; x86-64 gcc-11 without -march did not |
| C++ standard | -std=c++11 | -std=c++11 | No change |
| C++ library | libstdc++ | libc++ from MacOSX26.2.sdk | Platform |
| C library, libm | glibc | Apple libSystem, libm | Platform. exp, pow and similar can differ in the last bit |
| OpenMP | libgomp | libomp 23.1.2, private copy | Platform. The private copy means a package upgrade cannot change the engine |
| GSL | 2.7.1 (Ubuntu) | 2.7.1 built from source, CFLAGS="-O2 -ffp-contract=off" | The server's version, with no fused multiply-add in the stepper |
| Boost | 1.83.0 | 1.83.0 headers | Same version |
| libltdl | 2.4.7 | 2.5.4, private copy | Loads modules only, no numerics |
| MPI | Open MPI 4.1.6, -Dwith-mpi=ON | none, -Dwith-mpi=OFF | No MPI on the laptop. Every 2 mm run used one rank |
| readline | default | -Dwith-readline=OFF | Not needed |

The GSL tarball has SHA-256 `dcb0fbd43048832b757ff9942691a8dd70026d5da0ff85601e52687f6deeb34b`. Its signature file was kept but not checked. `make check` in `ode-initval` passed.

GSL 2.7.1 is not fully free of fused instructions. `otool` counts 0 in `rkf45_apply` and in libgslcblas, and 6 in libgsl, against 5,985 in the Homebrew bottle. All six are clang's expansion of `fmod` by a power of two, in `gsl_sf_` functions that neither the stepper nor the model's cells call.

## Source patches

Both patches are in `patches/`, each applied to a copy of the pinned source.

1. **Patch 0001, LGN noise pair order.** On the step current module at `fe91c0345a60`. `normal_dist_` in `iaf_cond_exp_sc_nc` gets a small wrapper that returns each normal pair in libstdc++'s order and uses the random engine exactly as before. It belongs only in a libc++ build. `aeif_cond_exp_sc_nc` has the same draw and stays unpatched, because no parameter file names it.
2. **Patch 0002, block size.** On NEST at `41892a50f95d`. `block_size_shift` goes from 10 to 6, so one recorder link costs 2,048 B instead of 32,768 B.

Apart from these two patches, the NEST source export has the server's SHA-256, `e31abdb9f4219198168e9d52cdd440f069ff95dc6a5b6a3f88093ba3f72e4492`.

## Python and packages

- Python 3.9.6 from Apple's Command Line Tools, not 3.9.20 built from source.
- pip 24.2, setuptools 65.5.0 and wheel 0.38.4 as in the recipe. All 61 other installed pins equal the recipe's lock file, checked by script.
- numpy, scipy, matplotlib, numba, llvmlite, scikit-image and others are arm64 builds of the same versions, so their compiled code differs from the server's: SIMD paths for vector math and the BLAS library.
- Built locally from source distributions, same versions as the lock, because no arm64 wheel exists: elephant 0.11.1, future 0.18.2, interval 1.0.0, lazyarray 0.5.2, param 1.5.1, parameters 0.2.1, psutil 5.9.0.
- mpi4py 3.1.6 is replaced by a single-rank stand-in with exactly the names the code uses. Any other attribute raises an error. Real mpi4py could not be compared, because the laptop has no MPI library.
- MorphIO 3.3.6 is skipped: it has no arm64 wheel, and a search of mozaik, PyNN, imagen and mozaik-models finds no use of it.
- Sphinx 7.4.7 is kept: `mozaik/tools/json_export.py` imports it at run time.

## Environment of the run

- **`OPENBLAS_NUM_THREADS=4`.** The pilot's receipt does not name this variable. numpy's OpenBLAS defaults to the core count, 8 here and 4 on the 4-CPU server. At 8 on a shared laptop, proof run A's LGN step took 1,536 s, against 77 s for run B at 4 threads under similar load. B also had the memory changes, so that factor is not a clean measurement, but a profile of a run stuck in that step at the default put 99 % of its samples in OpenBLAS's thread synchronisation. Proof runs at 8 and at 4 threads were identical in LGN input, connections, spikes and export.
- **`MallocNanoZone=0`.** It was in the environment of every proof run, and the run script sets it so the pilot rerun matches them.
- **`MallocSpaceEfficient=1`.** The wrapper sets it, re-executing itself if it is missing.
- **Multiprocessing start method `fork`.** macOS Python defaults to spawn, and Mozaik's connectors need fork, so a small start-up file sets fork in this environment. This restores the server's behaviour. No source changed.
- `OMP_*` stay unset, as on the server.

## The wrapper

`run_controller_mem.py` runs the unchanged `run_controller.py` through runpy, with `sys.argv[1:]` unchanged, so that file's SHA-256 (`99d215f2...`) stays true. Its docstring describes each change:

- R0, the allocator setting above.
- R1, drop PyNN's connection list once NEST holds the connections. The empty array that replaces it is a copy of the slice. A plain slice is a view, which keeps the parent array alive, so the first sketch of this change freed nothing.
- R3, clear the LGN input cache when `process_input` returns.
- R4a to c, free LGN cell arrays early and share one `times` array.
- R10, avoid a leak in pinned NEST by building the same NodeCollection through a route that frees it.

R2 is patch 0002. R10 was found during the work and was not in the first plan for this step. It saved 0.894 GiB at the short run's peak (3.641 to 2.747 GiB).

## Build steps with no effect on source

1. Leftover C++ header folders from a 2022 install hid the SDK's headers, and CMake's probes failed quietly, which left five settings undefined in `config.h`. The fix was a compiler flag that points at the SDK headers. After it, `config.h` defines all five and the configure log has no "not found" line. System files were not touched.
2. The Command Line Tools Python points its headers at an Xcode path that is absent, so the header path was given by hand to NEST and psutil.
3. AppleClang needs the OpenMP flags given by hand.
4. `with-ltdl` and `with-gsl` are given as explicit paths.
5. CMake 4.4.4 refuses `cmake_minimum_required(2.8.12)`, so `CMAKE_POLICY_VERSION_MINIMUM=3.5` was set for the step current module and PyNN's extension. Their sources are unchanged.

## Model files

All 19 model files match their recorded SHA-256. Five of them, under `param_spont/`, are protocol 017's recorder files and not upstream's: `l23_exc_rec`, `l23_inh_rec`, `l4_exc_rec`, `l4_inh_rec`, `lgn_rec`. They are the state the pilot ran with, not a change.

## Results that bear on these deviations

- Build N against the small regression's reference: 1,656 of 1,656 spike trains equal, largest voltage difference 6.34e-9 mV (`g2-n.txt`). Patch 0001 and the GSL change went in together, so that test does not separate them.
- Two 4-thread repeats on build N at the tiny model: 48 of 48 segments equal by canonical SHA-256, largest voltage difference 0.0. The raw files differ in wall-clock fields, in timestamps and in the order of analog signals inside a segment, so raw segment bytes must not be compared across runs.
- A macOS update changes the runtime, because libc++ and libsystem_m live in the system's shared cache and have no file to hash.

The tools for protocol 023's queue are not listed here. They belong to that protocol's own record.
