Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Scatter+Group Communicator Issue
From: Timothy Stitt (Timothy.Stitt.9_at_[hidden])
Date: 2012-03-06 07:52:06


Hi all,

I am scratching my head over what I think should be a relatively simple group communicator operation. I am hoping some kind person can put me out of my misery and figure out what I'm doing wrong.

Basically, I am trying to scatter a set of values to a subset of process ranks (hence the need for a group communicator). When I run the sample code over 4 processes (and scattering to 3 processes), I am getting a group-communicator related error in the scatter operation:

> [stats.crc.nd.edu:29285] *** An error occurred in MPI_Scatter
> [stats.crc.nd.edu:29285] *** on communicator MPI_COMM_WORLD
> [stats.crc.nd.edu:29285] *** MPI_ERR_COMM: invalid communicator
> [stats.crc.nd.edu:29285] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
> Complete - Rank 1
> Complete - Rank 0
> Complete - Rank 3

The actual test code is below:

program scatter_bug

  use mpi

  implicit none

  integer :: ierr,my_rank,procValues(3),procRanks(3)
  integer :: in_cnt,orig_group,new_group,new_comm,out

  call MPI_INIT(ierr)
  call MPI_COMM_RANK(MPI_COMM_WORLD,my_rank,ierr)

  procRanks=(/0,1,3/)
  procValues=(/0,434,268/)
  in_cnt=3
     
  ! Create sub-communicator
  call MPI_COMM_GROUP(MPI_COMM_WORLD, orig_group, ierr)
  call MPI_Group_incl(orig_group, in_cnt, procRanks, new_group, ierr)
  call MPI_COMM_CREATE(MPI_COMM_WORLD, new_group, new_comm, ierr)
     
  call MPI_SCATTER(procValues, 1, MPI_INTEGER, out, 1, MPI_INTEGER, 0, new_comm, ierr);

  print *,"Complete - Rank", my_rank

end program scatter_bug
  
Thanks in advance for any advice you can give.

Regards.

Tim.