root rankの32bit整数配列を全rankへbroadcastする。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | values(:) | |||
| integer(kind=i32), | intent(in) | :: | root |
subroutine mpi_bcast_i32_array(ctx, values, root) type(mpi_context), intent(in) :: ctx integer(i32), intent(inout) :: values(:) integer(i32), intent(in) :: root #ifdef USE_MPI integer, allocatable :: buffer(:) integer :: ierr #endif if (root < 0_i32 .or. root >= max(1_i32, ctx%size)) then error stop 'mpi_bcast_i32_array root out of range.' end if #ifdef USE_MPI if (.not. ctx%enabled) return allocate (buffer(size(values))) buffer = int(values, kind=kind(0)) call MPI_Bcast(buffer, size(buffer), MPI_INTEGER, int(root), MPI_COMM_WORLD, ierr) values = int(buffer, kind=i32) #endif end subroutine mpi_bcast_i32_array