nvalchemi.csp.packer.PackingContext#

class nvalchemi.csp.packer.PackingContext(run_id, rank=0, world_size=1)[source]#

Identity and rank assignment for one locally executed packing call.

The run ID is a nonnegative 63-bit identifier shared by every rank in a logical run. Rank and world size describe the caller’s rank assignment; this value object does not initialize or communicate with a process group.

Parameters:
  • run_id (int) – Shared packing-run identity in [0, 2**63).

  • rank (int, default=0) – Zero-based caller-assigned rank in [0, world_size).

  • world_size (int, default=1) – Positive number of caller-assigned ranks.

structure_ids(count, *, device)[source]#

Return rank-strided int64 identities.

Parameters:
  • count (int) – Nonnegative number of accepted structures.

  • device (torch.device or str) – Device for the returned tensor.

Returns:

Shape [count, 2] with [run_id, rank + world_size * ordinal] rows.

Return type:

torch.Tensor

Raises:

OverflowError – If an assigned ordinal does not fit in signed int64.