diff --git a/src/group/mpi_set_group_rank.c b/src/group/mpi_set_group_rank.c index ca33e29447..01dd70fb3b 100644 --- a/src/group/mpi_set_group_rank.c +++ b/src/group/mpi_set_group_rank.c @@ -14,7 +14,7 @@ void lam_set_group_rank(lam_group_t *group, lam_proc_t *proc_pointer) * in this group */ group->grp_my_rank = MPI_PROC_NULL; - if( MPI_PROC_NULL != proc_pointer ) { + if( NULL != proc_pointer ) { /* loop over all procs in the group */ for ( proc=0 ; proc < group->grp_proc_count ; proc++ ){ /* check and see if this proc pointer matches proc_pointer diff --git a/src/mpi/c/group_f2c.c b/src/mpi/c/group_f2c.c index 5a08826c3e..b7115c611e 100644 --- a/src/mpi/c/group_f2c.c +++ b/src/mpi/c/group_f2c.c @@ -1,9 +1,8 @@ /* * $HEADERS$ */ -#include "lam_config.h" -#include +#include "lam_config.h" #include "mpi.h" #include "mpi/c/bindings.h" #include "group/group.h" @@ -12,24 +11,25 @@ #pragma weak MPI_Group_f2c = PMPI_Group_f2c #endif -MPI_Group MPI_Group_f2c(MPI_Fint group_f) { - /* local variable */ +MPI_Group MPI_Group_f2c(MPI_Fint group_f) +{ + /* local variables */ lam_group_t *group_c; int group_index; - group_index=(int)group_f; + group_index = (int) group_f; /* error checks */ - if( MPI_PARAM_CHECK ) { - if( 0 > group_index ) { + if (MPI_PARAM_CHECK) { + if (0 > group_index) { return NULL; } - if( group_index >= lam_group_f_to_c_table->size ) { + if (group_index >= lam_group_f_to_c_table->size) { return NULL; } } - group_c=lam_group_f_to_c_table->addr[group_index]; + group_c = lam_group_f_to_c_table->addr[group_index]; return (MPI_Group) group_c; } diff --git a/src/mpi/c/group_union.c b/src/mpi/c/group_union.c index 428c4702ac..697db6ba00 100644 --- a/src/mpi/c/group_union.c +++ b/src/mpi/c/group_union.c @@ -21,32 +21,32 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group) lam_proc_t *proc1_pointer, *proc2_pointer, *my_proc_pointer; /* check for errors */ - if( MPI_PARAM_CHECK ) { - if( ( MPI_GROUP_NULL == group1 ) || ( MPI_GROUP_NULL == group2 ) ){ + if (MPI_PARAM_CHECK) { + if ((MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2)) { return MPI_ERR_GROUP; } } - return_value=MPI_SUCCESS; - group1_pointer= (lam_group_t *) group1; - group2_pointer= (lam_group_t *) group2; + return_value = MPI_SUCCESS; + group1_pointer = (lam_group_t *) group1; + group2_pointer = (lam_group_t *) group2; /* * form union */ /* get new group size */ - new_group_size=group1_pointer->grp_proc_count; + new_group_size = group1_pointer->grp_proc_count; /* check group2 elements to see if they need to be included in the list */ for (proc2 = 0; proc2 < group2_pointer->grp_proc_count; proc2++) { - proc2_pointer=group2_pointer->grp_proc_pointers[proc2]; + proc2_pointer = group2_pointer->grp_proc_pointers[proc2]; /* check to see if this proc2 is alread in the group */ found_in_group = 0; for (proc1 = 0; proc1 < group1_pointer->grp_proc_count; proc1++) { - proc1_pointer=group1_pointer->grp_proc_pointers[proc1]; - if (proc2_pointer == proc2_pointer ) { + proc1_pointer = group1_pointer->grp_proc_pointers[proc1]; + if (proc2_pointer == proc2_pointer) { /* proc2 is in group1 - don't double count */ found_in_group = 1; break; @@ -60,8 +60,8 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group) } /* end proc loop */ /* get new group struct */ - new_group_pointer=group_allocate(new_group_size); - if( NULL == new_group_pointer ) { + new_group_pointer = group_allocate(new_group_size); + if (NULL == new_group_pointer) { return MPI_ERR_GROUP; } @@ -72,17 +72,17 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group) new_group_pointer->grp_proc_pointers[proc1] = group1_pointer->grp_proc_pointers[proc1]; } - cnt=group1_pointer->grp_proc_count; + cnt = group1_pointer->grp_proc_count; /* check group2 elements to see if they need to be included in the list */ for (proc2 = 0; proc2 < group2_pointer->grp_proc_count; proc2++) { - proc2_pointer=group2_pointer->grp_proc_pointers[proc2]; + proc2_pointer = group2_pointer->grp_proc_pointers[proc2]; /* check to see if this proc2 is alread in the group */ found_in_group = 0; for (proc1 = 0; proc1 < group1_pointer->grp_proc_count; proc1++) { - proc1_pointer=group1_pointer->grp_proc_pointers[proc1]; - if (proc2_pointer == proc2_pointer ) { + proc1_pointer = group1_pointer->grp_proc_pointers[proc1]; + if (proc2_pointer == proc2_pointer) { /* proc2 is in group1 - don't double count */ found_in_group = 1; break; @@ -101,15 +101,17 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group) lam_group_increment_proc_count(new_group_pointer); /* find my rank */ - my_group_rank=group1_pointer->grp_my_rank; - my_proc_pointer=group1_pointer->grp_proc_pointers[my_group_rank]; - if( MPI_PROC_NULL == my_proc_pointer ) { - my_group_rank=group2_pointer->grp_my_rank; - my_proc_pointer=group2_pointer->grp_proc_pointers[my_group_rank]; + my_group_rank = group1_pointer->grp_my_rank; + if (MPI_PROC_NULL == my_group_rank) { + my_group_rank = group2_pointer->grp_my_rank; + my_proc_pointer = group2_pointer->grp_proc_pointers[my_group_rank]; + } else { + my_proc_pointer = group1_pointer->grp_proc_pointers[my_group_rank]; } - lam_set_group_rank(new_group_pointer,my_proc_pointer); - *new_group = (MPI_Group)new_group_pointer; + lam_set_group_rank(new_group_pointer, my_proc_pointer); + + *new_group = (MPI_Group) new_group_pointer; /* return */ return return_value; diff --git a/src/mpi/f77/group_compare_f.c b/src/mpi/f77/group_compare_f.c index cfd130258b..4a9d178490 100644 --- a/src/mpi/f77/group_compare_f.c +++ b/src/mpi/f77/group_compare_f.c @@ -4,8 +4,6 @@ #include "lam_config.h" -#include - #include "mpi.h" #include "mpi/f77/bindings.h" #include "group/group.h" @@ -18,47 +16,48 @@ #pragma weak pmpi_group_compare__ = mpi_group_compare_f #elif LAM_PROFILE_LAYER LAM_GENERATE_F77_BINDINGS (PMPI_GROUP_COMPARE, - pmpi_group_compare, - pmpi_group_compare_, - pmpi_group_compare__, - pmpi_group_compare_f, - (MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *result, MPI_Fint *ierror), - (group1,group2,result,ierror)) + pmpi_group_compare, + pmpi_group_compare_, + pmpi_group_compare__, + pmpi_group_compare_f, + (MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror), + (group1,group2,result,ierror)) #endif #if LAM_HAVE_WEAK_SYMBOLS -#pragma weak MPI_INIT = mpi_group_compare_f -#pragma weak mpi_init = mpi_group_compare_f -#pragma weak mpi_init_ = mpi_group_compare_f -#pragma weak mpi_init__ = mpi_group_compare_f +#pragma weak MPI_GROUP_COMPARE = mpi_group_compare_f +#pragma weak mpi_group_compare = mpi_group_compare_f +#pragma weak mpi_group_compare_ = mpi_group_compare_f +#pragma weak mpi_group_compare__ = mpi_group_compare_f #endif #if ! LAM_PROFILE_LAYER && ! LAM_HAVE_WEAK_SYMBOLS -LAM_GENERATE_F77_BINDINGS (PMPI_GROUP_COMPARE, - pmpi_group_compare, - pmpi_group_compare_, - pmpi_group_compare__, - pmpi_group_compare_f, - (MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *result, MPI_Fint *ierror), - (group1,group2,result,ierror)) +LAM_GENERATE_F77_BINDINGS (MPI_GROUP_COMPARE, + mpi_group_compare, + mpi_group_compare_, + mpi_group_compare__, + mpi_group_compare_f, + (MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror), + (group1,group2,result,ierror)) #endif -void -mpi_group_compare_f(MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *result, - MPI_Fint *ierror) +void mpi_group_compare_f(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror) { /* local variables */ int c_result, c_error; lam_group_t *c_group1, *c_group2; /* make the fortran to c representation conversion */ - c_group1=group_f2c(*group1); - c_group2=group_f2c(*group2); + c_group1 = MPI_Group_f2c(*group1); + c_group2 = MPI_Group_f2c(*group2); c_error = MPI_Group_compare(c_group1, c_group2, &c_result); /* translate the results from c to fortran */ - *ierror=(MPI_Fint)c_error; - *result=(MPI_Fint)c_result; + *ierror = (MPI_Fint) c_error; + *result = (MPI_Fint) c_result; } diff --git a/src/mpi/f77/profile/defines.h b/src/mpi/f77/profile/defines.h index 42879d9423..ee51661b8f 100644 --- a/src/mpi/f77/profile/defines.h +++ b/src/mpi/f77/profile/defines.h @@ -7,6 +7,7 @@ #define mpi_comm_set_name_f pmpi_comm_set_name_f #define mpi_comm_get_name_f pmpi_comm_get_name_f +#define mpi_group_compare_f pmpi_group_compare_f #define mpi_init_f pmpi_init_f #define mpi_finalize_f pmpi_finalize_f #define mpi_alloc_mem_f pmpi_alloc_mem_f diff --git a/src/mpi/f77/profile/prototypes_pmpi.h b/src/mpi/f77/profile/prototypes_pmpi.h index 312d5b2114..a24b92e8df 100644 --- a/src/mpi/f77/profile/prototypes_pmpi.h +++ b/src/mpi/f77/profile/prototypes_pmpi.h @@ -27,6 +27,8 @@ void pmpi_comm_set_name_f(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint void pmpi_init_f(MPI_Fint *ierror); void pmpi_finalize_f(MPI_Fint *ierror); void pmpi_free_mem_f(char *baseptr, MPI_Fint *ierr); +void pmpi_group_compare_f(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * First, all caps. @@ -38,6 +40,8 @@ void PMPI_COMM_SET_NAME(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint c void PMPI_INIT(MPI_Fint *ierror); void PMPI_FINALIZE(MPI_Fint *ierror); void PMPI_FREE_MEM(char *baseptr, MPI_Fint *ierr); +void PMPI_GROUP_COMPARE(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * Second, all lower case. @@ -49,6 +53,8 @@ void pmpi_comm_set_name(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint c void pmpi_init(MPI_Fint *ierror); void pmpi_finalize(MPI_Fint *ierror); void pmpi_free_mem(char *baseptr, MPI_Fint *ierr); +void pmpi_group_compare(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * Third, one trailing underscore. @@ -60,6 +66,8 @@ void pmpi_comm_set_name_(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint void pmpi_init_(MPI_Fint *ierror); void pmpi_finalize_(MPI_Fint *ierror); void pmpi_free_mem_(char *baseptr, MPI_Fint *ierr); +void pmpi_group_compare_(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * Fourth, two trailing underscores. @@ -71,5 +79,7 @@ void pmpi_comm_set_name__(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint void pmpi_init__(MPI_Fint *ierror); void pmpi_finalize__(MPI_Fint *ierror); void pmpi_free_mem__(char *baseptr, MPI_Fint *ierr); +void pmpi_group_compare__(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); #endif /* PROTOTYPE_H */ diff --git a/src/mpi/f77/prototypes_mpi.h b/src/mpi/f77/prototypes_mpi.h index 8550e154c1..134e615405 100644 --- a/src/mpi/f77/prototypes_mpi.h +++ b/src/mpi/f77/prototypes_mpi.h @@ -28,6 +28,8 @@ void mpi_comm_set_name_f(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint void mpi_init_f(MPI_Fint *ierror); void mpi_finalize_f(MPI_Fint *ierror); void mpi_free_mem_f(char *baseptr, MPI_Fint *ierr); +void mpi_group_compare_f(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); #endif /* @@ -40,6 +42,8 @@ void MPI_COMM_SET_NAME(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint ch void MPI_INIT(MPI_Fint *ierror); void MPI_FINALIZE(MPI_Fint *ierror); void MPI_FREE_MEM(char *baseptr, MPI_Fint *ierr); +void MPI_GROUP_COMPARE(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * Second, all lower case. @@ -51,6 +55,8 @@ void mpi_comm_set_name(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint ch void mpi_init(MPI_Fint *ierror); void mpi_finalize(MPI_Fint *ierror); void mpi_free_mem(char *baseptr, MPI_Fint *ierr); +void mpi_group_compare(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * Third, one trailing underscore. @@ -62,6 +68,8 @@ void mpi_comm_set_name_(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint c void mpi_init_(MPI_Fint *ierror); void mpi_finalize_(MPI_Fint *ierror); void mpi_free_mem_(char *baseptr, MPI_Fint *ierr); +void mpi_group_compare_(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); /* * Fourth, two trailing underscores. @@ -73,5 +81,7 @@ void mpi_comm_set_name__(MPI_Fint *comm, char *name, MPI_Fint *ierror, MPI_Fint void mpi_init__(MPI_Fint *ierror); void mpi_finalize__(MPI_Fint *ierror); void mpi_free_mem__(char *baseptr, MPI_Fint *ierr); +void mpi_group_compare__(MPI_Fint *group1, MPI_Fint *group2, + MPI_Fint *result, MPI_Fint *ierror); #endif /* PROTOTYPE_H */ diff --git a/src/threads/thread.c b/src/threads/thread.c index ac8bc2fe3e..92aaaf817b 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -9,7 +9,7 @@ static void lam_thread_construct(lam_thread_t* t) { t->t_run = 0; - t->t_handle = -1; + t->t_handle = (pthread_t) -1; }