def METHOD_NAME(seed):
    if dist.get_world_size() > 1:
        topo = Topology(
            dist.get_rank(), 
            dist.get_world_size(),
            _mesh.dp_degree, 
            _mesh.pp_degree,
            _mesh.mp_degree
        )
        dp_rank = topo.dp.rank
        dp_size = topo.dp.size
        pp_rank = topo.pp.rank
        pp_size = topo.pp.size
        mp_rank = topo.mp.rank
        mp_size = topo.mp.size
        sharding_rank = 0 # auto_parallel's sharding is not orthogonal with dp, mp and pp
    else:
        mp_rank, mp_size = 0, 1
        pp_rank, pp_size = 0, 1
        dp_rank, dp_size = 0, 1
        sharding_rank, _ = 0, 1
    # NOTE: the commented seeds are set only for precision validation
    # seed += 100 * pp_rank
    random.seed(seed + 100 * pp_rank)
    np.random.seed(seed + 100 * pp_rank)
    seed_offset = seed + 1024 + paddle.distributed.get_world_size()
    global_seed = (
        seed_offset
        + pp_rank * (mp_size)
        + dp_rank * (mp_size * pp_size)
        + sharding_rank * (mp_size * pp_size * dp_size)
    )
    seed_offset += paddle.distributed.get_world_size()
    local_seed = (
        seed_offset
        + mp_rank
        + pp_rank * (mp_size)
        + dp_rank * (mp_size * pp_size)
        + sharding_rank * (mp_size * pp_size * dp_size)
    )
    # tracker = get_rng_state_tracker()
    # tracker.add("global_seed", global_seed)
    # tracker.add("local_seed", local_seed)
    paddle.seed(global_seed)
    logger.info("The global seed is set to {} and local seed is set to {}.".format(global_seed, local_seed))
    global _seed
    global _dp_seed
    _seed = seed
    _dp_seed = global_seed