确定性计算
https://chenglu.me/blogs/deterministic-algorithms
export HCCL_DETERMINISTIC=True
def seed_all(seed=1234, mode=False):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.use_deterministic_algorithms(mode)
torch_npu.npu.manual_seed_all(seed)
torch_npu.npu.manual_seed(seed)
seed_all(mode=True)