besskge.sharding.Sharding
- class besskge.sharding.Sharding(n_shard, entity_to_shard, entity_to_idx, shard_and_idx_to_entity, shard_counts, entity_type_counts, entity_type_offsets)[source]
A mapping of entities to shards (and back again).
- Parameters:
n_shard (int) –
- classmethod create(n_entity, n_shard, seed, type_offsets=None)[source]
Construct a random, balanced sharding of entities.
- Parameters:
- Return type:
- Returns:
Random sharding of n_entity entities in n_shard shards.
-
entity_type_counts:
Optional
[ndarray
[Any
,dtype
[int64
]]] Number of entities of each type on each shard; int64[n_shard, n_types]
-
entity_type_offsets:
Optional
[ndarray
[Any
,dtype
[int64
]]] Offsets for entities of same type on each shared (entities remain clustered by type also locally); int64[n_shard, n_types]
- classmethod load(path)[source]
Load a
Sharding
object saved withSharding.save()
.