recon_surf.pin_cpu_dispatch¶
Pin which vectorised kernels numpy and OpenBLAS select, for steps that have to reproduce.
Both read their setting once, at import, so a caller in Python must pin before importing numpy and a caller in shell must pin before starting the process. Run as a script this prints the assignments for the shell form:
eval “$(python3 recon_surf/pin_cpu_dispatch.py)”
Used by the spherical projection and by talairach-reg.sh. Those are the steps where a kernel difference has been measured to survive into the output: both end in a decomposition, which turns a last-bit difference in the input into a visible one in the result.
- recon_surf.pin_cpu_dispatch.enabled_simd_features(python)[source]¶
Ask a numpy which SIMD extensions it would dispatch to.
In a throwaway process, because the answer has to be known before this one imports numpy. Read rather than hardcoded: the names differ by numpy version and platform, unknown ones are ignored, but disabling a baseline feature raises.
- Parameters:
- python
str The interpreter to ask, normally
sys.executable.
- python
- Returns:
- recon_surf.pin_cpu_dispatch.pin_cpu_dispatch(env, python)[source]¶
Pin which vectorised kernels numpy and OpenBLAS choose.
Both read their setting once, when they are imported, so this has to run before numpy reaches the interpreter. Without it the same wheel computes slightly different numbers on different machines.
A value already in
envis left alone. An explicitly set variable should take effect, and it is the only escape hatch: forcing a core type the CPU cannot execute faults rather than falling back, so someone on unusual hardware needs a way to override this. Such a value may well be reproducible, it is simply not the one tested here, hence a note about the condition rather than a prediction of trouble.- Parameters:
- env
MutableMapping[str,str] The environment to pin, normally
os.environ.- python
str The interpreter whose numpy decides the feature list, normally
sys.executable.
- env