add MPI error handling.
This commit was SVN r952.
Этот коммит содержится в:
родитель
b3d4735fc2
Коммит
c6f6c52f5b
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_c2f = PMPI_Group_c2f
|
||||
@ -20,8 +22,10 @@ MPI_Fint MPI_Group_c2f(MPI_Group group) {
|
||||
/* error checking */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
/* check for MPI_GROUP_NULL */
|
||||
if( NULL == group ) {
|
||||
return (MPI_Fint) MPI_ERR_GROUP;
|
||||
if( (NULL == group) ) {
|
||||
return (MPI_Fint)
|
||||
LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_c2f");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_compare = PMPI_Group_compare
|
||||
@ -25,8 +27,10 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result) {
|
||||
|
||||
/* check for errors */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if( ( MPI_GROUP_NULL == group1 ) || ( MPI_GROUP_NULL == group2 ) ){
|
||||
return MPI_ERR_GROUP;
|
||||
if( ( MPI_GROUP_NULL == group1 ) || ( MPI_GROUP_NULL == group2 ) ||
|
||||
(NULL == group1) || (NULL==group2) ){
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_compare");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_difference = PMPI_Group_difference
|
||||
@ -16,20 +18,21 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
|
||||
MPI_Group *new_group) {
|
||||
|
||||
/* local varibles */
|
||||
int return_value, new_group_size, proc1, proc2, found_in_group2, cnt;
|
||||
int new_group_size, proc1, proc2, found_in_group2, cnt;
|
||||
int my_group_rank;
|
||||
lam_group_t *group1_pointer, *group2_pointer, *new_group_pointer;
|
||||
lam_proc_t *proc1_pointer, *proc2_pointer, *my_proc_pointer;
|
||||
|
||||
/* error checking */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group1) ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
|
||||
(NULL == group1) || (NULL == group2) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_difference");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return_value=MPI_SUCCESS;
|
||||
group1_pointer=(lam_group_t *)group1;
|
||||
group2_pointer=(lam_group_t *)group2;
|
||||
|
||||
@ -60,7 +63,8 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
|
||||
/* allocate a new lam_group_t structure */
|
||||
new_group_pointer=lam_group_allocate(new_group_size);
|
||||
if( NULL == new_group_pointer ) {
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_difference - II");
|
||||
}
|
||||
|
||||
/* fill in group list */
|
||||
@ -96,5 +100,5 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
|
||||
|
||||
*new_group = (MPI_Group)new_group_pointer;
|
||||
|
||||
return return_value;
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_excl = PMPI_Group_excl
|
||||
@ -25,13 +27,16 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks,
|
||||
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
/* verify that group is valid group */
|
||||
if ( MPI_GROUP_NULL == group || NULL == ranks ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ( (MPI_GROUP_NULL == group) || (NULL == group) ||
|
||||
(NULL == ranks) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_excl");
|
||||
}
|
||||
|
||||
/* check that new group is no larger than old group */
|
||||
if ( n > group_pointer->grp_proc_count) {
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_excl - II");
|
||||
}
|
||||
|
||||
} /* end if( MPI_CHECK_ARGS) */
|
||||
@ -43,7 +48,8 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks,
|
||||
/* get new group struct */
|
||||
new_group_pointer=lam_group_allocate(group_pointer->grp_proc_count-n);
|
||||
if( NULL == new_group_pointer ) {
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_union - III");
|
||||
}
|
||||
|
||||
/* put group elements in the list */
|
||||
@ -56,7 +62,8 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks,
|
||||
/* check to see if this proc is within range */
|
||||
if( ( 0 > excl_proc ) ||
|
||||
(excl_proc >= group_pointer->grp_proc_count)){
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_union - IV");
|
||||
}
|
||||
if(excl_proc == proc ){
|
||||
found=1;
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_f2c = PMPI_Group_f2c
|
||||
@ -23,9 +25,13 @@ MPI_Group MPI_Group_f2c(MPI_Fint group_f)
|
||||
/* error checks */
|
||||
if (MPI_PARAM_CHECK) {
|
||||
if (0 > group_index) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_f2c");
|
||||
return MPI_GROUP_NULL;
|
||||
}
|
||||
if (group_index >= lam_pointer_array_get_size(lam_group_f_to_c_table)) {
|
||||
if (group_index >= lam_group_f_to_c_table->size) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_f2c - II");
|
||||
return MPI_GROUP_NULL;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_free = PMPI_Group_free
|
||||
@ -19,8 +21,10 @@ int MPI_Group_free(MPI_Group *group)
|
||||
|
||||
/* check to make sure we don't free GROUP_EMPTY or GROUP_NULL */
|
||||
if (MPI_PARAM_CHECK) {
|
||||
if ((MPI_GROUP_NULL == *group) || (MPI_GROUP_EMPTY == *group)) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ((MPI_GROUP_NULL == *group) || (MPI_GROUP_EMPTY == *group) ||
|
||||
(NULL == *group) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_free");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_incl = PMPI_Group_incl
|
||||
@ -15,23 +17,25 @@
|
||||
int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
|
||||
{
|
||||
/* local variables */
|
||||
int return_value,proc,my_group_rank;
|
||||
int proc,my_group_rank;
|
||||
lam_group_t *group_pointer, *new_group_pointer;
|
||||
lam_proc_t *my_proc_pointer;
|
||||
|
||||
return_value = MPI_SUCCESS;
|
||||
group_pointer = (lam_group_t *)group;
|
||||
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
|
||||
/* verify that group is valid group */
|
||||
if ( MPI_GROUP_NULL == group || NULL == ranks ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ( (MPI_GROUP_NULL == group) || ( NULL == group)
|
||||
|| NULL == ranks ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_incl");
|
||||
}
|
||||
|
||||
/* check that new group is no larger than old group */
|
||||
if ( n > group_pointer->grp_proc_count) {
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_incl - II");
|
||||
}
|
||||
|
||||
} /* end if( MPI_CHECK_ARGS) */
|
||||
@ -40,14 +44,16 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
|
||||
/* get new group struct */
|
||||
new_group_pointer=lam_group_allocate(n);
|
||||
if( NULL == new_group_pointer ) {
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_incl - III");
|
||||
}
|
||||
|
||||
/* 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;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_incl - IV");
|
||||
}
|
||||
|
||||
new_group_pointer->grp_proc_pointers[proc] =
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_intersection = PMPI_Group_intersection
|
||||
@ -16,17 +18,16 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
|
||||
MPI_Group *new_group) {
|
||||
|
||||
/* local variables */
|
||||
int return_value,my_group_rank;
|
||||
int my_group_rank;
|
||||
int group_size,proc1,proc2,cnt;
|
||||
lam_group_t *group1_pointer, *group2_pointer, *new_group_pointer;
|
||||
lam_proc_t *proc1_pointer, *proc2_pointer, *my_proc_pointer;
|
||||
|
||||
/* initialize data */
|
||||
return_value = MPI_SUCCESS;
|
||||
|
||||
/* verify that groups are valid */
|
||||
if ( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
|
||||
( NULL == group1) || (NULL == group2) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_intersection");
|
||||
}
|
||||
|
||||
group1_pointer=(lam_group_t *)group1;
|
||||
@ -55,7 +56,8 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
|
||||
/* fill in new group */
|
||||
new_group_pointer=lam_group_allocate(group_size);
|
||||
if( NULL == new_group_pointer ) {
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_intersection - II");
|
||||
}
|
||||
|
||||
cnt = 0;
|
||||
@ -84,5 +86,5 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
|
||||
|
||||
*new_group = (MPI_Group)new_group_pointer;
|
||||
|
||||
return return_value;
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_range_excl = PMPI_Group_range_excl
|
||||
@ -16,34 +18,29 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
MPI_Group *new_group) {
|
||||
|
||||
/* local variables */
|
||||
int return_value, new_group_size, proc, first_rank, last_rank;
|
||||
int new_group_size, proc, first_rank, last_rank;
|
||||
int stride, triplet, index, *elements_int_list, my_group_rank;
|
||||
lam_group_t *group_pointer, *new_group_pointer;
|
||||
lam_proc_t *my_proc_pointer;
|
||||
|
||||
return_value = MPI_SUCCESS;
|
||||
group_pointer=(lam_group_t *)group;
|
||||
|
||||
/* can't act on NULL group */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if ( MPI_GROUP_NULL == group ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ( (MPI_GROUP_NULL == group) || (NULL == group) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_range_excl");
|
||||
}
|
||||
}
|
||||
|
||||
/* special case: nothing to exclude... */
|
||||
if (n_triplets == 0) {
|
||||
*new_group = group;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* pull out elements
|
||||
*/
|
||||
elements_int_list = (int *)
|
||||
malloc(sizeof(int) * group_pointer->grp_proc_count);
|
||||
if (NULL == elements_int_list) {
|
||||
return MPI_ERR_OTHER;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER,
|
||||
"MPI_Group_range_excl - II");
|
||||
}
|
||||
for (proc = 0; proc < group_pointer->grp_proc_count; proc++) {
|
||||
elements_int_list[proc] = -1;
|
||||
@ -59,20 +56,24 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
/* check for error conditions */
|
||||
if ((0 > first_rank) || (first_rank > group_pointer->grp_proc_count)) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - III");
|
||||
}
|
||||
if ((0 > last_rank) || (last_rank > group_pointer->grp_proc_count)) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - IV");
|
||||
}
|
||||
if (stride == 0) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - V");
|
||||
}
|
||||
if (first_rank < last_rank) {
|
||||
if (stride < 0) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - VI");
|
||||
}
|
||||
|
||||
/* positive stride */
|
||||
@ -81,7 +82,8 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
/* make sure rank has not already been selected */
|
||||
if (elements_int_list[index] != -1) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - VII");
|
||||
}
|
||||
elements_int_list[index] = new_group_size;
|
||||
index += stride;
|
||||
@ -92,7 +94,8 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
|
||||
if (stride > 0) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - VIII");
|
||||
}
|
||||
/* negative stride */
|
||||
index = first_rank;
|
||||
@ -100,7 +103,8 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
/* make sure rank has not already been selected */
|
||||
if (elements_int_list[index] != -1) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - IX");
|
||||
}
|
||||
elements_int_list[index] = new_group_size;
|
||||
index += stride;
|
||||
@ -112,7 +116,8 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
index = first_rank;
|
||||
if (elements_int_list[index] != -1) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_excl - X");
|
||||
}
|
||||
elements_int_list[index] = new_group_size;
|
||||
new_group_size++;
|
||||
@ -126,7 +131,8 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
new_group_pointer=lam_group_allocate(new_group_size);
|
||||
if( NULL == new_group_pointer ) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_range_excl - XI");
|
||||
}
|
||||
|
||||
/* fill in group list */
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_range_incl = PMPI_Group_range_incl
|
||||
@ -15,18 +17,18 @@
|
||||
int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
MPI_Group *new_group) {
|
||||
/* local variables */
|
||||
int return_value, new_group_size, proc, first_rank, last_rank;
|
||||
int new_group_size, proc, first_rank, last_rank;
|
||||
int stride, triplet, index, *elements_int_list, my_group_rank;
|
||||
lam_group_t *group_pointer, *new_group_pointer;
|
||||
lam_proc_t *my_proc_pointer;
|
||||
|
||||
return_value = MPI_SUCCESS;
|
||||
group_pointer=(lam_group_t *)group;
|
||||
|
||||
/* can't act on NULL group */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if ( MPI_GROUP_NULL == group ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ( (MPI_GROUP_NULL == group) || (NULL == group) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_range_incl");
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +38,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
elements_int_list =
|
||||
(int *) malloc(sizeof(int) * group_pointer->grp_proc_count);
|
||||
if (NULL == elements_int_list) {
|
||||
return MPI_ERR_OTHER;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER,
|
||||
"MPI_Group_range_incl - II");
|
||||
}
|
||||
for (proc = 0; proc < group_pointer->grp_proc_count; proc++) {
|
||||
elements_int_list[proc] = -1;
|
||||
@ -51,21 +54,25 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
stride = ranges[triplet][2];
|
||||
if(( 0 > first_rank ) || (first_rank > group_pointer->grp_proc_count)) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - III");
|
||||
}
|
||||
if((0 > last_rank) || (last_rank > group_pointer->grp_proc_count)) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - IV");
|
||||
}
|
||||
if (stride == 0) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - V");
|
||||
}
|
||||
if (first_rank < last_rank) {
|
||||
|
||||
if (stride < 0) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - VI");
|
||||
}
|
||||
|
||||
/* positive stride */
|
||||
@ -74,7 +81,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
/* make sure rank has not already been selected */
|
||||
if (elements_int_list[index] != -1) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - VII");
|
||||
}
|
||||
elements_int_list[index] = new_group_size;
|
||||
index += stride;
|
||||
@ -85,7 +93,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
|
||||
if (stride > 0){
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - VIII");
|
||||
}
|
||||
|
||||
/* negative stride */
|
||||
@ -94,7 +103,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
/* make sure rank has not already been selected */
|
||||
if (elements_int_list[index] != -1) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - IX");
|
||||
}
|
||||
elements_int_list[index] = new_group_size;
|
||||
index += stride;
|
||||
@ -106,7 +116,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
index = first_rank;
|
||||
if (elements_int_list[index] != -1) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_RANK;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
|
||||
"MPI_Group_range_incl - X");
|
||||
}
|
||||
elements_int_list[index] = new_group_size;
|
||||
new_group_size++;
|
||||
@ -117,7 +128,8 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
|
||||
new_group_pointer=lam_group_allocate(new_group_size);
|
||||
if( NULL == new_group_pointer ) {
|
||||
free(elements_int_list);
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_range_incl - X");
|
||||
}
|
||||
|
||||
/* fill in group list */
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_rank = PMPI_Group_rank
|
||||
@ -16,8 +18,9 @@ int MPI_Group_rank(MPI_Group group, int *rank) {
|
||||
|
||||
/* error checking */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if( MPI_GROUP_NULL == group ){
|
||||
return MPI_ERR_GROUP;
|
||||
if( (MPI_GROUP_NULL == group) || ( NULL == group) ){
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_rank");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_size = PMPI_Group_size
|
||||
@ -16,11 +18,13 @@ int MPI_Group_size(MPI_Group group, int *size) {
|
||||
|
||||
/* error checking */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if( MPI_GROUP_NULL == group ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if( (MPI_GROUP_NULL == group) || (NULL == group) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_size");
|
||||
}
|
||||
}
|
||||
|
||||
*size=lam_group_size((lam_group_t *)group);
|
||||
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_translate_ranks = PMPI_Group_translate_ranks
|
||||
@ -24,15 +26,19 @@ int MPI_Group_translate_ranks(MPI_Group group1, int n_ranks, int *ranks1,
|
||||
|
||||
/* check for errors */
|
||||
if( MPI_PARAM_CHECK ) {
|
||||
if( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2 ) ) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ((MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
|
||||
(NULL == group1) || (NULL == group2) ) {
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_translate_ranks");
|
||||
}
|
||||
if( (n_ranks > group1_pointer->grp_proc_count) ||
|
||||
( 0 >= n_ranks ) ){
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_translate_ranks - II ");
|
||||
}
|
||||
if( (NULL == ranks1) || (NULL == ranks2 ) ) {
|
||||
return MPI_ERR_GROUP;
|
||||
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_translate_ranks - III ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "mpi.h"
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "communicator/communicator.h"
|
||||
|
||||
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
||||
#pragma weak MPI_Group_union = PMPI_Group_union
|
||||
@ -15,19 +17,21 @@
|
||||
int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group)
|
||||
{
|
||||
/* local variables */
|
||||
int return_value, new_group_size, proc1, proc2, found_in_group;
|
||||
int new_group_size, proc1, proc2, found_in_group;
|
||||
int my_group_rank, cnt;
|
||||
lam_group_t *group1_pointer, *group2_pointer, *new_group_pointer;
|
||||
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)) {
|
||||
return MPI_ERR_GROUP;
|
||||
if ((MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
|
||||
(NULL == group1) || (NULL == group2) ) {
|
||||
return
|
||||
LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_union");
|
||||
}
|
||||
}
|
||||
|
||||
return_value = MPI_SUCCESS;
|
||||
group1_pointer = (lam_group_t *) group1;
|
||||
group2_pointer = (lam_group_t *) group2;
|
||||
|
||||
@ -62,7 +66,9 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group)
|
||||
/* get new group struct */
|
||||
new_group_pointer = lam_group_allocate(new_group_size);
|
||||
if (NULL == new_group_pointer) {
|
||||
return MPI_ERR_GROUP;
|
||||
return
|
||||
LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
|
||||
"MPI_Group_union - II");
|
||||
}
|
||||
|
||||
/* fill in the new group list */
|
||||
@ -114,5 +120,5 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group)
|
||||
*new_group = (MPI_Group) new_group_pointer;
|
||||
|
||||
/* return */
|
||||
return return_value;
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user