for loop version of co_ranks because of fences