Hi
I'm testing this in a debian box, openmpi 1.3-2, compiled with gcc suite
(all from packages). After compiling and running the code I'm baffled with
the output, it seems MPI_Barrier is not working. Maybe it is such a basic
error I'm doing that I can't figure it out... See the code below, the
output it gives (one of because it's a bit erratic) and what I would
expect as output. Any help would be aprecciated...
Code was compiled with
mpif90 -O0 -g -fbounds-check -Wall test_mpi.f90 -o test_mpi
- > code - cut here ----------------------
program testmpi
use iso_fortran_env
implicit none
include 'mpif.h'
integer, parameter :: ni=16,nj=16,nk=16
integer, parameter :: stdout=output_unit, stderr=error_unit, &
stdin=input_unit
integer :: istep, idest, idx, &
ierr, my_rank, world, nprocs
! > CODE STARTS ----------------------------------------------- *
call MPI_Init(ierr)
world = MPI_COMM_WORLD
call MPI_comm_rank(world, my_rank, ierr)
call MPI_comm_size(world, nprocs, ierr)
call MPI_Barrier(world, ierr)
do istep=1, nprocs
idest=ieor(my_rank, istep)
if(my_rank.eq.0) print '("*",/)'
call flush(stdout)
call MPI_Barrier(world, ierr)
do idx=0,nprocs-1
if(idx.eq.my_rank .and. idest.lt.nprocs)then
print '("ISTEP",I2," IDX",I2," my_rank ",I5," idest ",I5)', &
istep, idx, my_rank, idest
call flush(stdout)
endif
call MPI_Barrier(world, ierr)
enddo
call MPI_Barrier(world, ierr)
enddo
call MPI_Barrier(world, ierr)
call MPI_Finalize(ierr)
end program testmpi
- < code - cut here ----------------------
- > output - cut here ----------------------
*
ISTEP 1 IDX 1 my_rank 1 idest 0
ISTEP 2 IDX 1 my_rank 1 idest 3
ISTEP 1 IDX 2 my_rank 2 idest 3
ISTEP 2 IDX 2 my_rank 2 idest 0
ISTEP 1 IDX 3 my_rank 3 idest 2
ISTEP 1 IDX 0 my_rank 0 idest 1
*
ISTEP 2 IDX 0 my_rank 0 idest 2
ISTEP 2 IDX 3 my_rank 3 idest 1
ISTEP 3 IDX 3 my_rank 3 idest 0
ISTEP 3 IDX 1 my_rank 1 idest 2
ISTEP 3 IDX 2 my_rank 2 idest 1
*
ISTEP 3 IDX 0 my_rank 0 idest 3
*
- < output - cut here ----------------------
- > expected output - cut here ----------------------
*
ISTEP 1 IDX 0 my_rank 0 idest 1
ISTEP 1 IDX 1 my_rank 1 idest 0
ISTEP 1 IDX 2 my_rank 2 idest 3
ISTEP 1 IDX 3 my_rank 3 idest 2
*
ISTEP 2 IDX 0 my_rank 0 idest 2
ISTEP 2 IDX 1 my_rank 1 idest 3
ISTEP 2 IDX 2 my_rank 2 idest 0
ISTEP 2 IDX 3 my_rank 3 idest 1
*
ISTEP 3 IDX 0 my_rank 0 idest 3
ISTEP 3 IDX 1 my_rank 1 idest 2
ISTEP 3 IDX 2 my_rank 2 idest 1
ISTEP 3 IDX 3 my_rank 3 idest 0
- < expected output - cut here ----------------------
Ricardo Reis
'Non Serviam'
PhD candidate @ Lasef
Computational Fluid Dynamics, High Performance Computing, Turbulence
http://www.lasef.ist.utl.pt
Cultural Instigator @ Rádio Zero
http://www.radiozero.pt
Keep them Flying! Ajude a/help Aero Fénix!
http://www.aeronauta.com/aero.fenix
http://www.flickr.com/photos/rreis/
|