Abstract MPI_Group_compare to an OMPI function for internal use (point the MPI interface to the internal function).
Fix a typo in group_init.c This commit was SVN r26118.
Этот коммит содержится в:
родитель
a595525366
Коммит
4630c4060c
@ -11,6 +11,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -506,3 +507,73 @@ int ompi_group_intersection(ompi_group_t* group1,ompi_group_t* group2,
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int ompi_group_compare(ompi_group_t *group1,
|
||||
ompi_group_t *group2,
|
||||
int *result)
|
||||
{
|
||||
int return_value = OMPI_SUCCESS;
|
||||
int proc1, proc2, match;
|
||||
bool similar, identical;
|
||||
ompi_group_t *group1_pointer, *group2_pointer;
|
||||
ompi_proc_t *proc1_pointer, *proc2_pointer;
|
||||
|
||||
/* check for same groups */
|
||||
if( group1 == group2 ) {
|
||||
*result=MPI_IDENT;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* check to see if either is MPI_GROUP_NULL or MPI_GROUP_EMPTY */
|
||||
if( ( MPI_GROUP_EMPTY == group1 ) || ( MPI_GROUP_EMPTY == group2 ) ) {
|
||||
*result=MPI_UNEQUAL;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* get group pointers */
|
||||
group1_pointer = (ompi_group_t *)group1;
|
||||
group2_pointer = (ompi_group_t *)group2;
|
||||
|
||||
/* compare sizes */
|
||||
if( group1_pointer->grp_proc_count != group2_pointer->grp_proc_count ) {
|
||||
/* if not same size - return */
|
||||
*result=MPI_UNEQUAL;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* check for similarity */
|
||||
/* loop over group1 processes */
|
||||
similar=true;
|
||||
identical=true;
|
||||
for(proc1=0 ; proc1 < group1_pointer->grp_proc_count ; proc1++ ) {
|
||||
proc1_pointer= ompi_group_peer_lookup(group1_pointer,proc1);
|
||||
/* loop over group2 processes to find "match" */
|
||||
match=-1;
|
||||
for(proc2=0 ; proc2 < group2_pointer->grp_proc_count ; proc2++ ) {
|
||||
proc2_pointer=ompi_group_peer_lookup(group2_pointer,proc2);
|
||||
if( proc1_pointer == proc2_pointer ) {
|
||||
if(proc1 != proc2 ) {
|
||||
identical=false;
|
||||
}
|
||||
match=proc2;
|
||||
break;
|
||||
}
|
||||
} /* end proc2 loop */
|
||||
if( match== -1 ) {
|
||||
similar=false;
|
||||
identical=false;
|
||||
break;
|
||||
}
|
||||
} /* end proc1 loop */
|
||||
|
||||
/* set comparison result */
|
||||
if( identical ) {
|
||||
*result=MPI_IDENT;
|
||||
} else if( similar ) {
|
||||
*result=MPI_SIMILAR;
|
||||
} else {
|
||||
*result=MPI_UNEQUAL;
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -233,6 +234,12 @@ OMPI_DECLSPEC int ompi_group_translate_ranks ( ompi_group_t *group1,
|
||||
ompi_group_t *group2,
|
||||
int *ranks2);
|
||||
|
||||
/**
|
||||
* Abstracting MPI_Group_compare to an ompi function for internal use
|
||||
*/
|
||||
OMPI_DECLSPEC int ompi_group_compare(ompi_group_t *group1,
|
||||
ompi_group_t *group2,
|
||||
int *result);
|
||||
|
||||
/**
|
||||
* Abstracting MPI_Group_free, since it is required by some internal functions...
|
||||
|
@ -13,6 +13,7 @@
|
||||
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -321,7 +322,7 @@ int ompi_group_init(void)
|
||||
ompi_mpi_group_null.group.grp_flags |= OMPI_GROUP_DENSE;
|
||||
ompi_mpi_group_null.group.grp_flags |= OMPI_GROUP_INTRINSIC;
|
||||
|
||||
/* add MPI_GROUP_EMPTRY to table */
|
||||
/* add MPI_GROUP_EMPTY to table */
|
||||
OBJ_CONSTRUCT(&ompi_mpi_group_empty, ompi_group_t);
|
||||
ompi_mpi_group_empty.group.grp_proc_count = 0;
|
||||
ompi_mpi_group_empty.group.grp_my_rank = MPI_UNDEFINED;
|
||||
|
@ -11,6 +11,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -39,17 +40,7 @@ static const char FUNC_NAME[] = "MPI_Group_compare";
|
||||
|
||||
|
||||
int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result) {
|
||||
|
||||
/* local variables */
|
||||
int return_value, proc1, proc2, match;
|
||||
bool similar, identical;
|
||||
ompi_group_t *group1_pointer, *group2_pointer;
|
||||
ompi_proc_t *proc1_pointer, *proc2_pointer;
|
||||
|
||||
OPAL_CR_NOOP_PROGRESS();
|
||||
|
||||
/* initialization */
|
||||
return_value=MPI_SUCCESS;
|
||||
int return_value = MPI_SUCCESS;
|
||||
|
||||
/* check for errors */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
@ -65,62 +56,9 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result) {
|
||||
}
|
||||
}
|
||||
|
||||
/* check for same groups */
|
||||
if( group1 == group2 ) {
|
||||
*result=MPI_IDENT;
|
||||
return return_value;
|
||||
}
|
||||
OPAL_CR_NOOP_PROGRESS();
|
||||
|
||||
/* check to see if either is MPI_GROUP_NULL or MPI_GROUP_EMPTY */
|
||||
if( ( MPI_GROUP_EMPTY == group1 ) || ( MPI_GROUP_EMPTY == group2 ) ) {
|
||||
*result=MPI_UNEQUAL;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* get group pointers */
|
||||
group1_pointer = (ompi_group_t *)group1;
|
||||
group2_pointer = (ompi_group_t *)group2;
|
||||
|
||||
/* compare sizes */
|
||||
if( group1_pointer->grp_proc_count != group2_pointer->grp_proc_count ) {
|
||||
/* if not same size - return */
|
||||
*result=MPI_UNEQUAL;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* check for similarity */
|
||||
/* loop over group1 processes */
|
||||
similar=true;
|
||||
identical=true;
|
||||
for(proc1=0 ; proc1 < group1_pointer->grp_proc_count ; proc1++ ) {
|
||||
proc1_pointer= ompi_group_peer_lookup(group1_pointer,proc1);
|
||||
/* loop over group2 processes to find "match" */
|
||||
match=-1;
|
||||
for(proc2=0 ; proc2 < group2_pointer->grp_proc_count ; proc2++ ) {
|
||||
proc2_pointer=ompi_group_peer_lookup(group2_pointer,proc2);
|
||||
if( proc1_pointer == proc2_pointer ) {
|
||||
if(proc1 != proc2 ) {
|
||||
identical=false;
|
||||
}
|
||||
match=proc2;
|
||||
break;
|
||||
}
|
||||
} /* end proc2 loop */
|
||||
if( match== -1 ) {
|
||||
similar=false;
|
||||
identical=false;
|
||||
break;
|
||||
}
|
||||
} /* end proc1 loop */
|
||||
|
||||
/* set comparison result */
|
||||
if( identical ) {
|
||||
*result=MPI_IDENT;
|
||||
} else if( similar ) {
|
||||
*result=MPI_SIMILAR;
|
||||
} else {
|
||||
*result=MPI_UNEQUAL;
|
||||
}
|
||||
return_value = ompi_group_compare((ompi_group_t *)group1, (ompi_group_t *)group2, result);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user