1
1

fixed the MPI_Translate_ranks issues reported earlier, where a rank of

MPI_PROC_NULL translates to MPI_PROC_NULL, and an MPI_GROUP_EMPTY as one of
the groups doesn't cause a segmentation fault, but returns MPI_UNDEFINED for
all ranks to be translated.

This commit was SVN r12233.
Этот коммит содержится в:
Mohamad Chaarawi 2006-10-20 19:13:49 +00:00
родитель 28bf4d85ab
Коммит 08a9b6458c

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

@ -43,20 +43,32 @@ int ompi_group_translate_ranks ( ompi_group_t *group1,
int rank, proc, proc2;
struct ompi_proc_t *proc1_pointer, *proc2_pointer;
if ( group1 == MPI_GROUP_EMPTY || group2 == MPI_GROUP_EMPTY) {
for (proc = 0; proc < n_ranks ; proc++) {
ranks2[proc] = MPI_UNDEFINED;
}
return MPI_SUCCESS;
}
/* loop over all ranks */
for (proc = 0; proc < n_ranks; proc++) {
rank=ranks1[proc];
proc1_pointer=group1->grp_proc_pointers[rank];
/* initialize to no "match" */
ranks2[proc] = MPI_UNDEFINED;
for (proc2 = 0; proc2 < group2->grp_proc_count; proc2++)
{
proc2_pointer=group2->grp_proc_pointers[proc2];
if ( proc1_pointer == proc2_pointer) {
ranks2[proc] = proc2;
break;
}
} /* end proc2 loop */
if (rank == MPI_PROC_NULL) {
ranks2[proc] = MPI_PROC_NULL;
}
else {
proc1_pointer=group1->grp_proc_pointers[rank];
/* initialize to no "match" */
ranks2[proc] = MPI_UNDEFINED;
for (proc2 = 0; proc2 < group2->grp_proc_count; proc2++)
{
proc2_pointer=group2->grp_proc_pointers[proc2];
if ( proc1_pointer == proc2_pointer) {
ranks2[proc] = proc2;
break;
}
} /* end proc2 loop */
}
} /* end proc loop */
return MPI_SUCCESS;