総数 total_count をrankへ均等分割したときの局所個数を返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i32), | intent(in) | :: | total_count | |||
| integer(kind=i32), | intent(in) | :: | rank | |||
| integer(kind=i32), | intent(in) | :: | size |
integer(i32) function mpi_split_count(total_count, rank, size) result(local_count) integer(i32), intent(in) :: total_count, rank, size integer(i32) :: base_count, n_remainder if (total_count < 0_i32) error stop 'mpi_split_count requires total_count >= 0.' if (size <= 0_i32) error stop 'mpi_split_count requires size > 0.' if (rank < 0_i32 .or. rank >= size) error stop 'mpi_split_count rank out of range.' base_count = total_count/size n_remainder = modulo(total_count, size) local_count = base_count if (rank < n_remainder) local_count = local_count + 1_i32 end function mpi_split_count