INCLUDE 'mpif.h' PARAMETER ( N=4, M=5 ) DOUBLE PRECISION A(N, M), B(M,N) INTEGER TYPE1, TYPE2, STATUS(MPI_STATUS_SIZE) ! CALL MPI_INIT(IERR) ! DO J=1,M DO I=1,N A(I,J)=I*10+J ENDDO ENDDO ! PRINT 1000, ((A(I,J), J=1,M), I=1,N) 1000 FORMAT(' A=', /, 4(5(1X,F4.0), /)) ! CALL MPI_TYPE_VECTOR(N, 1, M, MPI_DOUBLE_PRECISION, + TYPE1, IERR) CALL MPI_TYPE_EXTENT(MPI_DOUBLE_PRECISION, I, IERR) CALL MPI_TYPE_HVECTOR(M, 1, I, TYPE1, TYPE2, IERR) CALL MPI_TYPE_FREE(TYPE1, IERR) CALL MPI_TYPE_COMMIT(TYPE2, IERR) CALL MPI_SENDRECV(A, N*M, MPI_DOUBLE_PRECISION, 0, 111, + B, 1, TYPE2, 0, 111, + MPI_COMM_SELF, STATUS, IERR) CALL MPI_TYPE_FREE(TYPE2, IERR) ! PRINT 1001, ((B(I,J), J=1,N), I=1,M) 1001 FORMAT(' B=', /, 5(4(1X,F4.0), /)) ! CALL MPI_FINALIZE(IERR) STOP END