Newsgroups: comp.parallel.mpi
From: James Cownie <jcownie@bbn.com>
Subject: Re: New communicator question -OOPS!
Organization: BBN
Date: 24 Oct 1995 09:38:13 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <46ic65$jun@newsgate.dircon.co.uk>

impellus@ames.ucsd.edu (Tom Impelluso) wrote:
>The previous code has an type.  Here is the correct version
>which gives the same error message:
>
>
>        include "mpif.h"
>        integer stat(MPI_STATUS_SIZE), irank(3)
>        master = 0
>        idata = 1
>c       initialize, get size,rank
>        call MPI_INIT(ierr)
>        call MPI_COMM_SIZE(MPI_COMM_WORLD, numprocs, ierr)
>        call MPI_COMM_RANK(MPI_COMM_WORLD, mygid, ierr)
>c       create a global group = iwgrp
>        call MPI_COMM_GROUP(MPI_COMM_WORLD, iwgrp,ierr)
>
>c       exclude: 0,1,2; include: 3,4,5 and so on
>        irank(1) = 0
>        irank(2) = 1
>        irank(3) = 2
>        call MPI_GROUP_EXCL(iwgrp, 3, irank, isgrp, ierr)
>        call MPI_COMM_CREATE(MPI_COMM_WORLD, isgrp, isend, ierr)
>
>        if(mygid.ge.3) call MPI_COMM_RANK(isend,mysid,ierr)
>
>        if(mygid.eq.master) call MPI_SEND(idata,1,MPI_INTEGER,0,0,isend,ierr)
>
>        if(mygid.ge.3.and.mysid.eq.0) call MPI_RECV(i, 1, MPI_INTEGER, master,
>     &                                 MPI_ANY_TAG, MPI_COMM_WORLD,stat, ierr)
>
>        call MPI_FINALIZE(ierr)
>        END

The reason this is in error is that you cannot send into a communicator
of which you are not a member. You are trying to send from COMM_WORLD(0)
into a communicator which only contains COMM_WORLD(3:...)

Incidentally it is often easier to use COMM_SPLIT, COMM_DELETE rather than
the group operations.

Enjoy.
-- Jim
James Cownie
BBN UK Ltd.
jcownie@bbn.com


