nvalchemi.distributed.DomainConfig#
- class nvalchemi.distributed.DomainConfig(*, cutoff, skin=0.0, ghost_width=None, strategy=StrategyKind.HALO, compile=False, require_nondegenerate=False, mesh=None, mesh_dim='domain', grid_dims=None, scripted_marshal='auto', scripted_marshal_exclude=(), migration_hysteresis=None)[source]#
Configuration for one spatial domain-decomposition scope.
- Parameters:
cutoff (float) – Interaction cutoff radius used by the model.
skin (float) – Additional skin distance for neighbor-list buffering. Default 0.
ghost_width (float | None) – Width of the ghost (halo) region. When
None, the effective width defaults tocutoff + skinviaeffective_ghost_width(). An explicit value must be at leastcutoff + skin.strategy (StrategyKind) – Parallelization strategy for this scope:
StrategyKind.HALO(spatial domain decomposition with a ghost halo, the default) orStrategyKind.GRAPH_PARTITION(node-partition graph parallel).compile (bool) – Compile intent for the distributed forward. When
Truethe framework owns the compiled forward and pads per-rank atom/edge counts to stable shapes so the compiled graph is reused across steps; whenFalsethe padder is disabled. DefaultFalse.require_nondegenerate (bool) – When
True, a degenerate partition — one where some rank’s halo already covers every atom (0 remote atoms) — is a hard error instead of a warning. DefaultFalse.mesh (DeviceMesh | None) – Optional
torch.distributed.device_mesh.DeviceMeshdescribing the rank topology.Nonefor single-rank runs.mesh_dim (str) – Name of the mesh dimension used for domain parallelism. Default
"domain".grid_dims (tuple[int, int, int] | None) – Explicit grid dimensions for the spatial decomposition. When
None, the partitioner chooses cells-per-dim from the cell matrix and cutoff.scripted_marshal ({"auto", "declared", "off"}) – Controls marshalling of
@torch.jit.scriptops across the ShardTensor boundary (a scripted kernel reading a ShardTensor’s storage-lessdata_ptrtriggers a CUDA illegal memory access)."auto"(default): auto-discover scripted submodules and wrap them, plus install the spec’s declaredJitAdaptermarshallers."declared": install only the spec’s declared adapters, no auto-discovery."off": no marshalling at all. Overridable viaNVALCHEMI_SCRIPTED_MARSHAL.scripted_marshal_exclude (tuple[str, ...]) – Submodule-name substrings to skip during
"auto"discovery — for a scripted op that genuinely needs cross-rank data (where marshalling to local would silently give wrong numbers) or is handled viacustom_ops.migration_hysteresis (float | None) – Migration-hysteresis margin in angstrom: an atom keeps its current owner until it is this far past a domain boundary, preventing per-step migration thrashing of boundary atoms. When
None(default), the effective value isskin / 2(seeeffective_migration_hysteresis()); it must be< skinso a deferred atom stays within the owner’s halo.
- effective_ghost_width()[source]#
Return the ghost region width, defaulting to
cutoff + skin.- Return type:
float
- effective_migration_hysteresis()[source]#
Migration-hysteresis margin (angstrom). Defaults to
skin/2.An atom keeps its current owner until it is this far past a domain boundary, preventing per-step migration thrashing of boundary atoms. Must be
< skinso a deferred atom stays within the owner’s halo (ghost_width = cutoff + skin).- Return type:
float
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].