Skip to content

Deadlock in mpi_bcast using openmpi 4.1.5 from fortran #11478

Open
@pums974

Description

@pums974

Background information

What version of Open MPI are you using? (e.g., v3.0.5, v4.0.2, git branch name and hash, etc.)

openmpi-4.1.5-1

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

From archlinux extra repository or building it locally from PKGBUILD

Please describe the system on which you are running

  • Operating system/version: archlinux up to date (09 march 2023)
  • Computer hardware: dell laptop, intel processor
  • Network type:

Details of the problem

The following fortran code reach a deadlock when using multiple process

program test_mpi
    use mpi_f08
    implicit none
    character(len=10), dimension(16) :: strings
    integer :: dummy_int
    integer :: ierr

    call mpi_init(ierr)

    strings = ""

    dummy_int = 16

    ! without these two bcast, code is working properly
    call mpi_bcast(dummy_int, 1, mpi_integer, 0, MPI_COMM_WORLD, ierr)
    call mpi_bcast(dummy_int, 1, mpi_integer, 0, MPI_COMM_WORLD, ierr)

    print*, "everyone print this"
    call mpi_bcast(strings, 16*10, mpi_character, 0, MPI_COMM_WORLD, ierr)
    print*, "no one print that"

    call mpi_finalize(ierr)
end program test_mpi

Running it with one process gives the expected result

shell$ mpifort -o test_mpi test_mpi.f90 && mpirun -np 1 test_mpi
 everyone print this
 no one print that

while running it with at least 2 process result in a deadlock

shell$ mpirun -np 2 test_mpi
 everyone print this
 everyone print this

The same code compiled with openmpi-4.1.4 gives the following correct result

shell$ mpirun -np 2 test_mpi
 everyone print this
 everyone print this
 no one print that
 no one print that

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions