Skip to content

Make the np.dot fit deterministic across CPU thread counts #67

Closed

Description

@guijacquemet

Finding (as written in the restart doc, MorphoFeature #130 review): with normalization.scope: plane plus zscore, normalization's np.dot makes the fitted scale depend on the CPU thread count (observed values differ: …030 vs …531). The fit is keyed in the cache, so a cached fit can differ from a fresh one.

Suggested fix: replace the BLAS-dependent np.dot in the fit with a deterministic sum (a fixed-order reduction, e.g. math.fsum or a pairwise sum in a fixed order), so the result is bitwise identical for any thread count. Add a test that compares fits under different OMP_NUM_THREADS, and check whether the cache key must change.

Source: restart doc LIVE STATE, MorphoFeature #130 review finding (2026-11-04); the item is "#130 finding: normalization np.dot thread-dependent fit, use a deterministic sum".

Activity

  1. added 2 commits that reference this issue on Nov 5, 2026
  2. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions