abstracting group_translate_ranks to an ompi function for internal use.
Sorry, everybody will have to rerun autogen.sh, since I added a file ... This commit was SVN r1854.
Этот коммит содержится в:
родитель
d649161279
Коммит
435ce5f5e6
@ -14,6 +14,7 @@ headers = \
|
|||||||
|
|
||||||
libgroup_la_SOURCES = \
|
libgroup_la_SOURCES = \
|
||||||
$(headers) \
|
$(headers) \
|
||||||
|
group.c \
|
||||||
mpi_group_init.c \
|
mpi_group_init.c \
|
||||||
mpi_set_group_rank.c
|
mpi_set_group_rank.c
|
||||||
|
|
||||||
|
35
src/group/group.c
Обычный файл
35
src/group/group.c
Обычный файл
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "group/group.h"
|
||||||
|
#include "include/constants.h"
|
||||||
|
#include "mpi.h"
|
||||||
|
|
||||||
|
|
||||||
|
int ompi_group_translate_ranks ( ompi_group_t *group1,
|
||||||
|
int n_ranks, int *ranks1,
|
||||||
|
ompi_group_t *group2,
|
||||||
|
int *ranks2)
|
||||||
|
{
|
||||||
|
int rank, proc, proc2;
|
||||||
|
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;
|
||||||
|
}
|
@ -122,4 +122,13 @@ static inline int ompi_group_rank(ompi_group_t *group)
|
|||||||
*/
|
*/
|
||||||
void ompi_set_group_rank(ompi_group_t *group, ompi_proc_t *proc_pointer);
|
void ompi_set_group_rank(ompi_group_t *group, ompi_proc_t *proc_pointer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstracting MPI_Group_translate_ranks to an ompi function for internal use
|
||||||
|
*/
|
||||||
|
int ompi_group_translate_ranks ( ompi_group_t *group1,
|
||||||
|
int n_ranks, int *ranks1,
|
||||||
|
ompi_group_t *group2,
|
||||||
|
int *ranks2);
|
||||||
|
|
||||||
|
|
||||||
#endif /* OMPI_GROUP_H */
|
#endif /* OMPI_GROUP_H */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user