dmlcloud.seed
- dmlcloud.seed(seed=None, group=None)
Share’s the seed from the root rank to all ranks in the group and seeds the random number generators.
The following libraries are seeded: - random - numpy - torch - tensorflow (if installed and imported)
Different ranks will be seeded differently, so that they do not generate the same random numbers.
- Parameters:
seed (
int|None) – The seed to share. If None, a random seed is generated. Default is None. Value must be within the inclusive range [-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff]. Negative inputs are remapped to positive values with the formula 0xffff_ffff_ffff_ffff + seed.group (
ProcessGroup) – The process group to work on. If None, the default process group will be used. Default is None.
- Return type:
- Returns:
The original seed that was provided the root rank. 64-bit integer.
- Raises:
RuntimeError – If
seedis not within the inclusive range [-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff].