Commit 388593b7 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Split mpi_err_handler function into macro and abort function.

* Both macro and function have a name conforming to xt prefix requirement.
parent 5dfd0ed2
......@@ -10,7 +10,7 @@ int main(void) {
//init mpi
mpi_err_handler(MPI_Init(NULL, NULL), MPI_COMM_WORLD);
xt_mpi_call(MPI_Init(NULL, NULL), MPI_COMM_WORLD);
xt_initialize (MPI_COMM_WORLD);
......
......@@ -11,12 +11,22 @@
*/
/**
* checks the return value of an MPI call
* check return code of MPI call and call abort function if needed
*/
#define xt_mpi_call(call, comm) \
do { \
int error_code = call; \
if (error_code != MPI_SUCCESS) \
xt_mpi_error(error_code, comm); \
} while(0)
/**
* report error return of MPI call
*
* @param[in] error_code return code of an MPI call
* @param[in] comm communicator which was used for the respective MPI call
*/
void mpi_err_handler(int error_code, MPI_Comm comm);
void xt_mpi_error(int error_code, MPI_Comm comm);
/**
* generates an MPI datatype
......
......@@ -35,7 +35,7 @@ Xt_idxlist xt_idxlist_unpack(void *buffer, int buffer_size,
int type;
// unpack the type of the index list to be unpacked
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&type, 1, MPI_INT, comm), comm);
unsigned i;
......
......@@ -132,8 +132,8 @@ size_t idxlist_collection_get_pack_size(Xt_idxlist data, MPI_Comm comm) {
size_t size_idxlists = 0;
unsigned i;
mpi_err_handler(MPI_Pack_size(1, MPI_INT, comm, &size_int), comm);
mpi_err_handler(MPI_Pack_size(1, MPI_UNSIGNED, comm, &size_unsigned), comm);
xt_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_int), comm);
xt_mpi_call(MPI_Pack_size(1, MPI_UNSIGNED, comm, &size_unsigned), comm);
for (i = 0; i < collectionlist->num_idxlists; ++i)
size_idxlists += xt_idxlist_get_pack_size(collectionlist->idxlists[i], comm);
......@@ -147,9 +147,9 @@ void idxlist_collection_pack(Xt_idxlist data, void *buffer, int buffer_size, int
struct xt_idxlist_collection *collectionlist = (struct xt_idxlist_collection*)data;
int type = COLLECTION;
mpi_err_handler(MPI_Pack(&(type), 1, MPI_INT, buffer,
xt_mpi_call(MPI_Pack(&(type), 1, MPI_INT, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(&(collectionlist->num_idxlists), 1, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(&(collectionlist->num_idxlists), 1, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
unsigned i;
......@@ -169,7 +169,7 @@ Xt_idxlist xt_idxlist_collection_unpack(void *buffer, int buffer_size, int *posi
collectionlist->index_num_cache = -1;
collectionlist->index_array_cache = NULL;
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&(collectionlist->num_idxlists), 1, MPI_UNSIGNED, comm),
comm);
......
......@@ -163,9 +163,9 @@ idxsection_get_pack_size(Xt_idxlist data, MPI_Comm comm) {
int size_int_type, size_unsigned, size_int;
mpi_err_handler(MPI_Pack_size(1, MPI_INT, comm, &size_int_type), comm);
mpi_err_handler(MPI_Pack_size(2, Xt_idx_dt, comm, &size_int), comm);
mpi_err_handler(MPI_Pack_size(1 + section->ndim * 5, MPI_UNSIGNED,
xt_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_int_type), comm);
xt_mpi_call(MPI_Pack_size(2, Xt_idx_dt, comm, &size_int), comm);
xt_mpi_call(MPI_Pack_size(1 + section->ndim * 5, MPI_UNSIGNED,
comm, &size_unsigned), comm);
return size_int_type + size_unsigned + size_int;
......@@ -179,25 +179,25 @@ idxsection_pack(Xt_idxlist data, void *buffer, int buffer_size,
struct xt_idxsection *section = (struct xt_idxsection*)data;
int type = SECTION;
mpi_err_handler(MPI_Pack(&(type), 1, MPI_INT, buffer,
xt_mpi_call(MPI_Pack(&(type), 1, MPI_INT, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(&(section->global_start_index), 1,
xt_mpi_call(MPI_Pack(&(section->global_start_index), 1,
Xt_idx_dt, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(&(section->local_start_index), 1,
xt_mpi_call(MPI_Pack(&(section->local_start_index), 1,
Xt_idx_dt, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(&(section->ndim), 1, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(&(section->ndim), 1, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(section->global_size, section->ndim, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(section->global_size, section->ndim, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(section->local_size, section->ndim, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(section->local_size, section->ndim, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(section->local_start, section->ndim, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(section->local_start, section->ndim, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(section->global_strides, section->ndim, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(section->global_strides, section->ndim, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(section->local_strides, section->ndim, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(section->local_strides, section->ndim, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
}
......@@ -212,13 +212,13 @@ Xt_idxlist xt_idxsection_unpack(void *buffer, int buffer_size, int *position,
section->index_array_cache = NULL;
section-> index_num_cache = -1; // == undef
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&(section->global_start_index), 1, Xt_idx_dt,
comm), comm);
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&(section->local_start_index), 1, Xt_idx_dt,
comm), comm);
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&(section->ndim), 1, MPI_UNSIGNED,
comm), comm);
assert(section->ndim > 0);
......@@ -229,19 +229,19 @@ Xt_idxlist xt_idxsection_unpack(void *buffer, int buffer_size, int *position,
section->global_strides = xmalloc(section->ndim * sizeof(*(section->global_strides)));
section->local_strides = xmalloc(section->ndim * sizeof(*(section->local_strides)));
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
section->global_size, section->ndim,
MPI_UNSIGNED, comm),comm);
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
section->local_size, section->ndim,
MPI_UNSIGNED, comm),comm);
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
section->local_start, section->ndim,
MPI_UNSIGNED, comm),comm);
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
section->global_strides, section->ndim,
MPI_UNSIGNED, comm),comm);
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
section->local_strides, section->ndim,
MPI_UNSIGNED, comm),comm);
......
......@@ -107,9 +107,9 @@ static MPI_Datatype xt_get_stripes_datatype() {
sizeof(stripe)};
MPI_Datatype types[5] = {MPI_LB, Xt_idx_dt, Xt_count_dt, Xt_idx_dt, MPI_UB};
mpi_err_handler(MPI_Type_create_struct(5, block_lengths, displacements,
xt_mpi_call(MPI_Type_create_struct(5, block_lengths, displacements,
types, &type), MPI_COMM_WORLD);
mpi_err_handler(MPI_Type_commit(&type), MPI_COMM_WORLD);
xt_mpi_call(MPI_Type_commit(&type), MPI_COMM_WORLD);
}
return type;
......@@ -239,10 +239,10 @@ idxstripes_get_pack_size(Xt_idxlist data, MPI_Comm comm) {
int size_int_type, size_unsigned, size_stripes = 0;
mpi_err_handler(MPI_Pack_size(1, MPI_INT, comm, &size_int_type), comm);
mpi_err_handler(MPI_Pack_size(1, Xt_count_dt, comm, &size_unsigned), comm);
xt_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_int_type), comm);
xt_mpi_call(MPI_Pack_size(1, Xt_count_dt, comm, &size_unsigned), comm);
if (stripes->num_stripes)
mpi_err_handler(MPI_Pack_size(stripes->num_stripes,
xt_mpi_call(MPI_Pack_size(stripes->num_stripes,
xt_get_stripes_datatype(),
comm, &size_stripes), comm);
......@@ -257,12 +257,12 @@ idxstripes_pack(Xt_idxlist data, void *buffer, int buffer_size,
struct xt_idxstripes *stripes = (struct xt_idxstripes*)data;
int type = STRIPES;
mpi_err_handler(MPI_Pack(&(type), 1, MPI_INT, buffer,
xt_mpi_call(MPI_Pack(&(type), 1, MPI_INT, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(&(stripes->num_stripes), 1, MPI_UNSIGNED, buffer,
xt_mpi_call(MPI_Pack(&(stripes->num_stripes), 1, MPI_UNSIGNED, buffer,
buffer_size, position, comm), comm);
if (stripes->num_stripes)
mpi_err_handler(MPI_Pack(stripes->stripes, (int)stripes->num_stripes,
xt_mpi_call(MPI_Pack(stripes->stripes, (int)stripes->num_stripes,
xt_get_stripes_datatype(), buffer,
buffer_size, position, comm), comm);
}
......@@ -278,14 +278,14 @@ Xt_idxlist xt_idxstripes_unpack(void *buffer, int buffer_size, int *position,
stripes->index_num_cache = -1; // negative num means: undef
stripes->index_array_cache = NULL;
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&(stripes->num_stripes), 1, MPI_UNSIGNED,
comm), comm);
if (stripes->num_stripes) {
stripes->stripes
= xmalloc(stripes->num_stripes * sizeof(*(stripes->stripes)));
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
stripes->stripes, stripes->num_stripes,
xt_get_stripes_datatype(), comm),comm);
......
......@@ -318,9 +318,9 @@ static size_t idxvec_get_pack_size(Xt_idxlist data, MPI_Comm comm) {
int size_xt_idx, size_xt_count, size_int_type;
mpi_err_handler(MPI_Pack_size(1, MPI_INT, comm, &size_int_type), comm);
mpi_err_handler(MPI_Pack_size(1, Xt_count_dt, comm, &size_xt_count), comm);
mpi_err_handler(MPI_Pack_size(idxvec->num_indices, Xt_idx_dt, comm,
xt_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_int_type), comm);
xt_mpi_call(MPI_Pack_size(1, Xt_count_dt, comm, &size_xt_count), comm);
xt_mpi_call(MPI_Pack_size(idxvec->num_indices, Xt_idx_dt, comm,
&size_xt_idx), comm);
return size_xt_count + size_xt_idx + size_int_type;
......@@ -335,12 +335,12 @@ void idxvec_pack(Xt_idxlist data, void *buffer, int buffer_size,
assert(idxvec->num_indices <= INT_MAX);
mpi_err_handler(MPI_Pack(&(type), 1, MPI_INT, buffer,
xt_mpi_call(MPI_Pack(&(type), 1, MPI_INT, buffer,
buffer_size, position, comm), comm);
mpi_err_handler(MPI_Pack(&(idxvec->num_indices), 1, Xt_count_dt, buffer,
xt_mpi_call(MPI_Pack(&(idxvec->num_indices), 1, Xt_count_dt, buffer,
buffer_size, position, comm), comm);
if (idxvec->num_indices != 0)
mpi_err_handler(MPI_Pack(idxvec->vector, idxvec->num_indices,
xt_mpi_call(MPI_Pack(idxvec->vector, idxvec->num_indices,
Xt_idx_dt, buffer,
buffer_size, position, comm), comm);
}
......@@ -355,7 +355,7 @@ Xt_idxlist xt_idxvec_unpack(void *buffer, int buffer_size, int *position,
idxvec->vtable = &idxvec_vtable;
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
&num_indices, 1, Xt_count_dt, comm), comm);
assert(num_indices >= 0);
idxvec->num_indices = num_indices;
......@@ -363,7 +363,7 @@ Xt_idxlist xt_idxvec_unpack(void *buffer, int buffer_size, int *position,
if (num_indices != 0) {
idxvec->vector = xmalloc(idxvec->num_indices * sizeof(*(idxvec->vector)));
mpi_err_handler(MPI_Unpack(buffer, buffer_size, position,
xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
idxvec->vector, num_indices,
Xt_idx_dt, comm),comm);
} else {
......
......@@ -7,32 +7,26 @@
#include "xt/xt_mpi.h"
//taken from http://beige.ucs.indiana.edu/I590/node85.html
void mpi_err_handler(int error_code, MPI_Comm comm) {
if (error_code != MPI_SUCCESS) {
int rank;
MPI_Comm_rank(comm, &rank);
char error_string[1024];
int length_of_error_string, error_class;
MPI_Error_class(error_code, &error_class);
MPI_Error_string(error_class, error_string, &length_of_error_string);
fprintf(stderr, "%3d: %s\n", rank, error_string);
MPI_Error_string(error_code, error_string, &length_of_error_string);
fprintf(stderr, "%3d: %s\n", rank, error_string);
MPI_Abort(comm, error_code);
}
void xt_mpi_error(int error_code, MPI_Comm comm) {
int rank;
MPI_Comm_rank(comm, &rank);
char error_string[1024];
int length_of_error_string, error_class;
MPI_Error_class(error_code, &error_class);
MPI_Error_string(error_class, error_string, &length_of_error_string);
fprintf(stderr, "%3d: %s\n", rank, error_string);
MPI_Error_string(error_code, error_string, &length_of_error_string);
fprintf(stderr, "%3d: %s\n", rank, error_string);
MPI_Abort(comm, error_code);
}
static MPI_Datatype copy_mpi_datatype(MPI_Datatype old_type, MPI_Comm comm) {
MPI_Datatype datatype;
mpi_err_handler(MPI_Type_dup(old_type, &datatype), comm);
xt_mpi_call(MPI_Type_dup(old_type, &datatype), comm);
return datatype;
}
......@@ -42,9 +36,9 @@ gen_mpi_datatype_simple(int displacement, MPI_Datatype old_type, MPI_Comm comm)
{
MPI_Datatype datatype;
mpi_err_handler(MPI_Type_create_indexed_block(1, 1, &displacement, old_type,
xt_mpi_call(MPI_Type_create_indexed_block(1, 1, &displacement, old_type,
&datatype), comm);
mpi_err_handler(MPI_Type_commit(&datatype), comm);
xt_mpi_call(MPI_Type_commit(&datatype), comm);
return datatype;
}
......@@ -56,14 +50,14 @@ gen_mpi_datatype_contiguous(int displacement, int blocklength,
MPI_Datatype datatype;
if (displacement == 0)
mpi_err_handler(MPI_Type_contiguous(blocklength, old_type, &datatype),
xt_mpi_call(MPI_Type_contiguous(blocklength, old_type, &datatype),
comm);
else
mpi_err_handler(MPI_Type_create_indexed_block(1, blocklength,
xt_mpi_call(MPI_Type_create_indexed_block(1, blocklength,
&displacement, old_type,
&datatype), comm);
mpi_err_handler(MPI_Type_commit(&datatype), comm);
xt_mpi_call(MPI_Type_commit(&datatype), comm);
return datatype;
......@@ -75,7 +69,7 @@ gen_mpi_datatype_vector(int stride, int blocklength, int count,
MPI_Datatype datatype;
mpi_err_handler(MPI_Type_vector(count, blocklength, stride, old_type,
xt_mpi_call(MPI_Type_vector(count, blocklength, stride, old_type,
&datatype), comm);
if (offset != 0) {
......@@ -83,18 +77,18 @@ gen_mpi_datatype_vector(int stride, int blocklength, int count,
int blocklength = 1;
MPI_Aint old_type_size, old_type_lb;
mpi_err_handler(MPI_Type_get_extent(old_type, &old_type_lb,
xt_mpi_call(MPI_Type_get_extent(old_type, &old_type_lb,
&old_type_size), comm);
MPI_Aint displacement = offset * old_type_size;
mpi_err_handler(MPI_Type_create_hindexed(1, &blocklength, &displacement,
xt_mpi_call(MPI_Type_create_hindexed(1, &blocklength, &displacement,
datatype, &datatype_),
comm);
mpi_err_handler(MPI_Type_free(&datatype), comm);
xt_mpi_call(MPI_Type_free(&datatype), comm);
datatype = datatype_;
}
mpi_err_handler(MPI_Type_commit(&datatype), comm);
xt_mpi_call(MPI_Type_commit(&datatype), comm);
return datatype;
}
......@@ -105,10 +99,10 @@ gen_mpi_datatype_indexed_block(int const * displacements, int blocklength,
{
MPI_Datatype datatype;
mpi_err_handler(MPI_Type_create_indexed_block(count, blocklength,
xt_mpi_call(MPI_Type_create_indexed_block(count, blocklength,
(void *)displacements,
old_type, &datatype), comm);
mpi_err_handler(MPI_Type_commit(&datatype), comm);
xt_mpi_call(MPI_Type_commit(&datatype), comm);
return datatype;
}
......@@ -119,9 +113,9 @@ gen_mpi_datatype_indexed(int const * displacements, int * blocklengths,
MPI_Datatype datatype;
mpi_err_handler(MPI_Type_indexed(count, blocklengths, (void*)displacements,
xt_mpi_call(MPI_Type_indexed(count, blocklengths, (void*)displacements,
old_type, &datatype), comm);
mpi_err_handler(MPI_Type_commit(&datatype), comm);
xt_mpi_call(MPI_Type_commit(&datatype), comm);
return datatype;
}
......
......@@ -73,7 +73,7 @@ static void get_MPI_datatypes(struct redist_collection_msg ** msgs, int * nmsgs,
int msgs_array_size = 0;
int comm_size;
mpi_err_handler(MPI_Comm_size(comm, &comm_size), comm);
xt_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
MPI_Datatype datatypes[num_redists];
......@@ -134,7 +134,7 @@ Xt_redist xt_redist_collection_new(Xt_redist * redists, unsigned num_redists,
redist_coll->cache_src_token = 0;
redist_coll->cache_dst_token = 0;
mpi_err_handler(MPI_Comm_dup(comm, &(redist_coll->comm)), comm);
xt_mpi_call(MPI_Comm_dup(comm, &(redist_coll->comm)), comm);
get_MPI_datatypes(&(redist_coll->send_msgs), &(redist_coll->nsrc), redists,
num_redists, redist_coll->comm, xt_redist_get_send_MPI_Datatype,
......@@ -156,7 +156,7 @@ static void generate_datatype(MPI_Aint * displacements, int * block_lengths,
datatype = msg->datatype_cache+cache_index;
if (*datatype != MPI_DATATYPE_NULL) mpi_err_handler(MPI_Type_free(datatype), comm);
if (*datatype != MPI_DATATYPE_NULL) xt_mpi_call(MPI_Type_free(datatype), comm);
int num_datatypes = 0;
......@@ -188,10 +188,10 @@ static void generate_datatype(MPI_Aint * displacements, int * block_lengths,
displacements_ = displacements;
}
mpi_err_handler(MPI_Type_create_struct(num_datatypes, block_lengths, displacements_,
xt_mpi_call(MPI_Type_create_struct(num_datatypes, block_lengths, displacements_,
datatypes, datatype), comm);
mpi_err_handler(MPI_Type_commit(datatype), comm);
xt_mpi_call(MPI_Type_commit(datatype), comm);
if (num_datatypes != num_redists) {
free(datatypes);
......@@ -211,7 +211,7 @@ static int generate_datatypes(void ** data, struct redist_collection_msg * msgs,
int block_lengths[num_redists];
for (unsigned i = 0; i < num_redists; ++i)
mpi_err_handler(MPI_Get_address(data[i], addresses+i), comm);
xt_mpi_call(MPI_Get_address(data[i], addresses+i), comm);
for (unsigned i = 0; i < num_redists; ++i)
(*cached_displacements)[i] = addresses[i] - addresses[0];
......@@ -237,7 +237,7 @@ int lookup_cache_index(void ** data, MPI_Aint ** cached_displacements,
MPI_Aint displacements[num_redists];
for (unsigned i = 0; i < num_redists; ++i)
mpi_err_handler(MPI_Get_address(data[i], addresses+i), comm);
xt_mpi_call(MPI_Get_address(data[i], addresses+i), comm);
for (unsigned i = 0; i < num_redists; ++i)
displacements[i] = addresses[i] - addresses[0];
......@@ -280,7 +280,7 @@ static void clear_cache_entry(struct redist_collection_msg * msgs, int num_messa
for (int i = 0; i < num_messages; ++i)
if (msgs[i].datatype_cache[cache_index] != MPI_DATATYPE_NULL) {
mpi_err_handler(MPI_Type_free(msgs[i].datatype_cache+cache_index), comm);
xt_mpi_call(MPI_Type_free(msgs[i].datatype_cache+cache_index), comm);
msgs[i].datatype_cache[cache_index] = MPI_DATATYPE_NULL;
}
}
......@@ -310,7 +310,7 @@ redist_collection_s_exchange(Xt_redist redist, void **src_data,
redist_coll->cache_size, redist_coll->comm);
for (int i = 0; i < redist_coll->ndst; ++i)
mpi_err_handler(MPI_Irecv(dst_data[0], 1,
xt_mpi_call(MPI_Irecv(dst_data[0], 1,
redist_coll->recv_msgs[i].datatype_cache[dst_cache_index],
redist_coll->recv_msgs[i].rank, 0, redist_coll->comm,
recv_requests+i), redist_coll->comm);
......@@ -322,12 +322,12 @@ redist_collection_s_exchange(Xt_redist redist, void **src_data,
redist_coll->cache_size, redist_coll->comm);
for (int i = 0; i < redist_coll->nsrc; ++i)
mpi_err_handler(MPI_Send(src_data[0], 1,
xt_mpi_call(MPI_Send(src_data[0], 1,
redist_coll->send_msgs[i].datatype_cache[src_cache_index],
redist_coll->send_msgs[i].rank, 0, redist_coll->comm),
redist_coll->comm);
mpi_err_handler(MPI_Waitall(redist_coll->ndst, recv_requests,
xt_mpi_call(MPI_Waitall(redist_coll->ndst, recv_requests,
MPI_STATUSES_IGNORE), redist_coll->comm);
if (redist_coll->cache_size == 0) {
......@@ -349,13 +349,13 @@ free_redist_collection_msgs(struct redist_collection_msg * msgs,
for (unsigned j = 0; j < num_redists; ++j)
if (msgs[i].datatypes[j] != MPI_DATATYPE_NULL)
mpi_err_handler(MPI_Type_free(msgs[i].datatypes+j), comm);
xt_mpi_call(MPI_Type_free(msgs[i].datatypes+j), comm);
free(msgs[i].datatypes);
for (unsigned j = 0; j < cache_size; ++j) {
if (msgs[i].datatype_cache[j] != MPI_DATATYPE_NULL)
mpi_err_handler(MPI_Type_free(msgs[i].datatype_cache+j), comm);
xt_mpi_call(MPI_Type_free(msgs[i].datatype_cache+j), comm);
else
break;
}
......@@ -388,7 +388,7 @@ redist_collection_delete(Xt_redist redist) {
free(redist_coll->cached_src_displacements);
free(redist_coll->cached_dst_displacements);
mpi_err_handler(MPI_Comm_free(&(redist_coll->comm)), MPI_COMM_WORLD);
xt_mpi_call(MPI_Comm_free(&(redist_coll->comm)), MPI_COMM_WORLD);
free(redist_coll);
}
......
......@@ -88,10 +88,10 @@ generate_datatype(MPI_Aint * displacements, int * block_lengths,
displacements_ = displacements;
}
mpi_err_handler(MPI_Type_create_struct(num_datatypes, block_lengths, displacements_,
xt_mpi_call(MPI_Type_create_struct(num_datatypes, block_lengths, displacements_,
datatypes_, &datatype), comm);
mpi_err_handler(MPI_Type_commit(&datatype), comm);
xt_mpi_call(MPI_Type_commit(&datatype), comm);
if (num_datatypes != num_redists) {
free(datatypes_);
......@@ -109,7 +109,7 @@ static void generate_msg_infos(struct redist_collection_static_msg ** msgs, int
int msgs_array_size = 0;
int comm_size;
mpi_err_handler(MPI_Comm_size(comm, &comm_size), comm);
xt_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
int block_lengths[num_redists];
MPI_Datatype datatypes[num_redists];
......@@ -139,7 +139,7 @@ static void generate_msg_infos(struct redist_collection_static_msg ** msgs, int
for (unsigned j = 0; j < num_redists; ++j)
if (datatypes[j] != MPI_DATATYPE_NULL)
mpi_err_handler(MPI_Type_free(datatypes+j), comm);
xt_mpi_call(MPI_Type_free(datatypes+j), comm);
}
if (*nmsgs > 0)
......@@ -159,7 +159,7 @@ Xt_redist xt_redist_collection_static_new(Xt_redist * redists, unsigned num_redi
redist_coll->nsrc = 0;
redist_coll->send_msgs = NULL;
redist_coll->recv_msgs = NULL;
mpi_err_handler(MPI_Comm_dup(comm, &(redist_coll->comm)), comm);
xt_mpi_call(MPI_Comm_dup(comm, &(redist_coll->comm)), comm);
generate_msg_infos(&(redist_coll->send_msgs), &(redist_coll->nsrc),
src_displacements, redists, num_redists, redist_coll->comm,
......@@ -202,7 +202,7 @@ redist_collection_static_delete(Xt_redist redist) {
MPI_Type_free(&(redist_coll->recv_msgs[i].datatype));
free(redist_coll->recv_msgs);
mpi_err_handler(MPI_Comm_free(&(redist_coll->comm)), MPI_COMM_WORLD);
xt_mpi_call(MPI_Comm_free(&(redist_coll->comm)), MPI_COMM_WORLD);
free(redist_coll);
}
......@@ -220,7 +220,7 @@ redist_collection_static_get_send_MPI_Datatype(Xt_redist redist, int rank) {
for (int i = 0; i < redist_coll->nsrc; ++i)
if (redist_coll->send_msgs[i].rank == rank) {
mpi_err_handler(MPI_Type_dup(redist_coll->send_msgs[i].datatype, &datatype_copy),
xt_mpi_call(MPI_Type_dup(redist_coll->send_msgs[i].datatype, &datatype_copy),
redist_coll->comm);
break;
}
......@@ -241,7 +241,7 @@ redist_collection_static_get_recv_MPI_Datatype(Xt_redist redist, int rank) {
for (int i = 0; i < redist_coll->ndst; ++i)
if (redist_coll->recv_msgs[i].rank == rank) {
mpi_err_handler(MPI_Type_dup(redist_coll->recv_msgs[i].datatype, &datatype_copy),
xt_mpi_call(MPI_Type_dup(redist_coll->recv_msgs[i].datatype, &datatype_copy),
redist_coll->comm);
break;
}
......@@ -261,16 +261,16 @@ redist_collection_static_s_exchange1(Xt_redist redist, void *src_data, void *dst
recv_requests = xmalloc(redist_coll->ndst * sizeof(*recv_requests));
for (int i = 0; i < redist_coll->ndst; ++i)
mpi_err_handler(MPI_Irecv(dst_data, 1, redist_coll->recv_msgs[i].datatype,
xt_mpi_call(MPI_Irecv(dst_data, 1, redist_coll->recv_msgs[i].datatype,
redist_coll->recv_msgs[i].rank, 0, redist_coll->comm,
recv_requests+i), redist_coll->comm);
for (int i = 0; i < redist_coll->nsrc; ++i)
mpi_err_handler(MPI_Send(src_data, 1, redist_coll->send_msgs[i].datatype,
xt_mpi_call(MPI_Send(src_data, 1, redist_coll->send_msgs[i].datatype,
redist_coll->send_msgs[i].rank, 0, redist_coll->comm),
redist_coll->comm);
mpi_err_handler(MPI_Waitall(redist_coll->ndst, recv_requests,
xt_mpi_call(MPI_Waitall(redist_coll->ndst, recv_requests,
MPI_STATUSES_IGNORE), redist_coll->comm);