I have a minimal example of a problem when I just run 4 processes (on a quad-core Intel Core i7 processor with 8 threads), and for some reason MPI_Init, it seems to take a very long time.
Here is my code:
1 program smear_sfs
2
3 integer, parameter :: ikind = 4
4 integer, parameter :: rkind = 8
5
6 integer(kind = ikind) :: isize, iproc, ierr
7 integer(kind = ikind) :: i, j
8
9 include "mpif.h"
10 integer(kind = ikind) :: istat(MPI_STATUS_SIZE)
11
12 print*, 'Section 1'
13
14 ! initialize mpi
15 write(*, '(a)', advance='no'), 'Calling MPI_Init ...'
16 call MPI_Init(ierr)
17 write(*, '(a)') 'done'
18 print*, 'ierr = ', ierr
19 call MPI_Barrier(MPI_COMM_WORLD, ierr)
20 call MPI_Comm_Rank(MPI_COMM_WORLD, iproc, ierr)
21 call MPI_Comm_Size(MPI_COMM_WORLD, isize, ierr)
22 do i = 0,isize
23 call MPI_Barrier(MPI_COMM_WORLD, ierr)
24 if(iproc.eq.i) write(*, '(a, i3, a)') 'rank(', iproc, ') reporting'
25 call MPI_Barrier(MPI_COMM_WORLD, ierr)
26 enddo
27
28 ! shutdown MPI
29 call MPI_Barrier(MPI_COMM_WORLD, ierr)
30 call MPI_Finalize(ierr)
31
32 end program smear_sfs
and here is the (temporary) version of the output:
Section 1
Calling MPI_Init ... Section 1
Calling MPI_Init ... Section 1
Calling MPI_Init ... Section 1
Calling MPI_Init ...done
ierr = 0
rank( 0) reporting
done
ierr = 0
rank( 1) reporting
done
ierr = 0
rank( 2) reporting
done
ierr = 0
rank( 3) reporting
real 0m45.350s
user 1m25.794s
sys 1m31.731s
The program displays the Section 1next one Calling MPI_Init ...immediately, and then hangs for a long time before printing doneand the rest of the output. For some reason, it has been hanging on for a long time MPI_Init, and I cannot understand why.
, , , - , , - ( orted.exe , ), .
Windows 8 cygwin64 MPIf90.
.