run_ns_sharded

jaxrens.sampling.nested_sampling.run_ns_sharded(positions, types, energies, cells, init_fn, step_fn, rng_key, n_gpu, n_walkers=None, max_iterations=10000, n_mcmc_steps=20, n_extra=0, n_cull=1, convergence_threshold=0.1, initial_step_size=0.1, target_acceptance=0.5, callbacks=None, termination_criteria=None, ensemble_params=None, per_move_fns=None, move_descriptors=None, adjust_interval=0, adjust_n_samples=50, adjust_max_rounds=15, adjust_factor=1.5, trial_batch_size=None, restart_state=None, max_neighbors_list=(30, 35, 40, 45, 50), max_neighbors_offset=5, max_neighbors_shrink_dwell=0, initial_max_neighbor_counts=None, batcher=None)[source]

Run a single NS run with the walker population sharded across n_gpu GPUs.

Sibling of run_ns() and run_ns_multi_gpu(). Use when the live population is too large to fit on one GPU — sharding splits walkers across devices and ns_step_sharded uses lax.all_gather + lax.psum collectives to make global decisions coherently.

Shape contract: positions: (K, n_atoms, 3) (flat) or (G, K//G, n_atoms, 3) (pre-sharded), with similar conventions for energies / cells / rng_key is a scalar (not a per-replica array). Inter-RE is not supported here — a sharded single run has one population, not multiple replicas.

Args mirror run_ns_multi_gpu() except:

  • No n_per_gpu (= 1 implicitly).

  • rng_key is a single scalar (broadcast to all shards inside).

  • ensemble_params is a single dict (not per-run).

  • No inter_re_config.

Returns:

Dict with shape (G, K//G, ...) on population fields and (G,) on per-replica scalars (every shard sees identical values; postprocess takes [0]). Mirrors the run_ns_multi_gpu() return schema minus the P axis.

Parameters:
  • positions (Array)

  • types (Array)

  • energies (Array)

  • cells (Array | None)

  • init_fn (Callable)

  • step_fn (Callable)

  • rng_key (Array)

  • n_gpu (int)

  • n_walkers (int | None)

  • max_iterations (int)

  • n_mcmc_steps (int)

  • n_extra (int)

  • n_cull (int)

  • convergence_threshold (float)

  • initial_step_size (float)

  • target_acceptance (float)

  • callbacks (list[Any] | None)

  • termination_criteria (list[TerminationCriterion] | None)

  • ensemble_params (dict | None)

  • per_move_fns (list[Callable] | None)

  • move_descriptors (list | None)

  • adjust_interval (int)

  • adjust_n_samples (int)

  • adjust_max_rounds (int)

  • adjust_factor (float)

  • trial_batch_size (int | None)

  • max_neighbors_list (tuple[int, ...] | list[int])

  • max_neighbors_offset (int)

  • max_neighbors_shrink_dwell (int)

  • initial_max_neighbor_counts (Array | None)

  • batcher (ShardedSingleRun | None)

Return type:

dict