1
1
This commit was SVN r789.
Этот коммит содержится в:
Rich Graham 2004-02-13 19:59:34 +00:00
родитель a9f66e57cb
Коммит 3a36fb030b
2 изменённых файлов: 63 добавлений и 2 удалений

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

@ -38,6 +38,9 @@ typedef enum { false, true } bool;
*/
#define LAM_HAVE_THREADS (LAM_HAVE_SOLARIS_THREADS || LAM_HAVE_POSIX_THREADS)
/* parameter indicating if to check MPI arguments */
extern bool lam_mpi_param_check;
/*
* Do we have <stdint.h>?
*/

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

@ -6,12 +6,70 @@
#include "mpi.h"
#include "mpi/interface/c/bindings.h"
#include "mpi/group/group.h"
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
#pragma weak MPI_Group_incl = PMPI_Group_incl
#endif
int MPI_Group_incl(MPI_Group group, int n, int *ranks,
MPI_Group *newgroup) {
int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
{
/* local variables */
int return_value,proc,cnt;
lam_group_t *group_pointer, *new_group_pointer;
return_value = MPI_SUCCESS;
group_pointer = (lam_group_t *)group;
if( MPI_PARAM_CHECK ) {
/* including anything of the empty group is still the empty group */
if ((group == MPI_GROUP_EMPTY) || (ranks == 0)) {
*new_group = MPI_GROUP_EMPTY;
return return_value;
}
/* verify that group is valid group */
if ( NULL == group ) {
return MPI_ERR_GROUP;
}
/* check that new group is no larger than old group */
if (ranks > group_pointer->grp_proc_count) {
return MPI_ERR_RANK;
}
} /* end if( MPI_CHECK_ARGS) */
/* get new group struct */
new_group_pointer=group_allocate(n);
if( NULL == new_group_pointer ) {
return MPI_ERR_GROUP;
}
/* put group elements in the list */
for (proc = 0; proc < n; proc++) {
if ((ranks[proc] < 0) ||
(ranks[proc] >= group_pointer->grp_proc_count)){
return MPI_ERR_RANK;
}
new_group_pointer->grp_proc_pointers[proc] =
group_pointer->grp_proc_pointers[ranks[proc]];
} /* end proc loop */
/* find my rank */
new_group_pointer->grp_my_rank = MPI_PROC_NULL;
if( MPI_PROC_NULL != group_pointer->grp_my_rank) {
for ( proc=0 ; proc < n ; proc++ ){
if( new_group_pointer->grp_proc_pointers[proc] ==
group_pointer->grp_proc_pointers
[group_pointer->grp_my_rank]){
new_group_pointer->grp_my_rank = proc;
}
}
}
return MPI_SUCCESS;
}