Skip to content

Fortran binary silently produces all-NaN fit when block_size exceeds frames per thread #292

Open

Description

@neuromechanist

Found while building the #209 matched-stopping experiment (PR #291): amica15 splits frames across max_threads OpenMP segments BEFORE chunking by block_size; if block_size exceeds one segment's length the run silently produces an all-NaN fit — LL stuck at exactly 0.0, exit code 0, no error message. Bisected precisely: frames=5120, max_threads=4 -> block_size=1280 works, 1281 fails. The experiment script now clamps Fortran's block_size to frames // threads and treats LL==0.0 as degenerate.

Implications: (1) any harness driving the reference binary (validate_implementations.py, the parity tests, benchmarks) should apply the same clamp or degenerate-LL check so a silent NaN reference never poisons a comparison; (2) the #232 auto-tuner must clamp candidate block sizes on the Fortran side of any parity run; (3) worth a note in docs/guides/validation.md's block-size material since users driving amica15 directly at the new larger defaults could hit this on short recordings or high thread counts.

This is reference-binary behavior we document and defend against, not something we patch (amica15.f90 is read-only). Related: #209, #232, #216, PR #291.

Activity

  1. neuromechanist commented on Sep 24, 2026

    @neuromechanist
    MemberAuthor

    Related, from epic #324 Phase 17 (#355): the binary's block_size is per thread; it runs n_samples // (max_threads * block_size) blocks (amica15.f90:1215-1227).

    • Default: AMICANative now derives its default block_size per thread from pamica's 8192-sample block, capped at the data length, so a default run cannot hit the zero-block case.
    • Explicit values: an explicit block_size can still hit it; the engine reports that as a degenerate fit.
    • Docs: the advice to "match block_size on both sides" for bit-for-bit comparisons compares different quantities, since pamica's value is per block and the binary's per thread. It should be restated in total samples per block.
  2. neuromechanist commented on Sep 24, 2026

    @neuromechanist
    MemberAuthor

    Status after 0.4.0.

    Done:

    Still open:

    • An explicit block_size passed to AMICANative, or an input.param written directly (validate_implementations.py writes its own), can still exceed the frames per thread.
    • A clamp or zero-LL check in validate_implementations.py.
    • The validation.md note on per-thread block sizes, which the earlier comment here describes.
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