[J3] asynchronous coarray collectives?

Jeff Hammond jehammond at nvidia.com
Sat May 6 07:59:09 UTC 2023


How do I make a Fortran coarry program like this...

subroutine stuff(A,B,C,D)
 implicit none
 double, intent(inout) :: A, B, C
 double, intent(in) :: D(:)
 call co_sum(A)
 call co_min(B)
 call co_max(C)
 print*,D
end subroutine stuff

...behave like this...

subroutine stuff(A,B,C,D)
 use mpi_f08
 implicit none
 double, intent(inout) :: A, B, C
 double, intent(in) :: D(:)
 type(MPI_Request) :: R(3)
 call MPI_Iallreduce(MPI_IN_PLACE, A, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD, R(1))
 call MPI_Iallreduce(MPI_IN_PLACE, B, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD, R(2))
 call MPI_Iallreduce(MPI_IN_PLACE, C, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD, R(3))
 print*,D
 call MPI_Waitall(3,R,MPI_STATUSES_IGNORE)
end subroutine stuff

...in the sense that it is possible for the network to execute the communication operations asynchronously relative to the print statement?

Do any compilers, e.g. Cray’s, automatically convert coarry operations to asynchronous communication and push the completion of those operations as far down as possible?

Jeff


More information about the J3 mailing list