Skip to content

Test full parallel MonteCarlo determinism under spawn and forkserver, not only seed derivation #1076

Description

@thc1006

Context

#1054 added test_seed_derivation_is_start_method_invariant, which checks that the per-index seed a worker derives matches the main process under fork, spawn and forkserver. It runs in ordinary CI on all three start methods, which covers the seeding math, but it deliberately exercises only the pure derivation helpers, not a real simulate().

The gap

The end-to-end serial == parallel(n) test still stubs the module-level Flight and skips unless the start method is fork, because the stub reaches workers only through fork inheritance. So the full production path (the real multiprocess pool, __sim_producer, the manager, bound-method pickling, the stochastic object graph, the file writes) is only verified under fork. Python 3.14 made forkserver the POSIX default, and Windows and macOS use spawn, so fork is no longer the default anywhere. The untested modes are the ones most users will actually hit.

A possible direction

Give the worker-invariance test a picklable, top-level flight factory (or a very small real Flight) instead of a module-level monkeypatch, so it can run a short simulate(parallel=True) under spawn and forkserver and assert that serial and parallel produce identical inputs per index, with no gaps or duplicates and an empty error file.

Follow-up to the review discussion on #1054.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions