nvalchemi.distributed.DistributionSpec#
- class nvalchemi.distributed.DistributionSpec(policy=None, custom_ops=<factory>, third_party_helpers=<factory>, adapters=<factory>, shard_fields=('positions', 'charges', 'atomic_numbers'))[source]#
Framework-generic distributed spec.
Carries the field’s
StoragePolicy(how local storage relates to its placement + the overlay-aware op behavior) and the declarative tuples of third-party touchpoints. No chemistry vocabulary appears here — output names like"stress"/"forces"live inMLIPSpecone layer up.- Parameters:
policy (nvalchemi.distributed._core.storage_policy.StoragePolicy | None) – A
StoragePolicy(HaloStoragePolicy/PlainShard), orNonefor the local (no cross-rank) case. The dispatch attaches it to each tensor as_storage_policyand routes ops through it.adapters (tuple[Any, ...]) – The single declarative field for registering adapters — one tuple mixing
OpAdapter(opaque custom/triton kernels) withJitAdapter/PythonAdapter/MethodAdapter(third-party callable replacements). At construction it is lowered: eachOpAdapteris appended tocustom_ops, everything else tothird_party_helpers, andadaptersis cleared. The two split tuples remain the canonical storage all framework consumers read, so serialization and dispatch are unchanged —adaptersis purely a unifying constructor convenience.custom_ops (tuple[nvalchemi.distributed._core.adapter.OpAdapter, ...]) – Tuple of
OpAdapterdeclaring custom-op wrap config (kernels registered via@torch.library.custom_op/@torch.library.triton_op). May be passed directly or supplied viaadapters.third_party_helpers (tuple[Any, ...]) – Tuple of
JitAdapter/PythonAdapter/MethodAdapter— third-party callables that need a distributed-aware replacement. May be passed directly or viaadapters.shard_fields (tuple[str, ...])
- to_dict()[source]#
JSON-friendly representation. Used by
MLIPSpec.to_dict()(v2 schema, nested under"core").- Return type:
dict[str, Any]