Hi!

I have a weird problem with executing a singleton OpenMPI program, where an additional thread causes full load, while the master thread performs the actual calculations.

In contrast, executing "mpirun -np 1 [executable]" performs the same calculation at the same speed but the additional thread is idling.

In my understanding, both calculations should behave in the same way (i.e., one working thread) for a program which is simply moving some data around (mainly some MPI_BCAST and MPI_GATHER commands).

I could observe this behaviour in OpenMPI 1.10.1 with ifort 16.0.1 and gfortran 5.3.0. I could create a minimal working example, which is appended to this mail.

Am I missing something?

Best regards,
Stefan

-----

MWE: Compile this with "mpifort main.f90". When executing with "./a.out", there is thread wasting cycles, while the master thread waits for input. When executing with "mpirun -np 1 ./a.out" this thread is idling.

program main
    use mpi_f08
    implicit none

    integer :: ierror,rank

    call MPI_Init(ierror)
    call MPI_Comm_Rank(MPI_Comm_World,rank,ierror)

    ! let master thread wait on [RETURN]-key
    if (rank == 0) then
        read(*,*)
    end if

    write(*,*) rank

    call mpi_barrier(mpi_comm_world, ierror)
end program

Reply via email to