jaxrens.sampling.inter_re_manager

InterREManager: orchestrates inter-replica-exchange swap passes.

One swap pass fires after each ns_step call in _run_loop when configured. The manager is descriptor-aware:

  • SingleRun: apply is a no-op (returns state unchanged with zero stats).

  • VmapRuns: operates on (n_runs, K, ...) directly via replica_exchange_step.

  • PmapVmapRuns: uses lax.all_gather(axis_name="gpu") to replicate the population across devices, swaps on each device’s identical view (same RNG = same swap decisions), then re-shards by slicing the device’s own offset. For n_gpu=1 the all_gather is a no-op (zero extra cost).

Design: built once at construction time, JIT’d swap step cached; _run_loop calls fires(i) / apply(state, key) at each iteration.

The manager is flavor-agnostic. It hands the population to replica_exchange_step() as a SwapWalker pytree, plus the per-run ensemble params the kernel declares in param_keys.

Classes

InterREManager

Manages inter-replica-exchange swap passes in the NS outer loop.

SwapStats

Public return type of InterREManager.apply's stats dict.