Isn't it because you're calling MPI_Scatter() even on rank 2 which is not part of your new_comm?

Regards,
Nadia

users-bounces@open-mpi.org wrote on 03/06/2012 01:52:06 PM:

> De : Timothy Stitt <Timothy.Stitt.9@nd.edu>

> A : "users@open-mpi.org" <users@open-mpi.org>
> Date : 03/06/2012 01:52 PM
> Objet : [OMPI users] Scatter+Group Communicator Issue
> Envoyé par : users-bounces@open-mpi.org
>
> 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.
> _______________________________________________
> users mailing list
> users@open-mpi.org
>
http://www.open-mpi.org/mailman/listinfo.cgi/users