@@ -6,7 +6,7 @@ program mpi_pass
66
77use , intrinsic :: iso_fortran_env, only: compiler_version, int64, stderr= >error_unit
88
9- use mpi_f08
9+ use mpi
1010
1111implicit none
1212
@@ -15,7 +15,8 @@ program mpi_pass
1515integer :: dest, i, num_procs, id, tag
1616integer (int64) :: tic, toc, rate
1717
18- type (MPI_STATUS) :: status
18+ ! type(MPI_STATUS) :: status
19+ integer :: status (MPI_STATUS_SIZE)
1920
2021call system_clock (tic)
2122
@@ -43,11 +44,13 @@ program mpi_pass
4344select case (id)
4445case (0 )
4546 print * , id, " waiting for MPI_send() from image 1"
46- call MPI_Recv (val, size (val), MPI_REAL, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, status)
47+ call MPI_Recv (val, size (val), MPI_REAL, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, status, ierr)
48+ if (ierr /= MPI_SUCCESS) error stop " MPI_Recv failed"
4749
48- print ' (i0,a,i0,a,i0)' , id, ' Got data from processor ' , status% MPI_SOURCE, ' tag ' ,status% MPI_TAG
50+ ! print '(i0,a,i0,a,i0)', id, ' Got data from processor ', status%MPI_SOURCE, ' tag ',status%MPI_TAG
4951
50- call MPI_Get_count(status, MPI_REAL, mcount)
52+ call MPI_Get_count(status, MPI_REAL, mcount, ierr)
53+ if (ierr /= MPI_SUCCESS) error stop " MPI_Get_count failed"
5154
5255 print ' (i0,a,i0,a)' , id, ' Got ' , mcount, ' elements.'
5356
@@ -61,7 +64,9 @@ program mpi_pass
6164
6265 dest = 0
6366 tag = 55
64- call MPI_Send(dat, size (dat), MPI_REAL, dest, tag, MPI_COMM_WORLD)
67+ call MPI_Send(dat, size (dat), MPI_REAL, dest, tag, MPI_COMM_WORLD, ierr)
68+ if (ierr /= MPI_SUCCESS) error stop " MPI_Send failed"
69+
6570case default
6671 print ' (i0,a,i0)' , id, ' : MPI has no work for image' , id
6772end select
0 commit comments