def parameter_name_compare(x, y):
    """
    Compare two parameter names depend on their rank id.
    A parameter name is like dist_softmax_rank_00000.w_0,
    where 00000 is the rank id.
    """
    rank_id_x = int(x.split('.')[0].split('@')[-1])
    rank_id_y = int(y.split('.')[0].split('@')[-1])
    if rank_id_x < rank_id_y:
        return -1
    elif rank_id_x == rank_id_y:
        return 0
    else:
        return 1