The third argument to MPI_Group_incl() and MPI_Group_excl() is supposed to be 
an array, not an integer constant.  Have a look at the man page for these two 
functions.

On Aug 16, 2012, at 3:30 PM, maryam moein wrote:

> I'm so sorry, Actually my problem is in another mpi program which is "sudoku 
> game". But because of the fact I got inclusion error whenever I use 
> MPI_Group_incl. For simplicity, I decided to put a simple program with 
> MPI_Group_incl. Please take a look at the following lines of code, and please 
> note that in this program I'm supposed to work just with 82 processes and I 
> tried to divide the processes into 2 groups, namely "master" and "workers", 
> master for "rank 0" process and workers for rest of processes(81 processes). 
> 
> Here is the codes:
> 
> #include <string.h>
> #include "mpi.h"
> #include <stdio.h>
> #include <unistd.h>
> #include <time.h>
> #include <stdlib.h>
> 
> int main(int argc, char *argv[])
> {
> 
>         //Initializing the MPI world, rank, and size
>        int  size,rank,m,w,i;
>        MPI_Group group,master,workers;
>        MPI_Comm comm_world, comm_workers, comm_master;
>        MPI_Status status;
>         MPI_Request request;
>         MPI_Init(&argc, &argv);
>          MPI_Comm_size(MPI_COMM_WORLD, &size);
>          MPI_Comm_rank(MPI_COMM_WORLD, &rank);
>           if (size != 82 ){
>                 printf("Please run with 82 processors.\n");
>                 fflush(stdout);
>                 MPI_Finalize();
>                 exit(1);
>             }
>     comm_world = MPI_COMM_WORLD;
>     MPI_Comm_group(comm_world, &group);
>     MPI_Group_incl(group, 1, 0 , &master);
>     MPI_Group_excl(group, 1, 0, &workers);
>     MPI_Comm_create(comm_world, master, &comm_master);
>     MPI_Comm_create(comm_world, workers, &comm_workers);
>     MPI_Finalize();
> }
> 
> From: Jeff Squyres <jsquy...@cisco.com>
> To: Open MPI Users <us...@open-mpi.org> 
> Cc: maryam moein <maryam_moein2...@yahoo.com> 
> Sent: Thursday, August 16, 2012 7:41 PM
> Subject: Re: [OMPI users] mpi_group_incl erros
> 
> Further, if Neven is greater than 3, then you've got uninitialized values in 
> the members array.  That could be causing Open MPI to say "there's a bad rank 
> number in there!", for example, if members[3] is randomly initialized to 1234.
> 
> 
> On Aug 16, 2012, at 10:01 AM, Ralph Castain wrote:
> 
> > Well, one thing immediately leaps to the eye. You compute Neven based on 
> > the number of procs in the job, which you set when executing mpirun. 
> > However, the number of members you put in your group is fixed. Then you 
> > pass Neven to the MPI_Group call as the parameter telling it how many 
> > entries are in your member array!
> > 
> > On Aug 16, 2012, at 5:07 AM, maryam moein <maryam_moein2...@yahoo.com> 
> > wrote:
> > 
> >> I'm new memeber in this weblog, and I should deliver my assignment as soon 
> >> as possible, but I have a big problem that I can't solve it. Please help 
> >> me. In MPI I should divide my group into two groups. But all the time when 
> >> I want to run a program I got error about mpi_group_incl. This is my 
> >> error: 
> >> 
> >> [ubuntu:3346] *** An error occurred in MPI_Group_incl
> >> [ubuntu:3346] *** on communicator MPI_COMM_WORLD
> >> [ubuntu:3346] *** MPI_ERR_RANK: invalid rank
> >> [ubuntu:3346] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
> >> --------------------------------------------------------------------------
> >> mpiexec has exited due to process rank 0 with PID 3345 on
> >> node ubuntu exiting without calling "finalize". This may
> >> have caused other processes in the application to be
> >> terminated by signals sent by mpiexec (as reported here).
> >> 
> >> 
> >> I should mention that I run this program with diffrent number of process 
> >> but I got same errors. In below you can find my c program.
> >> 
> >>  #include <stdio.h>
> >> #include "mpi.h"
> >> #include <unistd.h>
> >> #include <time.h>
> >> #include <stdlib.h>
> >> #include <string.h>
> >> void main(int argc, char *argv[]) 
> >> {
> >>      int Iam, p;
> >>      int Neven, Nodd, members[6], even_rank, odd_rank;
> >>      MPI_Group group_world, even_group, odd_group;
> >> /* Starts MPI processes ... */
> >>      MPI_Init(&argc, &argv);                          /* starts MPI */
> >>      MPI_Comm_rank(MPI_COMM_WORLD, &Iam);  /* get current process id */
> >>      MPI_Comm_size(MPI_COMM_WORLD, &p);    /* get number of processes */
> >>      Neven = (p + 1)/2;    /* All processes of MPI_COMM_WORLD are divided 
> >> */
> >>      Nodd = p - Neven;      /* into 2 groups, odd- and even-numbered 
> >> groups */
> >>      members[0] = 2;
> >>      members[1] = 0;
> >>      members[2] = 4;
> >>      MPI_Comm_group(MPI_COMM_WORLD, &group_world);
> >>      MPI_Group_incl(group_world, Neven, members, &even_group);
> >>      MPI_Group_excl(group_world, Neven, members,  &odd_group);
> >> 
> >>      MPI_Barrier(MPI_COMM_WORLD);
> >>      if(Iam == 0) {
> >>        printf("MPI_Group_incl/excl Usage Example\n");
> >>        printf("\n");
> >>        printf("Number of processes is %d\n", p);
> >>        printf("Number of odd processes is %d\n", Nodd);
> >>        printf("Number of even processes is %d\n", Neven);
> >>        printf("\n");
> >>        printf("    Iam    even      odd\n");
> >>      }
> >>      MPI_Barrier(MPI_COMM_WORLD);
> >> 
> >>      MPI_Group_rank(even_group, &even_rank);
> >>      MPI_Group_rank( odd_group,  &odd_rank);
> >>      printf("%d %d %d\n",Iam, even_rank, odd_rank);
> >> 
> >>      MPI_Finalize();                  /* let MPI finish up ...  */
> >> }    
> >> 
> >> _______________________________________________
> >> users mailing list
> >> us...@open-mpi.org
> >> http://www.open-mpi.org/mailman/listinfo.cgi/users
> > 
> > _______________________________________________
> > users mailing list
> > us...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
> 
> 
> -- 
> Jeff Squyres
> jsquy...@cisco.com
> For corporate legal information go to: 
> http://www.cisco.com/web/about/doing_business/legal/cri/
> 
> 
> 


-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to