11 parameter(wastesz = 100)
12 integer i, iam, np, ierr
13 integer mcom, wgrp, mgrp
14 integer irank(nproc), stat(mpi_status_size)
15 double precision wastespc(wastesz)
18 call mpi_comm_size(mpi_comm_world, np, ierr)
19 if (np .lt. nproc)
then
20 print*,
'Not enough processes to run sanity check'
21 call mpi_abort(mpi_comm_world, -1, ierr)
35 call mpi_comm_group(mpi_comm_world, wgrp, ierr)
36 call mpi_group_incl(wgrp, nproc, irank, mgrp, ierr)
37 call mpi_comm_create(mpi_comm_world, mgrp, mcom, ierr)
38 call mpi_group_free(mgrp, ierr)
42 if (mcom .ne. mpi_comm_null)
then
43 call mpi_comm_rank(mcom, iam, ierr)
48 if (mod(iam, 2) .ne. 0)
then
49 call mpi_recv(i, 1, mpi_integer, mod(nproc+iam-1, nproc),
50 & 0, mcom, stat, ierr)
51 call mpi_send(iam, 1, mpi_integer, mod(iam+1, nproc),
54 call mpi_send(iam, 1, mpi_integer, mod(iam+1, nproc),
56 call mpi_recv(i, 1, mpi_integer, mod(nproc+iam-1, nproc),
57 & 0, mcom, stat, ierr)
62 if (i .ne. mod(nproc+iam-1, nproc))
then
63 print*,
'Communication does not seem to work properly!!'
64 call mpi_abort(mpi_comm_world, -1, ierr)
68 print*,iam,
' F77 MPI sanity test passed.'
69 call mpi_finalize(ierr)