MPI GROUP INCL Note The position of the calling process in the new group is defined by the members array. Specifically, calling process number "members[ has rank""in new group with"i ranging from 0to"count-1 The same task could also be accomplished by a similar routine, MPI GROUP EXCL If count=0, new group has the value MPI GROUP EMPTY Two groups may have identical members but in different orders by how the members array is defined
MPI_GROUP_INCL • Note: – The position of the calling process in the new group is defined by the members array. Specifically, calling process number "members[i]" has rank "i" in new_group with "i" ranging from "0" to "count - 1". – The same task could also be accomplished by a similar routine, MPI_GROUP_EXCL. – If count = 0, new_group has the value MPI_GROUP_EMPTY. – Two groups may have identical members but in different orders by how the members array is defined
MPI GROUP EXCL
MPI_GROUP_EXCL
MPI GROUP EXCL Definition of mpl group excl Used to form a new group by deleting the processes listed in specified ranks from group The mPl group eXcl routine creates a new group from an existing group and specifles member processes(by exclusion) int MPI Group excl( MP Group group, int count, int nonmembers, MPI Group *new group The function returns an int error flag
MPI_GROUP_EXCL • Definition of MPI_GROUP_EXCL – Used to form a new group by deleting the processes listed in specified ranks from group. • The MPI_GROUP_EXCL routine creates a new group from an existing group and specifies member processes (by exclusion). int MPI_Group_excl( MPI_Group group, int count, int *nonmembers, MPI_Group *new_group ) • The function returns an int error flag
MPI GROUP EXCL Variable C Type In/Out Description Name group MPL_Group Input Group handle I count Input Number of processes in nonmembers nonmembers int Output Array of size count defining process ranks to be excluded new_group MPL_Group*Output Group handle
MPI_GROUP_EXCL Variable Name C Type In/Out Description group MPI_Group Input Group handle count int Input Number of processes in nonmembers nonmembers int * Output Array of size count defining process ranks to be excluded new_group MPI_Group * Output Group handle
MPI GROUP EXCL EXample #include"mpi. h MPI_ Group group_ world, odd _group, even_group; int i, p, Neven, Nodd, nonmembers[8], ierr; MPI Comm size(MPI COMM WORLD, &p) MPI Comm group(MPI COMM WORLD, &group world) Neven =(p+1)/2, / processes of MPI COMM WORLD are divided * Nodd = p-Neven; /*into odd-and even-numbered groups * for(i=0; i<Neven; i++)f/"nonmembersare even-numbered pros*/ nonmembers[=2*i MPI Group excl(group world, Neven, nonmembers, &odd group
MPI_GROUP_EXCL • Example #include "mpi.h" MPI_Group group_world, odd_group, even_group; int i, p, Neven, Nodd, nonmembers[8], ierr; MPI_Comm_size(MPI_COMM_WORLD, &p); MPI_Comm_group(MPI_COMM_WORLD, &group_world); Neven = (p+1)/2; /* processes of MPI_COMM_WORLD are divided */ Nodd = p - Neven; /* into odd- and even-numbered groups */ for (i=0; i<Neven; i++) { /* "nonmembers" are even-numbered procs */ nonmembers[i] = 2*i; }; MPI_Group_excl(group_world, Neven, nonmembers, &odd_group);