|
Packit Service |
c5cf8c |
! -*- Mode: Fortran; -*-
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
! (C) 2013 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
! See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
program main
|
|
Packit Service |
c5cf8c |
use mpi_f08
|
|
Packit Service |
c5cf8c |
integer ierr
|
|
Packit Service |
c5cf8c |
integer smsg(3), rmsg(3), toterrs, wsize, wrank
|
|
Packit Service |
c5cf8c |
common /myinfo/ calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
integer calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
toterrs = 0
|
|
Packit Service |
c5cf8c |
call mpi_init( ierr )
|
|
Packit Service |
c5cf8c |
call init_counts()
|
|
Packit Service |
c5cf8c |
call mpi_comm_rank( MPI_COMM_WORLD, wrank, ierr )
|
|
Packit Service |
c5cf8c |
call mpi_comm_size( MPI_COMM_WORLD, wsize, ierr )
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (wrank .eq. 0) then
|
|
Packit Service |
c5cf8c |
smsg(1) = 3
|
|
Packit Service |
c5cf8c |
call mpi_send( smsg, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, ierr )
|
|
Packit Service |
c5cf8c |
else if (wrank .eq. 1) then
|
|
Packit Service |
c5cf8c |
call mpi_recv( rmsg, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &
|
|
Packit Service |
c5cf8c |
& MPI_STATUS_IGNORE, ierr )
|
|
Packit Service |
c5cf8c |
if (rmsg(1) .ne. 3) then
|
|
Packit Service |
c5cf8c |
toterrs = toterrs + 1
|
|
Packit Service |
c5cf8c |
print *, "Unexpected received value ", rmsg(1)
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
! check that we used the profiling versions of the routines
|
|
Packit Service |
c5cf8c |
toterrs = 0
|
|
Packit Service |
c5cf8c |
if (wrank .eq. 0) then
|
|
Packit Service |
c5cf8c |
if (calls.ne.1) then
|
|
Packit Service |
c5cf8c |
toterrs = toterrs + 1
|
|
Packit Service |
c5cf8c |
print *, "Sender calls is ", calls
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
if (amount.ne.1) then
|
|
Packit Service |
c5cf8c |
toterrs = toterrs + 1
|
|
Packit Service |
c5cf8c |
print *, "Sender amount is ", amount
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
else if (wrank .eq. 1) then
|
|
Packit Service |
c5cf8c |
if (rcalls.ne.1) then
|
|
Packit Service |
c5cf8c |
toterrs = toterrs + 1
|
|
Packit Service |
c5cf8c |
print *, "Receiver calls is ", rcalls
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
if (ramount.ne.1) then
|
|
Packit Service |
c5cf8c |
toterrs = toterrs + 1
|
|
Packit Service |
c5cf8c |
print *, "Receiver amount is ", ramount
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
call mtest_finalize( toterrs )
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
subroutine mpi_send_f08ts( smsg, count, dtype, dest, tag, comm, ierr )
|
|
Packit Service |
c5cf8c |
use :: mpi_f08, my_noname => mpi_send_f08ts
|
|
Packit Service |
c5cf8c |
type(*), dimension(..), intent(in) :: smsg
|
|
Packit Service |
c5cf8c |
integer, intent(in) :: count, dest, tag
|
|
Packit Service |
c5cf8c |
type(MPI_Datatype), intent(in) :: dtype
|
|
Packit Service |
c5cf8c |
type(MPI_Comm), intent(in) :: comm
|
|
Packit Service |
c5cf8c |
integer, optional, intent(out) :: ierr
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
common /myinfo/ calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
integer calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
calls = calls + 1
|
|
Packit Service |
c5cf8c |
amount = amount + count
|
|
Packit Service |
c5cf8c |
if (present(ierr)) then
|
|
Packit Service |
c5cf8c |
call pmpi_send(smsg, count, dtype, dest, tag, comm, ierr)
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
call pmpi_send(smsg, count, dtype, dest, tag, comm)
|
|
Packit Service |
c5cf8c |
end if
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
subroutine mpi_recv_f08ts( rmsg, count, dtype, src, tag, comm, status, ierr )
|
|
Packit Service |
c5cf8c |
use :: mpi_f08, my_noname => mpi_recv_f08ts
|
|
Packit Service |
c5cf8c |
type(*), dimension(..), intent(in) :: rmsg
|
|
Packit Service |
c5cf8c |
integer, intent(in) :: count, src, tag
|
|
Packit Service |
c5cf8c |
type(MPI_Datatype), intent(in) :: dtype
|
|
Packit Service |
c5cf8c |
type(MPI_Comm), intent(in) :: comm
|
|
Packit Service |
c5cf8c |
type(MPI_Status) :: status
|
|
Packit Service |
c5cf8c |
integer, optional, intent(out) :: ierr
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
common /myinfo/ calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
integer calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
rcalls = rcalls + 1
|
|
Packit Service |
c5cf8c |
ramount = ramount + 1
|
|
Packit Service |
c5cf8c |
if (present(ierr)) then
|
|
Packit Service |
c5cf8c |
call pmpi_recv(rmsg, count, dtype, src, tag, comm, status, ierr)
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
call pmpi_recv(rmsg, count, dtype, src, tag, comm, status)
|
|
Packit Service |
c5cf8c |
end if
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
subroutine init_counts()
|
|
Packit Service |
c5cf8c |
common /myinfo/ calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
integer calls, amount, rcalls, ramount
|
|
Packit Service |
c5cf8c |
calls = 0
|
|
Packit Service |
c5cf8c |
amount = 0
|
|
Packit Service |
c5cf8c |
rcalls = 0
|
|
Packit Service |
c5cf8c |
ramount = 0
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
!
|
|
Packit Service |
c5cf8c |
subroutine mpi_pcontrol( ierr )
|
|
Packit Service |
c5cf8c |
integer ierr
|
|
Packit Service |
c5cf8c |
return
|
|
Packit Service |
c5cf8c |
end
|