1
1
openmpi/ompi/group/group.c
Edgar Gabriel 2c909383bb abstracting the group_free operation into an internal routine (required
by some other components on ompi).

This commit was SVN r7763.
2005-10-14 18:51:20 +00:00

60 строки
1.8 KiB
C

/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "group/group.h"
#include "ompi/include/constants.h"
#include "mpi.h"
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;
}
int ompi_group_translate_ranks ( ompi_group_t *group1,
int n_ranks, int *ranks1,
ompi_group_t *group2,
int *ranks2)
{
int rank, proc, proc2;
struct ompi_proc_t *proc1_pointer, *proc2_pointer;
/* 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;
}