program main include 'mpif.h' double precision PI25DT parameter (PI25DT = 3.141592653589793238462643d0) integer n, id, numprocs, i, rc integer newcom, handle integer status (MPI_STATUS_SIZE) integer ooor (10) double precision d1, d2 complex c1, c2 real c1r, c1i real c2r, c2i call MPI_INIT( ierr ) call MPI_COMM_RANK( MPI_COMM_WORLD, id, ierr ) call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr ) print *, "Process ", id, " of ", numprocs, " is alive" print *, "MPI_COMM_WORLD is ", MPI_COMM_WORLD print *, "Dup comm is ", newcom call MPI_CONN_REGISTER ("TESTB", MPI_COMM_WORLD, handle, ierr) call MPI_CONN_INTERCOMM_CREATE (handle, "TESTA", newcom, ierr) d1 = 0.0 d2 = 0.0 c1 = (0.0, 0.0) c2 = (0.0, 0.0) c1r = 0.0 c1i = 0.0 c2r = 0.0 c2i = 0.0 call MPI_RECV (d1,1,MPI_DOUBLE_PRECISION,id,10,newcom,status,ierr) call MPI_RECV (c1,1,MPI_COMPLEX,id,20,newcom,status,ierr) d2 = d1 * d1 c1r = REAL (c1) c1i = AIMAG (c1) c2r = c1r * 2.0 c2i = c1i * 3.0 c2 = CMPLX (c2r, c2i) call sleep (1) call MPI_SEND (d2,1,MPI_DOUBLE_PRECISION,id,30,newcom,ierr) call MPI_SEND (c2,1,MPI_COMPLEX,id,40,newcom,ierr) print *,"Recv'd ", d1, "sent back ", d2 print *,"Recv'd ", c1, "sent back ", c2 ! out of order recv test (ooor) ! New test of out of order receives do 15 i=1,10 ooor(i) = i 15 continue print *,"array =", ooor do 20 i=1,10, 1 call MPI_SEND (ooor(i), 1, MPI_INTEGER, id, i, newcom, ierr) print *, "Sent message ", i 20 continue call MPI_CONN_LEAVE (ierr) 30 call MPI_FINALIZE(rc) stop end