1
1

fixing comm_compare for inter-communicators

This commit was SVN r2790.
Этот коммит содержится в:
Edgar Gabriel 2004-09-21 10:31:26 +00:00
родитель 2137897b31
Коммит 1ed7d779aa

Просмотреть файл

@ -106,7 +106,6 @@ int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result) {
/* we need to check whether the communicators contain /* we need to check whether the communicators contain
the same processes and in the same order */ the same processes and in the same order */
sameranks = sameorder = 1; sameranks = sameorder = 1;
rresult = MPI_SIMILAR;
grp1 = (ompi_group_t *)comp1->c_remote_group; grp1 = (ompi_group_t *)comp1->c_remote_group;
grp2 = (ompi_group_t *)comp2->c_remote_group; grp2 = (ompi_group_t *)comp2->c_remote_group;
@ -117,9 +116,9 @@ int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result) {
} }
} }
for ( i = 0; i < size1; i++ ) { for ( i = 0; i < rsize1; i++ ) {
found = 0; found = 0;
for ( j = 0; j < size2; j++ ) { for ( j = 0; j < rsize2; j++ ) {
if ( grp1->grp_proc_pointers[i] == grp2->grp_proc_pointers[j]) { if ( grp1->grp_proc_pointers[i] == grp2->grp_proc_pointers[j]) {
found = 1; found = 1;
break; break;
@ -132,22 +131,23 @@ int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result) {
} }
if ( sameranks && sameorder ) if ( sameranks && sameorder )
rresult = MPI_SIMILAR;
else if ( sameranks && !sameorder )
rresult = MPI_CONGRUENT; rresult = MPI_CONGRUENT;
else if ( sameranks && !sameorder )
rresult = MPI_SIMILAR;
else else
rresult = MPI_UNEQUAL; rresult = MPI_UNEQUAL;
} }
/* determine final results */ /* determine final results */
if ( MPI_SIMILAR == rresult ) { if ( MPI_CONGRUENT == rresult ) {
*result = lresult; *result = lresult;
} }
else if ( MPI_CONGRUENT == rresult ) { else if ( MPI_SIMILAR == rresult ) {
if ( MPI_SIMILAR == lresult ) if ( MPI_SIMILAR == lresult || MPI_CONGRUENT == lresult ) {
*result = MPI_CONGRUENT;
else
*result = MPI_SIMILAR; *result = MPI_SIMILAR;
}
else
*result = MPI_UNEQUAL;
} }
else if ( MPI_UNEQUAL == rresult ) else if ( MPI_UNEQUAL == rresult )
*result = MPI_UNEQUAL; *result = MPI_UNEQUAL;