Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
71a2d355f14abce9a55551fdb5694ea5adf6e967
[simgrid.git] / teshsuite / smpi / mpich-test / coll / bcastlog.f
1       program main
2 c     test bcast of logical
3 c     works on suns, needs mpich fix and heterogeneous test on alpha with PC
4       include 'mpif.h'
5       integer myid, numprocs, rc, ierr
6       integer errs, toterrs
7       logical boo
8
9       call MPI_INIT( ierr )
10       call MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
11       call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
12 C
13       errs = 0
14       boo = .true.
15       call MPI_BCAST(boo,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
16       if (boo .neqv. .true.) then 
17          print *, 'Did not broadcast Fortran logical (true)'
18          errs = errs + 1
19       endif
20 C
21       boo = .false.
22       call MPI_BCAST(boo,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
23       if (boo .neqv. .false.) then 
24          print *, 'Did not broadcast Fortran logical (false)'
25          errs = errs + 1
26       endif
27       call MPI_Reduce( errs, toterrs, 1, MPI_INTEGER, MPI_SUM, 
28      $                 0, MPI_COMM_WORLD, ierr )
29       if (myid .eq. 0) then
30          if (toterrs .eq. 0) then
31             print *, ' No Errors'
32          else
33             print *, ' Found ', toterrs, ' errors'
34          endif
35       endif
36       call MPI_FINALIZE(rc)
37       stop
38       end