2004-08-04 02:06:49 +04:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-04 02:06:49 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 05:03:09 +04:00
|
|
|
#include "ompi_config.h"
|
2004-08-04 02:06:49 +04:00
|
|
|
#include "group/group.h"
|
2005-08-13 01:42:07 +04:00
|
|
|
#include "ompi/include/constants.h"
|
2004-08-04 02:06:49 +04:00
|
|
|
#include "mpi.h"
|
|
|
|
|
2005-10-14 22:51:20 +04:00
|
|
|
int ompi_group_free ( ompi_group_t **group )
|
|
|
|
{
|
|
|
|
ompi_group_t *l_group;
|
|
|
|
|
|
|
|
l_group = (ompi_group_t *) *group;
|
|
|
|
ompi_group_decrement_proc_count (l_group);
|
|
|
|
OBJ_RELEASE(l_group);
|
|
|
|
|
|
|
|
*group = MPI_GROUP_NULL;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-08-04 02:06:49 +04:00
|
|
|
int ompi_group_translate_ranks ( ompi_group_t *group1,
|
|
|
|
int n_ranks, int *ranks1,
|
|
|
|
ompi_group_t *group2,
|
|
|
|
int *ranks2)
|
|
|
|
{
|
|
|
|
int rank, proc, proc2;
|
2004-11-05 10:52:30 +03:00
|
|
|
struct ompi_proc_t *proc1_pointer, *proc2_pointer;
|
2004-08-04 02:06:49 +04:00
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
} /* end proc loop */
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|