init_ns_multi_gpu

jaxrens.sampling.nested_sampling.init_ns_multi_gpu(init_fn, positions, types, energies, cells, rng_keys, n_gpu, n_per_gpu, step_sizes=None, ensemble_params_per_run=None, restart_states=None, max_neighbors=0, max_neighbor_counts=None)[source]

Initialize a (G, P, ...)-shaped NSState for shard_map(vmap) execution.

Delegates to init_ns_parallel with n_runs = G*P, then reshapes all dynamic fields from (G*P, ...) to (G, P, ...).

Parameters:
  • init_fn (Callable) – MCState constructor from build_mwg().

  • positions (Array) – Shape (G*P, n_walkers, n_atoms, 3) or (G, P, n_walkers, n_atoms, 3). If 5-D, interpreted as already having the (G, P) prefix.

  • types (Array) – Shape (n_atoms,) shared, or (G*P, n_walkers, n_atoms).

  • energies (Array) – Shape (G*P, n_walkers) or (G, P, n_walkers).

  • cells (Array | None) – Shape (G*P, n_walkers, 3, 3) or (G, P, n_walkers, 3, 3) or None.

  • rng_keys (Array) – Shape (G*P,) or (G, P) — one key per run.

  • n_gpu (int) – Number of GPU devices (G).

  • n_per_gpu (int) – Number of NS runs per GPU (P).

  • step_sizes (Array | None) – Per-move step sizes (shared across all runs).

  • ensemble_params_per_run (list[dict] | None) – Flat list of G*P dicts, or None.

  • restart_states (list[list] | None) – (G, P) nested list of RestartBundle | None, or None for a fresh start on all runs. Mixed restart (some runs fresh, some from checkpoint) is supported. Dead-point history is not re-seeded — the disk record (.energies / .traj) is append-only and survives across restart. Only the bookkeeping scalars (iteration, log_evidence) are seeded into NSState here.

  • max_neighbors (int)

  • max_neighbor_counts (Array | None)

Returns:

NSState with shape (G, P, ...) on all dynamic fields.

Return type:

NSState