Fix checkpoint rank selection for Ulysses sequence parallelism (#8226)