diff --git a/src/include/mpir_mem.h b/src/include/mpir_mem.h index 147e67ef7bb..fa512b9aff3 100644 --- a/src/include/mpir_mem.h +++ b/src/include/mpir_mem.h @@ -105,22 +105,28 @@ extern "C" { /* CHKPMEM_REGISTER is used for memory allocated within another routine */ -#define MPIR_CHKLMEM_DECL(n_) \ - void *(mpiu_chklmem_stk_[n_]) = { NULL }; \ - int mpiu_chklmem_stk_sp_=0; \ - MPIR_AssertDeclValue(const int mpiu_chklmem_stk_sz_,n_) +#define MPIR_CHKLMEM_MAX 10 +#define MPIR_CHKLMEM_DECL() \ + void *(mpiu_chklmem_stk_[MPIR_CHKLMEM_MAX]) = { NULL }; \ + int mpiu_chklmem_stk_sp_=0; \ + +#define MPIR_CHKLMEM_ADD(pointer_) \ + do { \ + MPIR_Assert(mpiu_chklmem_stk_sp_ 0) { \ + MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem"); \ + } \ + } while (0) -#define MPIR_CHKLMEM_MALLOC_ORSTMT(pointer_,type_,nbytes_,rc_,name_,class_,stmt_) \ - { \ - pointer_ = (type_)MPL_malloc(nbytes_,class_); \ - if (pointer_) { \ - MPIR_Assert(mpiu_chklmem_stk_sp_ 0) { \ - MPIR_CHKMEM_SETERR(rc_,nbytes_,name_); \ - stmt_; \ - } \ - } #define MPIR_CHKLMEM_FREEALL() \ do { \ while (mpiu_chklmem_stk_sp_ > 0) { \ @@ -128,10 +134,6 @@ extern "C" { } \ } while (0) -#define MPIR_CHKLMEM_MALLOC(pointer_,type_,nbytes_,rc_,name_,class_) \ - MPIR_CHKLMEM_MALLOC_ORJUMP(pointer_,type_,nbytes_,rc_,name_,class_) -#define MPIR_CHKLMEM_MALLOC_ORJUMP(pointer_,type_,nbytes_,rc_,name_,class_) \ - MPIR_CHKLMEM_MALLOC_ORSTMT(pointer_,type_,nbytes_,rc_,name_,class_,goto fn_fail) /* Persistent memory that we may want to recover if something goes wrong */ #define MPIR_CHKPMEM_DECL(n_) \ diff --git a/src/mpi/coll/algorithms/recexchalgo/recexchalgo.c b/src/mpi/coll/algorithms/recexchalgo/recexchalgo.c index 61042c75671..7b05f4009c8 100644 --- a/src/mpi/coll/algorithms/recexchalgo/recexchalgo.c +++ b/src/mpi/coll/algorithms/recexchalgo/recexchalgo.c @@ -331,7 +331,7 @@ int MPII_Recexchalgo_reverse_digits_step2(int rank, int comm_size, int k) int pofk = 1, log_pofk = 0; int *digit, *digit_reverse; int mpi_errno ATTRIBUTE((unused)) = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -350,10 +350,8 @@ int MPII_Recexchalgo_reverse_digits_step2(int rank, int comm_size, int k) step2rank = MPII_Recexchalgo_origrank_to_step2rank(rank, rem, T, k); /* calculate the digits in base k representation of step2rank */ - MPIR_CHKLMEM_MALLOC(digit, int *, sizeof(int) * log_pofk, - mpi_errno, "digit buffer", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(digit_reverse, int *, sizeof(int) * log_pofk, - mpi_errno, "digit_reverse buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(digit, sizeof(int) * log_pofk); + MPIR_CHKLMEM_MALLOC(digit_reverse, sizeof(int) * log_pofk); for (i = 0; i < log_pofk; i++) digit[i] = 0; diff --git a/src/mpi/coll/allgather/allgather_inter_local_gather_remote_bcast.c b/src/mpi/coll/allgather/allgather_inter_local_gather_remote_bcast.c index fedb0ff358e..639c4b409cc 100644 --- a/src/mpi/coll/allgather/allgather_inter_local_gather_remote_bcast.c +++ b/src/mpi/coll/allgather/allgather_inter_local_gather_remote_bcast.c @@ -22,7 +22,7 @@ int MPIR_Allgather_inter_local_gather_remote_bcast(const void *sendbuf, MPI_Aint void *tmp_buf = NULL; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); local_size = comm_ptr->local_size; remote_size = comm_ptr->remote_size; @@ -32,8 +32,7 @@ int MPIR_Allgather_inter_local_gather_remote_bcast(const void *sendbuf, MPI_Aint /* In each group, rank 0 allocates temp. buffer for local * gather */ MPIR_Datatype_get_size_macro(sendtype, sendtype_sz); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, sendcount * sendtype_sz * local_size, mpi_errno, - "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, sendcount * sendtype_sz * local_size); } else { /* silence -Wmaybe-uninitialized due to MPIR_{Gather,Bcast} calls by non-zero ranks */ sendtype_sz = 0; diff --git a/src/mpi/coll/allgather/allgather_intra_brucks.c b/src/mpi/coll/allgather/allgather_intra_brucks.c index 4e22866ebeb..c7971960635 100644 --- a/src/mpi/coll/allgather/allgather_intra_brucks.c +++ b/src/mpi/coll/allgather/allgather_intra_brucks.c @@ -28,7 +28,7 @@ int MPIR_Allgather_intra_brucks(const void *sendbuf, void *tmp_buf = NULL; int dst; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (((sendcount == 0) && (sendbuf != MPI_IN_PLACE)) || (recvcount == 0)) goto fn_exit; @@ -39,8 +39,7 @@ int MPIR_Allgather_intra_brucks(const void *sendbuf, MPIR_Datatype_get_size_macro(recvtype, recvtype_sz); /* allocate a temporary buffer of the same size as recvbuf. */ - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, recvcount * comm_size * recvtype_sz, mpi_errno, - "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, recvcount * comm_size * recvtype_sz); /* copy local data to the top of tmp_buf */ if (sendbuf != MPI_IN_PLACE) { diff --git a/src/mpi/coll/allgather/allgather_intra_k_brucks.c b/src/mpi/coll/allgather/allgather_intra_k_brucks.c index 010a5a8567d..20dc84c6254 100644 --- a/src/mpi/coll/allgather/allgather_intra_k_brucks.c +++ b/src/mpi/coll/allgather/allgather_intra_k_brucks.c @@ -47,9 +47,8 @@ MPIR_Allgather_intra_k_brucks(const void *sendbuf, MPI_Aint sendcount, int delta = 1; void *tmp_recvbuf = NULL; - MPIR_CHKLMEM_DECL(2); - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, (2 * (k - 1) * sizeof(MPIR_Request *)), mpi_errno, - "reqs", MPL_MEM_BUFFER); + MPIR_CHKLMEM_DECL(); + MPIR_CHKLMEM_MALLOC(reqs, (2 * (k - 1) * sizeof(MPIR_Request *))); MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST, "Allgather_brucks_radix_k algorithm: num_ranks: %d, k: %d", diff --git a/src/mpi/coll/allgatherv/allgatherv_intra_brucks.c b/src/mpi/coll/allgatherv/allgatherv_intra_brucks.c index 99f867f732d..7370d485335 100644 --- a/src/mpi/coll/allgatherv/allgatherv_intra_brucks.c +++ b/src/mpi/coll/allgatherv/allgatherv_intra_brucks.c @@ -32,7 +32,7 @@ int MPIR_Allgatherv_intra_brucks(const void *sendbuf, int pof2, src, dst, rem; MPI_Aint curr_cnt, send_cnt, recv_cnt, total_count; void *tmp_buf; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -48,8 +48,7 @@ int MPIR_Allgatherv_intra_brucks(const void *sendbuf, /* allocate a temporary buffer that can hold all the data */ MPIR_Datatype_get_size_macro(recvtype, recvtype_sz); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, total_count * recvtype_sz, mpi_errno, "tmp_buf", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, total_count * recvtype_sz); /* copy local data to the top of tmp_buf */ if (sendbuf != MPI_IN_PLACE) { diff --git a/src/mpi/coll/allgatherv/allgatherv_intra_recursive_doubling.c b/src/mpi/coll/allgatherv/allgatherv_intra_recursive_doubling.c index d083b43e411..a3a2889debe 100644 --- a/src/mpi/coll/allgatherv/allgatherv_intra_recursive_doubling.c +++ b/src/mpi/coll/allgatherv/allgatherv_intra_recursive_doubling.c @@ -36,7 +36,7 @@ int MPIR_Allgatherv_intra_recursive_doubling(const void *sendbuf, void *tmp_buf; int mask, dst_tree_root, my_tree_root, nprocs_completed, k, tmp_mask, tree_root; MPI_Aint position, send_offset, recv_offset, offset; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -58,8 +58,7 @@ int MPIR_Allgatherv_intra_recursive_doubling(const void *sendbuf, MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); MPIR_Datatype_get_size_macro(recvtype, recvtype_sz); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, - total_count * recvtype_sz, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, total_count * recvtype_sz); /* copy local data into right location in tmp_buf */ position = 0; diff --git a/src/mpi/coll/allreduce/allreduce_inter_reduce_exchange_bcast.c b/src/mpi/coll/allreduce/allreduce_inter_reduce_exchange_bcast.c index ab199653c20..c56c92f9ed8 100644 --- a/src/mpi/coll/allreduce/allreduce_inter_reduce_exchange_bcast.c +++ b/src/mpi/coll/allreduce/allreduce_inter_reduce_exchange_bcast.c @@ -17,17 +17,16 @@ int MPIR_Allreduce_inter_reduce_exchange_bcast(const void *sendbuf, void *recvbu MPI_Datatype datatype, MPI_Op op, MPIR_Comm * comm_ptr, MPIR_Errflag_t errflag) { - int mpi_errno; + int mpi_errno = MPI_SUCCESS; MPI_Aint true_extent, true_lb, extent; void *tmp_buf = NULL; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (comm_ptr->rank == 0) { MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); } diff --git a/src/mpi/coll/allreduce/allreduce_intra_k_reduce_scatter_allgather.c b/src/mpi/coll/allreduce/allreduce_intra_k_reduce_scatter_allgather.c index cb46472865c..fb0e71fd90d 100644 --- a/src/mpi/coll/allreduce/allreduce_intra_k_reduce_scatter_allgather.c +++ b/src/mpi/coll/allreduce/allreduce_intra_k_reduce_scatter_allgather.c @@ -32,7 +32,7 @@ int MPIR_Allreduce_intra_k_reduce_scatter_allgather(const void *sendbuf, MPIR_Request **send_reqs = NULL, **recv_reqs = NULL; int num_sreq = 0, num_rreq = 0, total_phases = 0; void *tmp_recvbuf = NULL; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Assert(k > 1); @@ -123,10 +123,8 @@ int MPIR_Allreduce_intra_k_reduce_scatter_allgather(const void *sendbuf, /* Main recursive exchange step */ if (in_step2) { MPI_Aint *cnts = NULL, *displs = NULL; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, sizeof(MPI_Aint) * nranks, mpi_errno, "cnts", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, sizeof(MPI_Aint) * nranks, mpi_errno, "displs", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(cnts, sizeof(MPI_Aint) * nranks); + MPIR_CHKLMEM_MALLOC(displs, sizeof(MPI_Aint) * nranks); idx = 0; rem = nranks - p_of_k; diff --git a/src/mpi/coll/allreduce/allreduce_intra_recursive_doubling.c b/src/mpi/coll/allreduce/allreduce_intra_recursive_doubling.c index 896a8d5359a..b14a3af7bd2 100644 --- a/src/mpi/coll/allreduce/allreduce_intra_recursive_doubling.c +++ b/src/mpi/coll/allreduce/allreduce_intra_recursive_doubling.c @@ -24,7 +24,7 @@ int MPIR_Allreduce_intra_recursive_doubling(const void *sendbuf, MPI_Datatype datatype, MPI_Op op, MPIR_Comm * comm_ptr, MPIR_Errflag_t errflag) { - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); int comm_size, rank; int mpi_errno = MPI_SUCCESS; int mask, dst, is_commutative, pof2, newrank, rem, newdst; @@ -39,8 +39,7 @@ int MPIR_Allreduce_intra_recursive_doubling(const void *sendbuf, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); diff --git a/src/mpi/coll/allreduce/allreduce_intra_recursive_multiplying.c b/src/mpi/coll/allreduce/allreduce_intra_recursive_multiplying.c index 7635569d0ca..51986112c9f 100644 --- a/src/mpi/coll/allreduce/allreduce_intra_recursive_multiplying.c +++ b/src/mpi/coll/allreduce/allreduce_intra_recursive_multiplying.c @@ -43,14 +43,13 @@ int MPIR_Allreduce_intra_recursive_multiplying(const void *sendbuf, pofk *= k; } - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); void *tmp_buf; /*Allocate for nb requests */ MPIR_Request **reqs; int num_reqs = 0; - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, (2 * (k - 1) * sizeof(MPIR_Request *)), mpi_errno, - "reqs", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(reqs, (2 * (k - 1) * sizeof(MPIR_Request *))); /* need to allocate temporary buffer to store incoming data */ MPI_Aint true_extent, true_lb, extent; @@ -65,8 +64,7 @@ int MPIR_Allreduce_intra_recursive_multiplying(const void *sendbuf, } } - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, (k - 1) * single_size, mpi_errno, - "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, (k - 1) * single_size); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); diff --git a/src/mpi/coll/allreduce/allreduce_intra_reduce_scatter_allgather.c b/src/mpi/coll/allreduce/allreduce_intra_reduce_scatter_allgather.c index 327148196fd..d6a88b05608 100644 --- a/src/mpi/coll/allreduce/allreduce_intra_reduce_scatter_allgather.c +++ b/src/mpi/coll/allreduce/allreduce_intra_reduce_scatter_allgather.c @@ -45,7 +45,7 @@ int MPIR_Allreduce_intra_reduce_scatter_allgather(const void *sendbuf, MPI_Op op, MPIR_Comm * comm_ptr, MPIR_Errflag_t errflag) { - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); int comm_size, rank; int mpi_errno = MPI_SUCCESS; int mask, dst, pof2, newrank, rem, newdst, i, send_idx, recv_idx, last_idx; @@ -59,8 +59,7 @@ int MPIR_Allreduce_intra_reduce_scatter_allgather(const void *sendbuf, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); @@ -126,10 +125,8 @@ int MPIR_Allreduce_intra_reduce_scatter_allgather(const void *sendbuf, if (newrank != -1) { MPI_Aint *cnts, *disps; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "counts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "displacements", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(cnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(disps, pof2 * sizeof(MPI_Aint)); for (i = 0; i < pof2; i++) cnts[i] = count / pof2; diff --git a/src/mpi/coll/allreduce/allreduce_intra_tree.c b/src/mpi/coll/allreduce/allreduce_intra_tree.c index 7a6bb4f9709..c1bb5268948 100644 --- a/src/mpi/coll/allreduce/allreduce_intra_tree.c +++ b/src/mpi/coll/allreduce/allreduce_intra_tree.c @@ -46,7 +46,7 @@ int MPIR_Allreduce_intra_tree(const void *sendbuf, extent = MPL_MAX(extent, true_extent); is_commutative = MPIR_Op_is_commutative(op); - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); /* copy local data into recvbuf */ if (sendbuf != MPI_IN_PLACE) { @@ -110,8 +110,7 @@ int MPIR_Allreduce_intra_tree(const void *sendbuf, is_tree_leaf = (num_children == 0) ? 1 : 0; if (!is_tree_leaf) { - MPIR_CHKLMEM_MALLOC(child_buffer, void **, sizeof(void *) * num_children, mpi_errno, - "child_buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(child_buffer, sizeof(void *) * num_children); child_buffer[0] = MPL_malloc(extent * count, MPL_MEM_BUFFER); MPIR_ERR_CHKANDJUMP(!child_buffer[0], mpi_errno, MPI_ERR_OTHER, "**nomem"); @@ -130,9 +129,8 @@ int MPIR_Allreduce_intra_tree(const void *sendbuf, } reduce_buffer = recvbuf; - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, - (num_children * num_chunks + num_chunks + 10) * sizeof(MPIR_Request *), - mpi_errno, "reqs", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(reqs, + (num_children * num_chunks + num_chunks + 10) * sizeof(MPIR_Request *)); for (j = 0; j < num_chunks; j++) { MPI_Aint msgsize = (j == 0) ? chunk_size_floor : chunk_size_ceil; diff --git a/src/mpi/coll/allreduce_group/allreduce_group.c b/src/mpi/coll/allreduce_group/allreduce_group.c index 68a959f17f7..15d9e2ca8e2 100644 --- a/src/mpi/coll/allreduce_group/allreduce_group.c +++ b/src/mpi/coll/allreduce_group/allreduce_group.c @@ -27,7 +27,7 @@ int MPII_Allreduce_group_intra(void *sendbuf, void *recvbuf, MPI_Aint count, void *tmp_buf; int group_rank, group_size; int cdst, csrc; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); group_rank = group_ptr->rank; group_size = group_ptr->size; @@ -39,8 +39,7 @@ int MPII_Allreduce_group_intra(void *sendbuf, void *recvbuf, MPI_Aint count, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); @@ -150,10 +149,8 @@ int MPII_Allreduce_group_intra(void *sendbuf, void *recvbuf, MPI_Aint count, * the buffer */ MPI_Aint *cnts, *disps; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "counts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, - "displacements", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(cnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(disps, pof2 * sizeof(MPI_Aint)); for (i = 0; i < (pof2 - 1); i++) cnts[i] = count / pof2; diff --git a/src/mpi/coll/alltoall/alltoall_intra_brucks.c b/src/mpi/coll/alltoall/alltoall_intra_brucks.c index 2aea8b1860d..1198c38da12 100644 --- a/src/mpi/coll/alltoall/alltoall_intra_brucks.c +++ b/src/mpi/coll/alltoall/alltoall_intra_brucks.c @@ -34,7 +34,7 @@ int MPIR_Alltoall_intra_brucks(const void *sendbuf, MPI_Datatype newtype = MPI_DATATYPE_NULL; MPI_Aint newtype_sz; void *tmp_buf; - MPIR_CHKLMEM_DECL(6); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -49,7 +49,7 @@ int MPIR_Alltoall_intra_brucks(const void *sendbuf, /* allocate temporary buffer */ MPIR_Datatype_get_size_macro(recvtype, recvtype_sz); pack_size = recvcount * comm_size * recvtype_sz; - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, pack_size, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, pack_size); /* Do Phase 1 of the algorithim. Shift the data blocks on process i * upwards by a distance of i blocks. Store the result in recvbuf. */ @@ -74,8 +74,7 @@ int MPIR_Alltoall_intra_brucks(const void *sendbuf, * communication */ MPI_Aint *displs; - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, comm_size * sizeof(MPI_Aint), mpi_errno, "displs", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(displs, comm_size * sizeof(MPI_Aint)); pof2 = 1; while (pof2 < comm_size) { diff --git a/src/mpi/coll/alltoall/alltoall_intra_k_brucks.c b/src/mpi/coll/alltoall/alltoall_intra_k_brucks.c index 9286b2a5ee4..4fd3034c243 100644 --- a/src/mpi/coll/alltoall/alltoall_intra_k_brucks.c +++ b/src/mpi/coll/alltoall/alltoall_intra_k_brucks.c @@ -127,10 +127,9 @@ int MPIR_Alltoall_intra_k_brucks(const void *sendbuf, MPIR_Request **reqs; int num_reqs = 0; - MPIR_CHKLMEM_DECL(4); + MPIR_CHKLMEM_DECL(); - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, (2 * (k - 1) * sizeof(MPIR_Request *)), mpi_errno, - "reqs", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(reqs, (2 * (k - 1) * sizeof(MPIR_Request *))); is_inplace = (sendbuf == MPI_IN_PLACE); @@ -182,8 +181,7 @@ int MPIR_Alltoall_intra_k_brucks(const void *sendbuf, } #endif /* temporary buffer used for rotation, so used as sendbuf when inplace is true */ - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, recvcnt * size * r_extent, mpi_errno, "tmp_buf", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(tmp_buf, recvcnt * size * r_extent); if (is_inplace) { mpi_errno = @@ -214,10 +212,8 @@ int MPIR_Alltoall_intra_k_brucks(const void *sendbuf, /* Step 2: Allocate buffer space for packing/receiving data for every phase */ delta = 1; - MPIR_CHKLMEM_MALLOC(tmp_sbuf, void **, sizeof(void *) * (k - 1), mpi_errno, "tmp_sbuf", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(tmp_rbuf, void **, sizeof(void *) * (k - 1), mpi_errno, "tmp_rbuf", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(tmp_sbuf, sizeof(void *) * (k - 1)); + MPIR_CHKLMEM_MALLOC(tmp_rbuf, sizeof(void *) * (k - 1)); for (j = 0; j < k - 1; j++) { tmp_sbuf[j] = (void *) MPL_malloc(r_extent * recvcnt * p_of_k, MPL_MEM_COLL); diff --git a/src/mpi/coll/alltoall/alltoall_intra_scattered.c b/src/mpi/coll/alltoall/alltoall_intra_scattered.c index f1986f99ce6..5387d59f7fd 100644 --- a/src/mpi/coll/alltoall/alltoall_intra_scattered.c +++ b/src/mpi/coll/alltoall/alltoall_intra_scattered.c @@ -40,7 +40,7 @@ int MPIR_Alltoall_intra_scattered(const void *sendbuf, int mpi_errno = MPI_SUCCESS, dst, rank; MPIR_Request **reqarray; MPI_Status *starray; - MPIR_CHKLMEM_DECL(6); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -58,11 +58,9 @@ int MPIR_Alltoall_intra_scattered(const void *sendbuf, if (bblock == 0) bblock = comm_size; - MPIR_CHKLMEM_MALLOC(reqarray, MPIR_Request **, 2 * bblock * sizeof(MPIR_Request *), mpi_errno, - "reqarray", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(reqarray, 2 * bblock * sizeof(MPIR_Request *)); - MPIR_CHKLMEM_MALLOC(starray, MPI_Status *, 2 * bblock * sizeof(MPI_Status), mpi_errno, - "starray", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(starray, 2 * bblock * sizeof(MPI_Status)); for (ii = 0; ii < comm_size; ii += bblock) { ss = comm_size - ii < bblock ? comm_size - ii : bblock; diff --git a/src/mpi/coll/alltoallv/alltoallv_intra_scattered.c b/src/mpi/coll/alltoallv/alltoallv_intra_scattered.c index 4adaeb83681..31220a8b8cc 100644 --- a/src/mpi/coll/alltoallv/alltoallv_intra_scattered.c +++ b/src/mpi/coll/alltoallv/alltoallv_intra_scattered.c @@ -35,7 +35,7 @@ int MPIR_Alltoallv_intra_scattered(const void *sendbuf, const MPI_Aint * sendcou int dst, rank, req_cnt; int ii, ss, bblock; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -52,10 +52,8 @@ int MPIR_Alltoallv_intra_scattered(const void *sendbuf, const MPI_Aint * sendcou MPIR_Datatype_get_extent_macro(sendtype, send_extent); - MPIR_CHKLMEM_MALLOC(starray, MPI_Status *, 2 * bblock * sizeof(MPI_Status), mpi_errno, - "starray", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(reqarray, MPIR_Request **, 2 * bblock * sizeof(MPIR_Request *), mpi_errno, - "reqarray", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(starray, 2 * bblock * sizeof(MPI_Status)); + MPIR_CHKLMEM_MALLOC(reqarray, 2 * bblock * sizeof(MPIR_Request *)); /* post only bblock isends/irecvs at a time as suggested by Tony Ladd */ for (ii = 0; ii < comm_size; ii += bblock) { diff --git a/src/mpi/coll/alltoallw/alltoallw_intra_scattered.c b/src/mpi/coll/alltoallw/alltoallw_intra_scattered.c index f0063d4ad91..f76b36ef721 100644 --- a/src/mpi/coll/alltoallw/alltoallw_intra_scattered.c +++ b/src/mpi/coll/alltoallw/alltoallw_intra_scattered.c @@ -33,7 +33,7 @@ int MPIR_Alltoallw_intra_scattered(const void *sendbuf, const MPI_Aint sendcount int outstanding_requests; int ii, ss, bblock; MPI_Aint type_size; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -50,10 +50,8 @@ int MPIR_Alltoallw_intra_scattered(const void *sendbuf, const MPI_Aint sendcount if (bblock == 0) bblock = comm_size; - MPIR_CHKLMEM_MALLOC(starray, MPI_Status *, 2 * bblock * sizeof(MPI_Status), mpi_errno, - "starray", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(reqarray, MPIR_Request **, 2 * bblock * sizeof(MPIR_Request *), mpi_errno, - "reqarray", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(starray, 2 * bblock * sizeof(MPI_Status)); + MPIR_CHKLMEM_MALLOC(reqarray, 2 * bblock * sizeof(MPIR_Request *)); /* post only bblock isends/irecvs at a time as suggested by Tony Ladd */ for (ii = 0; ii < comm_size; ii += bblock) { diff --git a/src/mpi/coll/bcast/bcast_intra_binomial.c b/src/mpi/coll/bcast/bcast_intra_binomial.c index 77d3bd73d24..20155938403 100644 --- a/src/mpi/coll/bcast/bcast_intra_binomial.c +++ b/src/mpi/coll/bcast/bcast_intra_binomial.c @@ -30,7 +30,7 @@ int MPIR_Bcast_intra_binomial(void *buffer, int is_contig; MPI_Aint type_size; void *tmp_buf = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -47,7 +47,7 @@ int MPIR_Bcast_intra_binomial(void *buffer, goto fn_exit; /* nothing to do */ if (!is_contig) { - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, nbytes, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, nbytes); /* TODO: Pipeline the packing and communication */ if (rank == root) { diff --git a/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c b/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c index 13f8e3a4ba0..c4aea937169 100644 --- a/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c +++ b/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c @@ -29,7 +29,7 @@ int MPIR_Bcast_intra_pipelined_tree(void *buffer, MPIR_Request **reqs = NULL; MPI_Status *statuses = NULL; MPIR_Treealgo_tree_t my_tree; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -55,7 +55,7 @@ int MPIR_Bcast_intra_pipelined_tree(void *buffer, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); sendbuf = (char *) buffer + true_lb; } else { - MPIR_CHKLMEM_MALLOC(sendbuf, void *, nbytes, mpi_errno, "sendbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(sendbuf, nbytes); if (rank == root) { mpi_errno = MPIR_Typerep_pack(buffer, count, datatype, 0, sendbuf, nbytes, &actual_packed_unpacked_bytes, MPIR_TYPEREP_FLAG_NONE); @@ -95,12 +95,10 @@ int MPIR_Bcast_intra_pipelined_tree(void *buffer, } if (is_nb) { - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, - sizeof(MPIR_Request *) * (num_children * num_chunks + num_chunks), - mpi_errno, "request array", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(statuses, MPI_Status *, - sizeof(MPI_Status) * (num_children * num_chunks + num_chunks), - mpi_errno, "status array", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reqs, + sizeof(MPIR_Request *) * (num_children * num_chunks + num_chunks)); + MPIR_CHKLMEM_MALLOC(statuses, + sizeof(MPI_Status) * (num_children * num_chunks + num_chunks)); } if (tree_type != MPIR_TREE_TYPE_KARY && my_tree.parent != -1) diff --git a/src/mpi/coll/bcast/bcast_intra_scatter_recursive_doubling_allgather.c b/src/mpi/coll/bcast/bcast_intra_scatter_recursive_doubling_allgather.c index 95f23dd51e5..cb0de9f5f04 100644 --- a/src/mpi/coll/bcast/bcast_intra_scatter_recursive_doubling_allgather.c +++ b/src/mpi/coll/bcast/bcast_intra_scatter_recursive_doubling_allgather.c @@ -41,7 +41,7 @@ int MPIR_Bcast_intra_scatter_recursive_doubling_allgather(void *buffer, MPI_Aint type_size, nbytes; int relative_dst, dst_tree_root, my_tree_root; int tree_root, nprocs_completed; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPI_Aint true_extent, true_lb; void *tmp_buf; @@ -67,7 +67,7 @@ int MPIR_Bcast_intra_scatter_recursive_doubling_allgather(void *buffer, tmp_buf = MPIR_get_contig_ptr(buffer, true_lb); } else { - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, nbytes, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, nbytes); if (rank == root) { mpi_errno = MPIR_Localcopy(buffer, count, datatype, tmp_buf, nbytes, MPI_BYTE); diff --git a/src/mpi/coll/bcast/bcast_intra_scatter_ring_allgather.c b/src/mpi/coll/bcast/bcast_intra_scatter_ring_allgather.c index 41e17b99e3c..21761746c68 100644 --- a/src/mpi/coll/bcast/bcast_intra_scatter_ring_allgather.c +++ b/src/mpi/coll/bcast/bcast_intra_scatter_ring_allgather.c @@ -36,7 +36,7 @@ int MPIR_Bcast_intra_scatter_ring_allgather(void *buffer, MPI_Aint recvd_size, curr_size = 0; MPI_Status status; MPI_Aint true_extent, true_lb; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -59,7 +59,7 @@ int MPIR_Bcast_intra_scatter_ring_allgather(void *buffer, tmp_buf = MPIR_get_contig_ptr(buffer, true_lb); } else { - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, nbytes, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, nbytes); if (rank == root) { mpi_errno = MPIR_Localcopy(buffer, count, datatype, tmp_buf, nbytes, MPI_BYTE); diff --git a/src/mpi/coll/bcast/bcast_intra_tree.c b/src/mpi/coll/bcast/bcast_intra_tree.c index 6cd2f02ba7e..7b0d88c02d7 100644 --- a/src/mpi/coll/bcast/bcast_intra_tree.c +++ b/src/mpi/coll/bcast/bcast_intra_tree.c @@ -27,7 +27,7 @@ int MPIR_Bcast_intra_tree(void *buffer, MPI_Datatype dtype; MPIR_Treealgo_tree_t my_tree; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -52,7 +52,7 @@ int MPIR_Bcast_intra_tree(void *buffer, dtype = datatype; if (!is_contig) { - MPIR_CHKLMEM_MALLOC(send_buf, void *, nbytes, mpi_errno, "send_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(send_buf, nbytes); /* TODO: Pipeline the packing and communication */ if (rank == root) { @@ -120,10 +120,8 @@ int MPIR_Bcast_intra_tree(void *buffer, } if (is_nb) { - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, sizeof(MPIR_Request *) * num_children, - mpi_errno, "request array", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(statuses, MPI_Status *, sizeof(MPI_Status) * num_children, - mpi_errno, "status array", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reqs, sizeof(MPIR_Request *) * num_children); + MPIR_CHKLMEM_MALLOC(statuses, sizeof(MPI_Status) * num_children); } if ((parent != -1 && tree_type != MPIR_TREE_TYPE_KARY) diff --git a/src/mpi/coll/exscan/exscan_intra_recursive_doubling.c b/src/mpi/coll/exscan/exscan_intra_recursive_doubling.c index b21c91636cd..ae7cd9df320 100644 --- a/src/mpi/coll/exscan/exscan_intra_recursive_doubling.c +++ b/src/mpi/coll/exscan/exscan_intra_recursive_doubling.c @@ -56,7 +56,7 @@ int MPIR_Exscan_intra_recursive_doubling(const void *sendbuf, int mask, dst, is_commutative, flag; MPI_Aint true_extent, true_lb, extent; void *partial_scan, *tmp_buf; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -67,14 +67,12 @@ int MPIR_Exscan_intra_recursive_doubling(const void *sendbuf, MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(partial_scan, void *, (count * (MPL_MAX(true_extent, extent))), mpi_errno, - "partial_scan", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(partial_scan, count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ partial_scan = (void *) ((char *) partial_scan - true_lb); /* need to allocate temporary buffer to store incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, (count * (MPL_MAX(true_extent, extent))), mpi_errno, - "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); diff --git a/src/mpi/coll/gather/gather_inter_local_gather_remote_send.c b/src/mpi/coll/gather/gather_inter_local_gather_remote_send.c index 934aca48fa3..c0b13fd4cff 100644 --- a/src/mpi/coll/gather/gather_inter_local_gather_remote_send.c +++ b/src/mpi/coll/gather/gather_inter_local_gather_remote_send.c @@ -21,7 +21,7 @@ int MPIR_Gather_inter_local_gather_remote_send(const void *sendbuf, MPI_Aint sen int rank, local_size, remote_size, mpi_errno = MPI_SUCCESS; MPI_Status status; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (root == MPI_PROC_NULL) { /* local processes other than root do nothing */ @@ -48,9 +48,7 @@ int MPIR_Gather_inter_local_gather_remote_send(const void *sendbuf, MPI_Aint sen if (rank == 0) { MPIR_Datatype_get_size_macro(sendtype, sendtype_sz); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, - sendcount * local_size * sendtype_sz, mpi_errno, - "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, sendcount * local_size * sendtype_sz); } else { /* silence -Wmaybe-uninitialized due to MPIR_Gather by non-zero ranks */ sendtype_sz = 0; diff --git a/src/mpi/coll/gather/gather_intra_binomial.c b/src/mpi/coll/gather/gather_intra_binomial.c index d8915452cda..e6c7f708afb 100644 --- a/src/mpi/coll/gather/gather_intra_binomial.c +++ b/src/mpi/coll/gather/gather_intra_binomial.c @@ -54,7 +54,7 @@ int MPIR_Gather_intra_binomial(const void *sendbuf, MPI_Aint sendcount, MPI_Data MPI_Aint extent = 0; /* Datatype extent */ MPI_Datatype types[2], tmp_type; int copy_offset = 0, copy_blks = 0; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -98,7 +98,7 @@ int MPIR_Gather_intra_binomial(const void *sendbuf, MPI_Aint sendcount, MPI_Data tmp_buf_size = 0; if (tmp_buf_size) { - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, tmp_buf_size, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, tmp_buf_size); } if (rank == root) { diff --git a/src/mpi/coll/gatherv/gatherv_allcomm_linear.c b/src/mpi/coll/gatherv/gatherv_allcomm_linear.c index cabf1ef9bb8..113ee272249 100644 --- a/src/mpi/coll/gatherv/gatherv_allcomm_linear.c +++ b/src/mpi/coll/gatherv/gatherv_allcomm_linear.c @@ -30,7 +30,7 @@ int MPIR_Gatherv_allcomm_linear(const void *sendbuf, int i, reqs; MPIR_Request **reqarray; MPI_Status *starray; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -42,10 +42,8 @@ int MPIR_Gatherv_allcomm_linear(const void *sendbuf, MPIR_Datatype_get_extent_macro(recvtype, extent); - MPIR_CHKLMEM_MALLOC(reqarray, MPIR_Request **, comm_size * sizeof(MPIR_Request *), - mpi_errno, "reqarray", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(starray, MPI_Status *, comm_size * sizeof(MPI_Status), mpi_errno, - "starray", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(reqarray, comm_size * sizeof(MPIR_Request *)); + MPIR_CHKLMEM_MALLOC(starray, comm_size * sizeof(MPI_Status)); reqs = 0; for (i = 0; i < comm_size; i++) { diff --git a/src/mpi/coll/helper_fns.c b/src/mpi/coll/helper_fns.c index 66fe0632f52..d45a770d50b 100644 --- a/src/mpi/coll/helper_fns.c +++ b/src/mpi/coll/helper_fns.c @@ -307,7 +307,7 @@ int MPIC_Sendrecv_replace(void *buf, MPI_Aint count, MPI_Datatype datatype, void *tmpbuf = NULL; MPI_Aint tmpbuf_size = 0; MPI_Aint actual_pack_bytes = 0; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -321,8 +321,7 @@ int MPIC_Sendrecv_replace(void *buf, MPI_Aint count, MPI_Datatype datatype, if (count > 0 && dest != MPI_PROC_NULL) { MPIR_Pack_size(count, datatype, &tmpbuf_size); - MPIR_CHKLMEM_MALLOC(tmpbuf, void *, tmpbuf_size, mpi_errno, "temporary send buffer", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmpbuf, tmpbuf_size); mpi_errno = MPIR_Typerep_pack(buf, count, datatype, 0, tmpbuf, tmpbuf_size, &actual_pack_bytes, @@ -465,7 +464,7 @@ int MPIC_Waitall(int numreq, MPIR_Request * requests[], MPI_Status * statuses) int i; MPI_Status status_static_array[MPIC_REQUEST_PTR_ARRAY_SIZE]; MPI_Status *status_array = statuses; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -475,8 +474,7 @@ int MPIC_Waitall(int numreq, MPIR_Request * requests[], MPI_Status * statuses) if (numreq > MPIC_REQUEST_PTR_ARRAY_SIZE) { if (statuses == MPI_STATUSES_IGNORE) { - MPIR_CHKLMEM_MALLOC(status_array, MPI_Status *, numreq * sizeof(MPI_Status), mpi_errno, - "status objects", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(status_array, numreq * sizeof(MPI_Status)); } } diff --git a/src/mpi/coll/iallgather/iallgather_tsp_brucks.c b/src/mpi/coll/iallgather/iallgather_tsp_brucks.c index 8e526ac45b3..c35c424cc42 100644 --- a/src/mpi/coll/iallgather/iallgather_tsp_brucks.c +++ b/src/mpi/coll/iallgather/iallgather_tsp_brucks.c @@ -34,7 +34,7 @@ MPIR_TSP_Iallgather_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, int i_recv = 0; int *recv_id = NULL; void *tmp_recvbuf = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); /* For correctness, transport based collectives need to get the * tag from the same pool as schedule based collectives */ @@ -66,8 +66,7 @@ MPIR_TSP_Iallgather_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, if (MPL_ipow(k, nphases) == size) p_of_k = 1; - MPIR_CHKLMEM_MALLOC(recv_id, int *, sizeof(int) * nphases * (k - 1), - mpi_errno, "recv_id buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(recv_id, sizeof(int) * nphases * (k - 1)); if (rank == 0) tmp_recvbuf = recvbuf; diff --git a/src/mpi/coll/iallgather/iallgather_tsp_recexch.c b/src/mpi/coll/iallgather/iallgather_tsp_recexch.c index 6f554bacecc..22fb5a25ccb 100644 --- a/src/mpi/coll/iallgather/iallgather_tsp_recexch.c +++ b/src/mpi/coll/iallgather/iallgather_tsp_recexch.c @@ -249,7 +249,7 @@ int MPIR_TSP_Iallgather_sched_intra_recexch(const void *sendbuf, MPI_Aint sendco int *recv_id; int tag; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -272,8 +272,7 @@ int MPIR_TSP_Iallgather_sched_intra_recexch(const void *sendbuf, MPI_Aint sendco &step2_nbrs, &step2_nphases, &p_of_k, &T); is_instep2 = (step1_sendto == -1); /* whether this rank participates in Step 2 */ log_pofk = step2_nphases; - MPIR_CHKLMEM_MALLOC(recv_id, int *, sizeof(int) * ((step2_nphases * (k - 1)) + 1), - mpi_errno, "recv_id buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(recv_id, sizeof(int) * ((step2_nphases * (k - 1)) + 1)); if (!is_inplace && is_instep2) { /* copy the data to recvbuf but only if you are a rank participating in Step 2 */ diff --git a/src/mpi/coll/iallgatherv/iallgatherv_tsp_brucks.c b/src/mpi/coll/iallgatherv/iallgatherv_tsp_brucks.c index 896cc02847e..cdcfb7aee6e 100644 --- a/src/mpi/coll/iallgatherv/iallgatherv_tsp_brucks.c +++ b/src/mpi/coll/iallgatherv/iallgatherv_tsp_brucks.c @@ -48,7 +48,7 @@ MPIR_TSP_Iallgatherv_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, int *recv_id = NULL; MPI_Aint *recv_index = NULL; int *scount_lookup = NULL; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); void *tmp_recvbuf = NULL; int **s_counts = NULL; int **r_counts = NULL; @@ -96,14 +96,11 @@ MPIR_TSP_Iallgatherv_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, p_of_k = 1; /* if nphases=0 then no recv_id needed */ - MPIR_CHKLMEM_MALLOC(recv_id, int *, sizeof(int) * nphases * (k - 1), mpi_errno, "recv_id", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(scount_lookup, int *, sizeof(int) * nphases, mpi_errno, "scount_lookup", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(recv_id, sizeof(int) * nphases * (k - 1)); + MPIR_CHKLMEM_MALLOC(scount_lookup, sizeof(int) * nphases); /* To store the index to receive in various phases and steps within */ - MPIR_CHKLMEM_MALLOC(recv_index, MPI_Aint *, sizeof(MPI_Aint) * nphases * (k - 1), mpi_errno, - "recv_index", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(recv_index, sizeof(MPI_Aint) * nphases * (k - 1)); for (i = 0; i < size; i++) total_recvcount += recvcounts[i]; diff --git a/src/mpi/coll/iallreduce/iallreduce_intra_sched_reduce_scatter_allgather.c b/src/mpi/coll/iallreduce/iallreduce_intra_sched_reduce_scatter_allgather.c index 75bab1d9a84..c2dfcac6496 100644 --- a/src/mpi/coll/iallreduce/iallreduce_intra_sched_reduce_scatter_allgather.c +++ b/src/mpi/coll/iallreduce/iallreduce_intra_sched_reduce_scatter_allgather.c @@ -16,7 +16,7 @@ int MPIR_Iallreduce_intra_sched_reduce_scatter_allgather(const void *sendbuf, vo int i, send_idx, recv_idx, last_idx, mask, newdst, dst; MPI_Aint true_lb, true_extent, extent; void *tmp_buf = NULL; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); #ifdef HAVE_ERROR_CHECKING /* we only support builtin datatypes for now, breaking up user types to do @@ -92,10 +92,8 @@ int MPIR_Iallreduce_intra_sched_reduce_scatter_allgather(const void *sendbuf, vo * "2*pof2"-sized memory allocation */ MPI_Aint *cnts, *disps; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "counts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "displacements", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(cnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(disps, pof2 * sizeof(MPI_Aint)); MPIR_Assert(count >= pof2); /* the cnts calculations assume this */ for (i = 0; i < (pof2 - 1); i++) diff --git a/src/mpi/coll/iallreduce/iallreduce_tsp_recexch_reduce_scatter_recexch_allgatherv.c b/src/mpi/coll/iallreduce/iallreduce_tsp_recexch_reduce_scatter_recexch_allgatherv.c index b741e42df12..6ca8da987ba 100644 --- a/src/mpi/coll/iallreduce/iallreduce_tsp_recexch_reduce_scatter_recexch_allgatherv.c +++ b/src/mpi/coll/iallreduce/iallreduce_tsp_recexch_reduce_scatter_recexch_allgatherv.c @@ -40,7 +40,7 @@ int MPIR_TSP_Iallreduce_sched_intra_recexch_reduce_scatter_recexch_allgatherv(co MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; int allgather_algo_type = MPIR_IALLGATHER_RECEXCH_TYPE_DISTANCE_HALVING; int redscat_algo_type = IREDUCE_SCATTER_RECEXCH_TYPE_DISTANCE_HALVING; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -96,10 +96,8 @@ int MPIR_TSP_Iallreduce_sched_intra_recexch_reduce_scatter_recexch_allgatherv(co MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST, "Start Step2")); if (in_step2) { - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, sizeof(MPI_Aint) * nranks, mpi_errno, "cnts", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, sizeof(MPI_Aint) * nranks, mpi_errno, "displs", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(cnts, sizeof(MPI_Aint) * nranks); + MPIR_CHKLMEM_MALLOC(displs, sizeof(MPI_Aint) * nranks); int idx = 0; rem = nranks - p_of_k; diff --git a/src/mpi/coll/iallreduce/iallreduce_tsp_ring.c b/src/mpi/coll/iallreduce/iallreduce_tsp_ring.c index fb136764b87..aac9679ff22 100644 --- a/src/mpi/coll/iallreduce/iallreduce_tsp_ring.c +++ b/src/mpi/coll/iallreduce/iallreduce_tsp_ring.c @@ -27,7 +27,7 @@ int MPIR_TSP_Iallreduce_sched_intra_ring(const void *sendbuf, void *recvbuf, MPI MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(4); + MPIR_CHKLMEM_DECL(); is_inplace = (sendbuf == MPI_IN_PLACE); nranks = MPIR_Comm_size(comm); @@ -37,10 +37,8 @@ int MPIR_TSP_Iallreduce_sched_intra_ring(const void *sendbuf, void *recvbuf, MPI MPIR_Type_get_true_extent_impl(datatype, &lb, &true_extent); extent = MPL_MAX(extent, true_extent); - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, nranks * sizeof(MPI_Aint), mpi_errno, "cnts", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, nranks * sizeof(MPI_Aint), mpi_errno, "displs", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(cnts, nranks * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(displs, nranks * sizeof(MPI_Aint)); for (i = 0; i < nranks; i++) cnts[i] = 0; @@ -71,7 +69,7 @@ int MPIR_TSP_Iallreduce_sched_intra_ring(const void *sendbuf, void *recvbuf, MPI /* Phase 2: Ring based send recv reduce scatter */ /* Need only 2 spaces for current and previous reduce_id(s) */ - MPIR_CHKLMEM_MALLOC(reduce_id, int *, 2 * sizeof(int), mpi_errno, "reduce_id", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reduce_id, 2 * sizeof(int)); tmpbuf = MPIR_TSP_sched_malloc(count * extent, sched); src = (nranks + rank - 1) % nranks; @@ -104,7 +102,7 @@ int MPIR_TSP_Iallreduce_sched_intra_ring(const void *sendbuf, void *recvbuf, MPI datatype, dst, tag, comm, sched, nvtcs, &vtcs, &vtx_id); MPIR_ERR_CHECK(mpi_errno); } - MPIR_CHKLMEM_MALLOC(reduce_id, int *, 2 * sizeof(int), mpi_errno, "reduce_id", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reduce_id, 2 * sizeof(int)); mpi_errno = MPIR_TSP_sched_fence(sched); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpi/coll/iallreduce/iallreduce_tsp_tree.c b/src/mpi/coll/iallreduce/iallreduce_tsp_tree.c index 64c84cc6af1..6afb18df903 100644 --- a/src/mpi/coll/iallreduce/iallreduce_tsp_tree.c +++ b/src/mpi/coll/iallreduce/iallreduce_tsp_tree.c @@ -33,7 +33,7 @@ int MPIR_TSP_Iallreduce_sched_intra_tree(const void *sendbuf, void *recvbuf, MPI int tag, vtx_id; int root = 0; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -98,13 +98,10 @@ int MPIR_TSP_Iallreduce_sched_intra_tree(const void *sendbuf, void *recvbuf, MPI } /* initialize arrays to store graph vertex indices */ - MPIR_CHKLMEM_MALLOC(vtcs, int *, sizeof(int) * (num_children + 1), - mpi_errno, "vtcs buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(vtcs, sizeof(int) * (num_children + 1)); if (num_children > 0) { - MPIR_CHKLMEM_MALLOC(reduce_id, int *, sizeof(int) * num_children, - mpi_errno, "reduce_id buffer", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(recv_id, int *, sizeof(int) * num_children, - mpi_errno, "recv_id buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reduce_id, sizeof(int) * num_children); + MPIR_CHKLMEM_MALLOC(recv_id, sizeof(int) * num_children); } /* do pipelined allreduce */ diff --git a/src/mpi/coll/ialltoall/ialltoall_intra_sched_brucks.c b/src/mpi/coll/ialltoall/ialltoall_intra_sched_brucks.c index 154176f55ff..f4549841868 100644 --- a/src/mpi/coll/ialltoall/ialltoall_intra_sched_brucks.c +++ b/src/mpi/coll/ialltoall/ialltoall_intra_sched_brucks.c @@ -31,7 +31,7 @@ int MPIR_Ialltoall_intra_sched_brucks(const void *sendbuf, MPI_Aint sendcount, int pof2, dst, src; int count, block; MPI_Datatype newtype; - MPIR_CHKLMEM_DECL(1); /* displs */ + MPIR_CHKLMEM_DECL(); /* displs */ #ifdef HAVE_ERROR_CHECKING MPIR_Assert(sendbuf != MPI_IN_PLACE); /* we do not handle in-place */ @@ -74,8 +74,7 @@ int MPIR_Ialltoall_intra_sched_brucks(const void *sendbuf, MPI_Aint sendcount, * communication */ MPI_Aint *displs; - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, comm_size * sizeof(MPI_Aint), mpi_errno, "displs", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(displs, comm_size * sizeof(MPI_Aint)); pof2 = 1; while (pof2 < comm_size) { diff --git a/src/mpi/coll/ialltoall/ialltoall_tsp_brucks.c b/src/mpi/coll/ialltoall/ialltoall_tsp_brucks.c index 4d19c6fdf08..56f675bd590 100644 --- a/src/mpi/coll/ialltoall/ialltoall_tsp_brucks.c +++ b/src/mpi/coll/ialltoall/ialltoall_tsp_brucks.c @@ -140,7 +140,7 @@ MPIR_TSP_Ialltoall_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, int tag; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(6); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -149,13 +149,10 @@ MPIR_TSP_Ialltoall_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, mpi_errno = MPIR_Sched_next_tag(comm, &tag); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(pack_invtcs, int *, sizeof(int) * k, mpi_errno, "pack_invtcs", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(recv_invtcs, int *, sizeof(int) * k, mpi_errno, "recv_invtcs", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(unpack_invtcs, int *, sizeof(int) * k, mpi_errno, "unpack_invtcs", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(invtcs, int *, sizeof(int) * 6 * k, mpi_errno, "invtcs", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(pack_invtcs, sizeof(int) * k); + MPIR_CHKLMEM_MALLOC(recv_invtcs, sizeof(int) * k); + MPIR_CHKLMEM_MALLOC(unpack_invtcs, sizeof(int) * k); + MPIR_CHKLMEM_MALLOC(invtcs, sizeof(int) * 6 * k); is_inplace = (sendbuf == MPI_IN_PLACE); @@ -224,10 +221,8 @@ MPIR_TSP_Ialltoall_sched_intra_brucks(const void *sendbuf, MPI_Aint sendcount, /* Step 2: Allocate buffer space for packing/receiving data for every phase */ delta = 1; - MPIR_CHKLMEM_MALLOC(tmp_sbuf, void ***, sizeof(void **) * nphases, mpi_errno, "tmp_sbuf", - MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(tmp_rbuf, void ***, sizeof(void **) * nphases, mpi_errno, "tmp_rbuf", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(tmp_sbuf, sizeof(void **) * nphases); + MPIR_CHKLMEM_MALLOC(tmp_rbuf, sizeof(void **) * nphases); for (i = 0; i < nphases; i++) { tmp_sbuf[i] = (void **) MPL_malloc(sizeof(void *) * (k - 1), MPL_MEM_COLL); diff --git a/src/mpi/coll/ialltoallv/ialltoallv_tsp_scattered.c b/src/mpi/coll/ialltoallv/ialltoallv_tsp_scattered.c index 4266aec8f32..c0d6061acf7 100644 --- a/src/mpi/coll/ialltoallv/ialltoallv_tsp_scattered.c +++ b/src/mpi/coll/ialltoallv/ialltoallv_tsp_scattered.c @@ -21,7 +21,7 @@ int MPIR_TSP_Ialltoallv_sched_intra_scattered(const void *sendbuf, const MPI_Ain int tag; int *vtcs, *recv_id, *send_id; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_Assert(!(sendbuf == MPI_IN_PLACE)); @@ -42,9 +42,9 @@ int MPIR_TSP_Ialltoallv_sched_intra_scattered(const void *sendbuf, const MPI_Ain bblock = size; /* vtcs is twice the batch size to store both send and recv ids */ - MPIR_CHKLMEM_MALLOC(vtcs, int *, 2 * batch_size * sizeof(int), mpi_errno, "vtcs", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(recv_id, int *, bblock * sizeof(int), mpi_errno, "recv_id", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(send_id, int *, bblock * sizeof(int), mpi_errno, "send_id", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(vtcs, 2 * batch_size * sizeof(int)); + MPIR_CHKLMEM_MALLOC(recv_id, bblock * sizeof(int)); + MPIR_CHKLMEM_MALLOC(send_id, bblock * sizeof(int)); /* Get datatype info of sendtype and recvtype */ MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); diff --git a/src/mpi/coll/ibarrier/ibarrier_intra_tsp_dissem.c b/src/mpi/coll/ibarrier/ibarrier_intra_tsp_dissem.c index bb59afc82be..011f076cd18 100644 --- a/src/mpi/coll/ibarrier/ibarrier_intra_tsp_dissem.c +++ b/src/mpi/coll/ibarrier/ibarrier_intra_tsp_dissem.c @@ -15,7 +15,7 @@ int MPIR_TSP_Ibarrier_sched_intra_k_dissemination(MPIR_Comm * comm, int k, MPIR_ int nphases = 0; int tag, vtx_id; int *recv_ids = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -35,7 +35,7 @@ int MPIR_TSP_Ibarrier_sched_intra_k_dissemination(MPIR_Comm * comm, int k, MPIR_ MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, (MPL_DBG_FDEST, "dissem barrier - number of phases = %d\n", nphases)); - MPIR_CHKLMEM_MALLOC(recv_ids, int *, sizeof(int) * nphases * (k - 1), mpi_errno, "recv_ids", MPL_MEM_COLL); /* to store size of subtree of each child */ + MPIR_CHKLMEM_MALLOC(recv_ids, sizeof(int) * nphases * (k - 1)); shift = 1; for (i = 0; i < nphases; i++) { MPL_DBG_MSG_FMT(MPIR_DBG_COLL, VERBOSE, diff --git a/src/mpi/coll/ibcast/ibcast_tsp_scatterv_allgatherv.c b/src/mpi/coll/ibcast/ibcast_tsp_scatterv_allgatherv.c index f7601720547..b51b962aa35 100644 --- a/src/mpi/coll/ibcast/ibcast_tsp_scatterv_allgatherv.c +++ b/src/mpi/coll/ibcast/ibcast_tsp_scatterv_allgatherv.c @@ -28,7 +28,7 @@ int MPIR_TSP_Ibcast_sched_intra_scatterv_allgatherv(void *buffer, MPI_Aint count int num_children, *child_subtree_size = NULL; int num_send_dependencies; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); /* For correctness, transport based collectives need to get the * tag from the same pool as schedule based collectives */ @@ -53,8 +53,8 @@ int MPIR_TSP_Ibcast_sched_intra_scatterv_allgatherv(void *buffer, MPI_Aint count extent = MPL_MAX(extent, true_extent); nbytes = type_size * count; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, sizeof(MPI_Aint) * size, mpi_errno, "cnts", MPL_MEM_COLL); /* to store counts of each rank */ - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, sizeof(MPI_Aint) * size, mpi_errno, "displs", MPL_MEM_COLL); /* to store displs of each rank */ + MPIR_CHKLMEM_MALLOC(cnts, sizeof(MPI_Aint) * size); + MPIR_CHKLMEM_MALLOC(displs, sizeof(MPI_Aint) * size); total_count = 0; for (i = 0; i < size; i++) @@ -95,7 +95,7 @@ int MPIR_TSP_Ibcast_sched_intra_scatterv_allgatherv(void *buffer, MPI_Aint count MPIR_ERR_CHECK(mpi_errno); num_children = my_tree.num_children; - MPIR_CHKLMEM_MALLOC(child_subtree_size, int *, sizeof(int) * num_children, mpi_errno, "child_subtree_size buffer", MPL_MEM_COLL); /* to store size of subtree of each child */ + MPIR_CHKLMEM_MALLOC(child_subtree_size, sizeof(int) * num_children); /* calculate size of subtree of each child */ /* get tree information of the parent */ diff --git a/src/mpi/coll/igather/igather_tsp_tree.c b/src/mpi/coll/igather/igather_tsp_tree.c index 45b4e6517ef..e4be36dda05 100644 --- a/src/mpi/coll/igather/igather_tsp_tree.c +++ b/src/mpi/coll/igather/igather_tsp_tree.c @@ -27,7 +27,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, MPI_Aint sendcount, int num_dependencies; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; MPI_Aint *child_data_offset; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -66,8 +66,8 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, MPI_Aint sendcount, recvtype_extent = MPL_MAX(recvtype_extent, recvtype_true_extent); num_children = my_tree.num_children; - MPIR_CHKLMEM_MALLOC(child_subtree_size, int *, sizeof(int) * num_children, mpi_errno, "child_subtree_size buffer", MPL_MEM_COLL); /* to store size of subtree of each child */ - MPIR_CHKLMEM_MALLOC(child_data_offset, MPI_Aint *, sizeof(MPI_Aint) * num_children, mpi_errno, "child_data_offset buffer", MPL_MEM_COLL); /* to store the offset of the data to be sent to each child */ + MPIR_CHKLMEM_MALLOC(child_subtree_size, sizeof(int) * num_children); + MPIR_CHKLMEM_MALLOC(child_data_offset, sizeof(MPI_Aint) * num_children); /* calculate size of subtree of each child */ @@ -130,8 +130,7 @@ int MPIR_TSP_Igather_sched_intra_tree(const void *sendbuf, MPI_Aint sendcount, tmp_buf = (void *) sendbuf; } - MPIR_CHKLMEM_MALLOC(recv_id, int *, sizeof(int) * num_children, - mpi_errno, "recv_id buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(recv_id, sizeof(int) * num_children); /* Leaf nodes send to parent */ if (num_children == 0) { mpi_errno = diff --git a/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_allcomm_sched_linear.c b/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_allcomm_sched_linear.c index c4037e5b4e2..abde129a1ed 100644 --- a/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_allcomm_sched_linear.c +++ b/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_allcomm_sched_linear.c @@ -22,14 +22,14 @@ int MPIR_Ineighbor_allgather_allcomm_sched_linear(const void *sendbuf, MPI_Aint int k, l; int *srcs, *dsts; MPI_Aint recvtype_extent; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_tsp_linear.c b/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_tsp_linear.c index 237275ce321..ac8b5d0d403 100644 --- a/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_tsp_linear.c +++ b/src/mpi/coll/ineighbor_allgather/ineighbor_allgather_tsp_linear.c @@ -23,14 +23,14 @@ int MPIR_TSP_Ineighbor_allgather_sched_allcomm_linear(const void *sendbuf, MPI_A MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_allcomm_sched_linear.c b/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_allcomm_sched_linear.c index b4c51feb741..0f9fcb9bc69 100644 --- a/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_allcomm_sched_linear.c +++ b/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_allcomm_sched_linear.c @@ -23,14 +23,14 @@ int MPIR_Ineighbor_allgatherv_allcomm_sched_linear(const void *sendbuf, MPI_Aint int k, l; int *srcs, *dsts; MPI_Aint recvtype_extent; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_tsp_linear.c b/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_tsp_linear.c index f33f1cf7693..2250df2914b 100644 --- a/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_tsp_linear.c +++ b/src/mpi/coll/ineighbor_allgatherv/ineighbor_allgatherv_tsp_linear.c @@ -22,7 +22,7 @@ int MPIR_TSP_Ineighbor_allgatherv_sched_allcomm_linear(const void *sendbuf, MPI_ int tag, vtx_id; MPI_Aint recvtype_extent; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -30,8 +30,8 @@ int MPIR_TSP_Ineighbor_allgatherv_sched_allcomm_linear(const void *sendbuf, MPI_ mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_allcomm_sched_linear.c b/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_allcomm_sched_linear.c index c593a5fe200..d7927c9c179 100644 --- a/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_allcomm_sched_linear.c +++ b/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_allcomm_sched_linear.c @@ -22,15 +22,15 @@ int MPIR_Ineighbor_alltoall_allcomm_sched_linear(const void *sendbuf, MPI_Aint s int k, l; int *srcs, *dsts; MPI_Aint sendtype_extent, recvtype_extent; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(sendtype, sendtype_extent); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_tsp_linear.c b/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_tsp_linear.c index 3131e163f0d..96ad3a1ef3f 100644 --- a/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_tsp_linear.c +++ b/src/mpi/coll/ineighbor_alltoall/ineighbor_alltoall_tsp_linear.c @@ -23,15 +23,15 @@ int MPIR_TSP_Ineighbor_alltoall_sched_allcomm_linear(const void *sendbuf, MPI_Ai MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(sendtype, sendtype_extent); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_allcomm_sched_linear.c b/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_allcomm_sched_linear.c index 95713065499..39562fd33e4 100644 --- a/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_allcomm_sched_linear.c +++ b/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_allcomm_sched_linear.c @@ -23,15 +23,15 @@ int MPIR_Ineighbor_alltoallv_allcomm_sched_linear(const void *sendbuf, const MPI int k, l; int *srcs, *dsts; MPI_Aint sendtype_extent, recvtype_extent; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(sendtype, sendtype_extent); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_tsp_linear.c b/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_tsp_linear.c index cdf14c9a6d7..63b51670229 100644 --- a/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_tsp_linear.c +++ b/src/mpi/coll/ineighbor_alltoallv/ineighbor_alltoallv_tsp_linear.c @@ -27,15 +27,15 @@ int MPIR_TSP_Ineighbor_alltoallv_sched_allcomm_linear(const void *sendbuf, MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_Datatype_get_extent_macro(sendtype, sendtype_extent); MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_allcomm_sched_linear.c b/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_allcomm_sched_linear.c index dd9f143bcf2..50ca01eaf6f 100644 --- a/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_allcomm_sched_linear.c +++ b/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_allcomm_sched_linear.c @@ -24,12 +24,12 @@ int MPIR_Ineighbor_alltoallw_allcomm_sched_linear(const void *sendbuf, const MPI int indegree, outdegree, weighted; int k, l; int *srcs, *dsts; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_tsp_linear.c b/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_tsp_linear.c index ee5b5b3872e..87bd0b7c8a8 100644 --- a/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_tsp_linear.c +++ b/src/mpi/coll/ineighbor_alltoallw/ineighbor_alltoallw_tsp_linear.c @@ -26,12 +26,12 @@ int MPIR_TSP_Ineighbor_alltoallw_sched_allcomm_linear(const void *sendbuf, MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(srcs, int *, indegree * sizeof(int), mpi_errno, "srcs", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(dsts, int *, outdegree * sizeof(int), mpi_errno, "dsts", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(srcs, indegree * sizeof(int)); + MPIR_CHKLMEM_MALLOC(dsts, outdegree * sizeof(int)); mpi_errno = MPIR_Topo_canon_nhb(comm_ptr, indegree, srcs, MPI_UNWEIGHTED, outdegree, dsts, MPI_UNWEIGHTED); diff --git a/src/mpi/coll/ireduce/ireduce_intra_sched_reduce_scatter_gather.c b/src/mpi/coll/ireduce/ireduce_intra_sched_reduce_scatter_gather.c index 2f35e5d6f93..61e2627ce77 100644 --- a/src/mpi/coll/ireduce/ireduce_intra_sched_reduce_scatter_gather.c +++ b/src/mpi/coll/ireduce/ireduce_intra_sched_reduce_scatter_gather.c @@ -42,7 +42,7 @@ int MPIR_Ireduce_intra_sched_reduce_scatter_gather(const void *sendbuf, void *re int newroot, newdst_tree_root, newroot_tree_root; void *tmp_buf = NULL; MPI_Aint true_lb, true_extent, extent; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -139,10 +139,8 @@ int MPIR_Ireduce_intra_sched_reduce_scatter_gather(const void *sendbuf, void *re * because if root is one of the excluded processes, we will * need them on the root later on below. */ MPI_Aint *cnts, *disps; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "counts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "displacements", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(cnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(disps, pof2 * sizeof(MPI_Aint)); last_idx = send_idx = 0; /* suppress spurious compiler warnings */ diff --git a/src/mpi/coll/ireduce/ireduce_tsp_tree.c b/src/mpi/coll/ireduce/ireduce_tsp_tree.c index 0ce1f25852a..d7170c52766 100644 --- a/src/mpi/coll/ireduce/ireduce_tsp_tree.c +++ b/src/mpi/coll/ireduce/ireduce_tsp_tree.c @@ -38,7 +38,7 @@ int MPIR_TSP_Ireduce_sched_intra_tree(const void *sendbuf, void *recvbuf, MPI_Ai int nvtcs; int tag; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -174,13 +174,10 @@ int MPIR_TSP_Ireduce_sched_intra_tree(const void *sendbuf, void *recvbuf, MPI_Ai MPIR_ERR_CHECK(mpi_errno); /* initialize arrays to store graph vertex indices */ - MPIR_CHKLMEM_MALLOC(vtcs, int *, sizeof(int) * (num_children + 1), - mpi_errno, "vtcs buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(vtcs, sizeof(int) * (num_children + 1)); if (num_children > 0) { - MPIR_CHKLMEM_MALLOC(reduce_id, int *, sizeof(int) * num_children, - mpi_errno, "reduce_id buffer", MPL_MEM_COLL); - MPIR_CHKLMEM_MALLOC(recv_id, int *, sizeof(int) * num_children, - mpi_errno, "recv_id buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reduce_id, sizeof(int) * num_children); + MPIR_CHKLMEM_MALLOC(recv_id, sizeof(int) * num_children); } /* do pipelined reduce */ diff --git a/src/mpi/coll/ireduce_scatter/ireduce_scatter_tsp_recexch.c b/src/mpi/coll/ireduce_scatter/ireduce_scatter_tsp_recexch.c index c1e3bbc582b..1e8d45544b0 100644 --- a/src/mpi/coll/ireduce_scatter/ireduce_scatter_tsp_recexch.c +++ b/src/mpi/coll/ireduce_scatter/ireduce_scatter_tsp_recexch.c @@ -151,7 +151,7 @@ int MPIR_TSP_Ireduce_scatter_sched_intra_recexch(const void *sendbuf, void *recv MPI_Aint *displs; int tag, vtx_id; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -177,8 +177,7 @@ int MPIR_TSP_Ireduce_scatter_sched_intra_recexch(const void *sendbuf, void *recv return mpi_errno; } - MPIR_CHKLMEM_MALLOC(displs, MPI_Aint *, nranks * sizeof(MPI_Aint), - mpi_errno, "displs buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(displs, nranks * sizeof(MPI_Aint)); displs[0] = 0; for (i = 1; i < nranks; i++) { displs[i] = displs[i - 1] + recvcounts[i - 1]; diff --git a/src/mpi/coll/iscatter/iscatter_tsp_tree.c b/src/mpi/coll/iscatter/iscatter_tsp_tree.c index b92ed46017d..b7976234e37 100644 --- a/src/mpi/coll/iscatter/iscatter_tsp_tree.c +++ b/src/mpi/coll/iscatter/iscatter_tsp_tree.c @@ -32,7 +32,7 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, MPI_Aint sendcount, int tag; int num_send_dependencies; MPIR_Errflag_t errflag ATTRIBUTE((unused)) = MPIR_ERR_NONE; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); size = MPIR_Comm_size(comm); rank = MPIR_Comm_rank(comm); @@ -68,8 +68,8 @@ int MPIR_TSP_Iscatter_sched_intra_tree(const void *sendbuf, MPI_Aint sendcount, recvtype_extent = MPL_MAX(recvtype_extent, recvtype_true_extent); num_children = my_tree.num_children; - MPIR_CHKLMEM_MALLOC(child_subtree_size, int *, sizeof(int) * num_children, mpi_errno, "child_subtree_size buffer", MPL_MEM_COLL); /* to store size of subtree of each child */ - MPIR_CHKLMEM_MALLOC(child_data_offset, MPI_Aint *, sizeof(MPI_Aint) * num_children, mpi_errno, "child_data_offset buffer", MPL_MEM_COLL); /* to store the offset of the data to be sent to each child */ + MPIR_CHKLMEM_MALLOC(child_subtree_size, sizeof(int) * num_children); + MPIR_CHKLMEM_MALLOC(child_data_offset, sizeof(MPI_Aint) * num_children); /* calculate size of subtree of each child */ diff --git a/src/mpi/coll/reduce/reduce_inter_local_reduce_remote_send.c b/src/mpi/coll/reduce/reduce_inter_local_reduce_remote_send.c index ad54cce357b..4db0a2c21ab 100644 --- a/src/mpi/coll/reduce/reduce_inter_local_reduce_remote_send.c +++ b/src/mpi/coll/reduce/reduce_inter_local_reduce_remote_send.c @@ -21,12 +21,13 @@ int MPIR_Reduce_inter_local_reduce_remote_send(const void *sendbuf, int root, MPIR_Comm * comm_ptr, MPIR_Errflag_t errflag) { - int rank, mpi_errno; + int mpi_errno = MPI_SUCCESS; + int rank; MPI_Status status; MPI_Aint true_extent, true_lb, extent; void *tmp_buf = NULL; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (root == MPI_PROC_NULL) { /* local processes other than root do nothing */ @@ -48,8 +49,7 @@ int MPIR_Reduce_inter_local_reduce_remote_send(const void *sendbuf, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); } diff --git a/src/mpi/coll/reduce/reduce_intra_binomial.c b/src/mpi/coll/reduce/reduce_intra_binomial.c index 4363b5a7031..bf58b0e1b3d 100644 --- a/src/mpi/coll/reduce/reduce_intra_binomial.c +++ b/src/mpi/coll/reduce/reduce_intra_binomial.c @@ -21,7 +21,7 @@ int MPIR_Reduce_intra_binomial(const void *sendbuf, int mask, relrank, source, lroot; MPI_Aint true_lb, true_extent, extent; void *tmp_buf; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -32,17 +32,14 @@ int MPIR_Reduce_intra_binomial(const void *sendbuf, is_commutative = MPIR_Op_is_commutative(op); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); /* If I'm not the root, then my recvbuf may not be valid, therefore * I have to allocate a temporary one */ if (rank != root) { - MPIR_CHKLMEM_MALLOC(recvbuf, void *, - count * (MPL_MAX(extent, true_extent)), - mpi_errno, "receive buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(recvbuf, count * (MPL_MAX(extent, true_extent))); recvbuf = (void *) ((char *) recvbuf - true_lb); } diff --git a/src/mpi/coll/reduce/reduce_intra_reduce_scatter_gather.c b/src/mpi/coll/reduce/reduce_intra_reduce_scatter_gather.c index a8113ce6658..5590903e166 100644 --- a/src/mpi/coll/reduce/reduce_intra_reduce_scatter_gather.c +++ b/src/mpi/coll/reduce/reduce_intra_reduce_scatter_gather.c @@ -47,7 +47,7 @@ int MPIR_Reduce_intra_reduce_scatter_gather(const void *sendbuf, MPI_Aint true_lb, true_extent, extent; void *tmp_buf; - MPIR_CHKLMEM_DECL(4); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -57,17 +57,14 @@ int MPIR_Reduce_intra_reduce_scatter_gather(const void *sendbuf, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); /* If I'm not the root, then my recvbuf may not be valid, therefore * I have to allocate a temporary one */ if (rank != root) { - MPIR_CHKLMEM_MALLOC(recvbuf, void *, - count * (MPL_MAX(extent, true_extent)), - mpi_errno, "receive buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(recvbuf, count * (MPL_MAX(extent, true_extent))); recvbuf = (void *) ((char *) recvbuf - true_lb); } @@ -136,10 +133,8 @@ int MPIR_Reduce_intra_reduce_scatter_gather(const void *sendbuf, * because if root is one of the excluded processes, we will * need them on the root later on below. */ MPI_Aint *cnts, *disps; - MPIR_CHKLMEM_MALLOC(cnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "counts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "displacements", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(cnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(disps, pof2 * sizeof(MPI_Aint)); if (newrank != -1) { for (i = 0; i < pof2; i++) diff --git a/src/mpi/coll/reduce/reduce_intra_smp.c b/src/mpi/coll/reduce/reduce_intra_smp.c index 6ff46543185..baa163c1dd9 100644 --- a/src/mpi/coll/reduce/reduce_intra_smp.c +++ b/src/mpi/coll/reduce/reduce_intra_smp.c @@ -12,7 +12,7 @@ int MPIR_Reduce_intra_smp(const void *sendbuf, void *recvbuf, MPI_Aint count, int mpi_errno = MPI_SUCCESS; void *tmp_buf = NULL; MPI_Aint true_lb, true_extent, extent; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); #ifdef HAVE_ERROR_CHECKING { @@ -28,8 +28,7 @@ int MPIR_Reduce_intra_smp(const void *sendbuf, void *recvbuf, MPI_Aint count, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); } diff --git a/src/mpi/coll/reduce_scatter/reduce_scatter_inter_remote_reduce_local_scatter.c b/src/mpi/coll/reduce_scatter/reduce_scatter_inter_remote_reduce_local_scatter.c index eba1c515df0..4e7b992fc74 100644 --- a/src/mpi/coll/reduce_scatter/reduce_scatter_inter_remote_reduce_local_scatter.c +++ b/src/mpi/coll/reduce_scatter/reduce_scatter_inter_remote_reduce_local_scatter.c @@ -18,12 +18,13 @@ int MPIR_Reduce_scatter_inter_remote_reduce_local_scatter(const void *sendbuf, v MPIR_Comm * comm_ptr, MPIR_Errflag_t errflag) { - int rank, mpi_errno, root, local_size, total_count, i; + int mpi_errno = MPI_SUCCESS; + int rank, root, local_size, total_count, i; MPI_Aint true_extent, true_lb = 0, extent; void *tmp_buf = NULL; MPI_Aint *disps = NULL; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); rank = comm_ptr->rank; local_size = comm_ptr->local_size; @@ -36,8 +37,7 @@ int MPIR_Reduce_scatter_inter_remote_reduce_local_scatter(const void *sendbuf, v /* In each group, rank 0 allocates a temp. buffer for the * reduce */ - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, local_size * sizeof(MPI_Aint), mpi_errno, "disps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, local_size * sizeof(MPI_Aint)); total_count = 0; for (i = 0; i < local_size; i++) { @@ -48,8 +48,7 @@ int MPIR_Reduce_scatter_inter_remote_reduce_local_scatter(const void *sendbuf, v MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, total_count * (MPL_MAX(extent, true_extent)), - mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, total_count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); diff --git a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_noncommutative.c b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_noncommutative.c index d3085b27355..4f1fcc64df3 100644 --- a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_noncommutative.c +++ b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_noncommutative.c @@ -35,7 +35,7 @@ int MPIR_Reduce_scatter_intra_noncommutative(const void *sendbuf, void *recvbuf, void *tmp_buf0; void *tmp_buf1; void *result_ptr; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); @@ -56,10 +56,8 @@ int MPIR_Reduce_scatter_intra_noncommutative(const void *sendbuf, void *recvbuf, block_size = recvcounts[0]; total_count = block_size * comm_size; - MPIR_CHKLMEM_MALLOC(tmp_buf0, void *, true_extent * total_count, mpi_errno, "tmp_buf0", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(tmp_buf1, void *, true_extent * total_count, mpi_errno, "tmp_buf1", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf0, true_extent * total_count); + MPIR_CHKLMEM_MALLOC(tmp_buf1, true_extent * total_count); /* adjust for potential negative lower bound in datatype */ tmp_buf0 = (void *) ((char *) tmp_buf0 - true_lb); tmp_buf1 = (void *) ((char *) tmp_buf1 - true_lb); diff --git a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_pairwise.c b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_pairwise.c index 0ae8b879377..316c4a64995 100644 --- a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_pairwise.c +++ b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_pairwise.c @@ -23,7 +23,7 @@ int MPIR_Reduce_scatter_intra_pairwise(const void *sendbuf, void *recvbuf, void *tmp_recvbuf; int mpi_errno = MPI_SUCCESS; int src, dst; - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -40,8 +40,7 @@ int MPIR_Reduce_scatter_intra_pairwise(const void *sendbuf, void *recvbuf, } #endif /* HAVE_ERROR_CHECKING */ - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, comm_size * sizeof(MPI_Aint), mpi_errno, "disps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, comm_size * sizeof(MPI_Aint)); MPI_Aint total_count; total_count = 0; @@ -65,8 +64,7 @@ int MPIR_Reduce_scatter_intra_pairwise(const void *sendbuf, void *recvbuf, } /* allocate temporary buffer to store incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, recvcounts[rank] * (MPL_MAX(true_extent, extent)) + 1, - mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_recvbuf, recvcounts[rank] * (MPL_MAX(true_extent, extent)) + 1); /* adjust for potential negative lower bound in datatype */ tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb); diff --git a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_doubling.c b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_doubling.c index 6ab1d986302..182052c8ded 100644 --- a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_doubling.c +++ b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_doubling.c @@ -32,7 +32,7 @@ int MPIR_Reduce_scatter_intra_recursive_doubling(const void *sendbuf, void *recv int pof2, received; MPI_Datatype sendtype, recvtype; int nprocs_completed, tmp_mask, tree_root, is_commutative; - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -42,7 +42,7 @@ int MPIR_Reduce_scatter_intra_recursive_doubling(const void *sendbuf, void *recv is_commutative = MPIR_Op_is_commutative(op); - MPIR_CHKLMEM_MALLOC(disps, int *, comm_size * sizeof(int), mpi_errno, "disps", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, comm_size * sizeof(int)); total_count = 0; for (i = 0; i < comm_size; i++) { @@ -61,15 +61,13 @@ int MPIR_Reduce_scatter_intra_recursive_doubling(const void *sendbuf, void *recv } /* need to allocate temporary buffer to receive incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_recvbuf, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb); /* need to allocate another temporary buffer to accumulate * results */ - MPIR_CHKLMEM_MALLOC(tmp_results, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_results", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_results, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_results = (void *) ((char *) tmp_results - true_lb); diff --git a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_halving.c b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_halving.c index 03f58c3d7c2..a6be1eb8a08 100644 --- a/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_halving.c +++ b/src/mpi/coll/reduce_scatter/reduce_scatter_intra_recursive_halving.c @@ -48,7 +48,7 @@ int MPIR_Reduce_scatter_intra_recursive_halving(const void *sendbuf, void *recvb int mask; int rem, newdst, send_idx, recv_idx, last_idx, send_cnt, recv_cnt; int pof2, old_i, newrank; - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -63,7 +63,7 @@ int MPIR_Reduce_scatter_intra_recursive_halving(const void *sendbuf, void *recvb MPIR_Datatype_get_extent_macro(datatype, extent); MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); - MPIR_CHKLMEM_MALLOC(disps, int *, comm_size * sizeof(int), mpi_errno, "disps", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, comm_size * sizeof(int)); total_count = 0; for (i = 0; i < comm_size; i++) { @@ -78,15 +78,13 @@ int MPIR_Reduce_scatter_intra_recursive_halving(const void *sendbuf, void *recvb /* commutative and short. use recursive halving algorithm */ /* allocate temp. buffer to receive incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_recvbuf, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb); /* need to allocate another temporary buffer to accumulate * results because recvbuf may not be big enough */ - MPIR_CHKLMEM_MALLOC(tmp_results, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_results", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_results, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_results = (void *) ((char *) tmp_results - true_lb); @@ -144,10 +142,8 @@ int MPIR_Reduce_scatter_intra_recursive_halving(const void *sendbuf, void *recvb * have their result calculated by the process to their * right (rank+1). */ MPI_Aint *newcnts, *newdisps; - MPIR_CHKLMEM_MALLOC(newcnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "newcnts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(newdisps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "newdisps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(newcnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(newdisps, pof2 * sizeof(MPI_Aint)); for (i = 0; i < pof2; i++) { /* what does i map to in the old ranking? */ diff --git a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_inter_remote_reduce_local_scatter.c b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_inter_remote_reduce_local_scatter.c index ed15eafb02f..0046362389b 100644 --- a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_inter_remote_reduce_local_scatter.c +++ b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_inter_remote_reduce_local_scatter.c @@ -20,11 +20,12 @@ int MPIR_Reduce_scatter_block_inter_remote_reduce_local_scatter(const void *send MPIR_Comm * comm_ptr, MPIR_Errflag_t errflag) { - int rank, mpi_errno, root, local_size; + int mpi_errno = MPI_SUCCESS; + int rank, root, local_size; MPI_Aint true_extent, true_lb = 0, extent; void *tmp_buf = NULL; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); rank = comm_ptr->rank; local_size = comm_ptr->local_size; @@ -38,8 +39,7 @@ int MPIR_Reduce_scatter_block_inter_remote_reduce_local_scatter(const void *send MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, total_count * (MPL_MAX(extent, true_extent)), - mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, total_count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); diff --git a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_noncommutative.c b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_noncommutative.c index b4edac03945..084460fd641 100644 --- a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_noncommutative.c +++ b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_noncommutative.c @@ -37,7 +37,7 @@ int MPIR_Reduce_scatter_block_intra_noncommutative(const void *sendbuf, void *tmp_buf0; void *tmp_buf1; void *result_ptr; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); @@ -54,10 +54,8 @@ int MPIR_Reduce_scatter_block_intra_noncommutative(const void *sendbuf, block_size = recvcount; total_count = block_size * comm_size; - MPIR_CHKLMEM_MALLOC(tmp_buf0, void *, true_extent * total_count, mpi_errno, "tmp_buf0", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(tmp_buf1, void *, true_extent * total_count, mpi_errno, "tmp_buf1", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf0, true_extent * total_count); + MPIR_CHKLMEM_MALLOC(tmp_buf1, true_extent * total_count); /* adjust for potential negative lower bound in datatype */ tmp_buf0 = (void *) ((char *) tmp_buf0 - true_lb); tmp_buf1 = (void *) ((char *) tmp_buf1 - true_lb); diff --git a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_pairwise.c b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_pairwise.c index f7e5e636906..1a8a280f7bf 100644 --- a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_pairwise.c +++ b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_pairwise.c @@ -32,7 +32,7 @@ int MPIR_Reduce_scatter_block_intra_pairwise(const void *sendbuf, void *tmp_recvbuf; int mpi_errno = MPI_SUCCESS; int src, dst; - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -49,8 +49,7 @@ int MPIR_Reduce_scatter_block_intra_pairwise(const void *sendbuf, #endif /* HAVE_ERROR_CHECKING */ MPI_Aint *disps; - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, comm_size * sizeof(MPI_Aint), mpi_errno, "disps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, comm_size * sizeof(MPI_Aint)); for (i = 0; i < comm_size; i++) { disps[i] = i * recvcount; @@ -67,8 +66,7 @@ int MPIR_Reduce_scatter_block_intra_pairwise(const void *sendbuf, } /* allocate temporary buffer to store incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, recvcount * (MPL_MAX(true_extent, extent)) + 1, - mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_recvbuf, recvcount * (MPL_MAX(true_extent, extent)) + 1); /* adjust for potential negative lower bound in datatype */ tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb); diff --git a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_doubling.c b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_doubling.c index d666ee884a1..cefc533c27b 100644 --- a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_doubling.c +++ b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_doubling.c @@ -36,7 +36,7 @@ int MPIR_Reduce_scatter_block_intra_recursive_doubling(const void *sendbuf, int received; MPI_Datatype sendtype, recvtype; int nprocs_completed, tmp_mask, tree_root, is_commutative; - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); comm_size = comm_ptr->local_size; rank = comm_ptr->rank; @@ -47,8 +47,7 @@ int MPIR_Reduce_scatter_block_intra_recursive_doubling(const void *sendbuf, is_commutative = MPIR_Op_is_commutative(op); MPI_Aint *disps; - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, comm_size * sizeof(MPI_Aint), mpi_errno, "disps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, comm_size * sizeof(MPI_Aint)); MPI_Aint total_count; total_count = comm_size * recvcount; @@ -57,15 +56,13 @@ int MPIR_Reduce_scatter_block_intra_recursive_doubling(const void *sendbuf, } /* need to allocate temporary buffer to receive incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_recvbuf, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb); /* need to allocate another temporary buffer to accumulate * results */ - MPIR_CHKLMEM_MALLOC(tmp_results, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_results", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_results, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_results = (void *) ((char *) tmp_results - true_lb); diff --git a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_halving.c b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_halving.c index 05fede37670..f60cadd2f12 100644 --- a/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_halving.c +++ b/src/mpi/coll/reduce_scatter_block/reduce_scatter_block_intra_recursive_halving.c @@ -50,7 +50,7 @@ int MPIR_Reduce_scatter_block_intra_recursive_halving(const void *sendbuf, int mask; int rem, newdst, send_idx, recv_idx, last_idx; int pof2, old_i, newrank; - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -66,8 +66,7 @@ int MPIR_Reduce_scatter_block_intra_recursive_halving(const void *sendbuf, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPI_Aint *disps; - MPIR_CHKLMEM_MALLOC(disps, MPI_Aint *, comm_size * sizeof(MPI_Aint), mpi_errno, "disps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(disps, comm_size * sizeof(MPI_Aint)); MPI_Aint total_count; total_count = comm_size * recvcount; @@ -78,15 +77,13 @@ int MPIR_Reduce_scatter_block_intra_recursive_halving(const void *sendbuf, /* commutative and short. use recursive halving algorithm */ /* allocate temp. buffer to receive incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_recvbuf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_recvbuf, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_recvbuf = (void *) ((char *) tmp_recvbuf - true_lb); /* need to allocate another temporary buffer to accumulate * results because recvbuf may not be big enough */ - MPIR_CHKLMEM_MALLOC(tmp_results, void *, total_count * (MPL_MAX(true_extent, extent)), - mpi_errno, "tmp_results", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_results, total_count * (MPL_MAX(true_extent, extent))); /* adjust for potential negative lower bound in datatype */ tmp_results = (void *) ((char *) tmp_results - true_lb); @@ -145,10 +142,8 @@ int MPIR_Reduce_scatter_block_intra_recursive_halving(const void *sendbuf, * have their result calculated by the process to their * right (rank+1). */ MPI_Aint *newcnts, *newdisps; - MPIR_CHKLMEM_MALLOC(newcnts, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "newcnts", - MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(newdisps, MPI_Aint *, pof2 * sizeof(MPI_Aint), mpi_errno, "newdisps", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(newcnts, pof2 * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(newdisps, pof2 * sizeof(MPI_Aint)); for (i = 0; i < pof2; i++) { /* what does i map to in the old ranking? */ diff --git a/src/mpi/coll/scan/scan_intra_recursive_doubling.c b/src/mpi/coll/scan/scan_intra_recursive_doubling.c index 6afdb2dfd34..c06f66469fc 100644 --- a/src/mpi/coll/scan/scan_intra_recursive_doubling.c +++ b/src/mpi/coll/scan/scan_intra_recursive_doubling.c @@ -52,7 +52,7 @@ int MPIR_Scan_intra_recursive_doubling(const void *sendbuf, int mask, dst, is_commutative; MPI_Aint true_extent, true_lb, extent; void *partial_scan, *tmp_buf; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -62,15 +62,13 @@ int MPIR_Scan_intra_recursive_doubling(const void *sendbuf, MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(partial_scan, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "partial_scan", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(partial_scan, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ partial_scan = (void *) ((char *) partial_scan - true_lb); /* need to allocate temporary buffer to store incoming data */ - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), mpi_errno, - "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); diff --git a/src/mpi/coll/scan/scan_intra_smp.c b/src/mpi/coll/scan/scan_intra_smp.c index 9ea89a81786..0b6aafc941b 100644 --- a/src/mpi/coll/scan/scan_intra_smp.c +++ b/src/mpi/coll/scan/scan_intra_smp.c @@ -11,7 +11,7 @@ int MPIR_Scan_intra_smp(const void *sendbuf, void *recvbuf, MPI_Aint count, MPIR_Errflag_t errflag) { int mpi_errno = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); int rank = comm_ptr->rank; MPI_Status status; void *tempbuf = NULL, *localfulldata = NULL, *prefulldata = NULL; @@ -23,19 +23,16 @@ int MPIR_Scan_intra_smp(const void *sendbuf, void *recvbuf, MPI_Aint count, MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tempbuf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tempbuf, count * (MPL_MAX(extent, true_extent))); tempbuf = (void *) ((char *) tempbuf - true_lb); /* Create prefulldata and localfulldata on local roots of all nodes */ if (comm_ptr->node_roots_comm != NULL) { - MPIR_CHKLMEM_MALLOC(prefulldata, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "prefulldata for scan", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(prefulldata, count * (MPL_MAX(extent, true_extent))); prefulldata = (void *) ((char *) prefulldata - true_lb); if (comm_ptr->node_comm != NULL) { - MPIR_CHKLMEM_MALLOC(localfulldata, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "localfulldata for scan", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(localfulldata, count * (MPL_MAX(extent, true_extent))); localfulldata = (void *) ((char *) localfulldata - true_lb); } } diff --git a/src/mpi/coll/scatter/scatter_inter_remote_send_local_scatter.c b/src/mpi/coll/scatter/scatter_inter_remote_send_local_scatter.c index 81f5ce30245..5102fc3518b 100644 --- a/src/mpi/coll/scatter/scatter_inter_remote_send_local_scatter.c +++ b/src/mpi/coll/scatter/scatter_inter_remote_send_local_scatter.c @@ -22,7 +22,7 @@ int MPIR_Scatter_inter_remote_send_local_scatter(const void *sendbuf, MPI_Aint s int rank, local_size, remote_size, mpi_errno = MPI_SUCCESS; MPI_Status status; MPIR_Comm *newcomm_ptr = NULL; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (root == MPI_PROC_NULL) { /* local processes other than root do nothing */ @@ -49,9 +49,7 @@ int MPIR_Scatter_inter_remote_send_local_scatter(const void *sendbuf, MPI_Aint s if (rank == 0) { MPIR_Datatype_get_size_macro(recvtype, recvtype_sz); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, - recvcount * local_size * recvtype_sz, mpi_errno, - "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, recvcount * local_size * recvtype_sz); mpi_errno = MPIC_Recv(tmp_buf, recvcount * local_size * recvtype_sz, MPI_BYTE, root, MPIR_SCATTER_TAG, comm_ptr, &status); diff --git a/src/mpi/coll/scatter/scatter_intra_binomial.c b/src/mpi/coll/scatter/scatter_intra_binomial.c index dd211126582..b33eb642359 100644 --- a/src/mpi/coll/scatter/scatter_intra_binomial.c +++ b/src/mpi/coll/scatter/scatter_intra_binomial.c @@ -39,7 +39,7 @@ int MPIR_Scatter_intra_binomial(const void *sendbuf, MPI_Aint sendcount, MPI_Dat MPI_Aint tmp_buf_size = 0; void *tmp_buf = NULL; int mpi_errno = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(4); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -68,7 +68,7 @@ int MPIR_Scatter_intra_binomial(const void *sendbuf, MPI_Aint sendcount, MPI_Dat * receive data of max size (nbytes*comm_size)/2 */ if (relative_rank && !(relative_rank % 2)) { tmp_buf_size = (nbytes * comm_size) / 2; - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, tmp_buf_size, mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, tmp_buf_size); } /* if the root is not rank 0, we reorder the sendbuf in order of @@ -78,8 +78,7 @@ int MPIR_Scatter_intra_binomial(const void *sendbuf, MPI_Aint sendcount, MPI_Dat if (rank == root) { if (root != 0) { tmp_buf_size = nbytes * comm_size; - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, tmp_buf_size, mpi_errno, "tmp_buf", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, tmp_buf_size); if (recvbuf != MPI_IN_PLACE) mpi_errno = MPIR_Localcopy(((char *) sendbuf + extent * sendcount * rank), diff --git a/src/mpi/coll/scatterv/scatterv_allcomm_linear.c b/src/mpi/coll/scatterv/scatterv_allcomm_linear.c index 8612a34b09f..ae35003c0ef 100644 --- a/src/mpi/coll/scatterv/scatterv_allcomm_linear.c +++ b/src/mpi/coll/scatterv/scatterv_allcomm_linear.c @@ -27,7 +27,7 @@ int MPIR_Scatterv_allcomm_linear(const void *sendbuf, const MPI_Aint * sendcount int i, reqs; MPIR_Request **reqarray; MPI_Status *starray; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_THREADCOMM_RANK_SIZE(comm_ptr, rank, comm_size); @@ -39,10 +39,8 @@ int MPIR_Scatterv_allcomm_linear(const void *sendbuf, const MPI_Aint * sendcount MPIR_Datatype_get_extent_macro(sendtype, extent); - MPIR_CHKLMEM_MALLOC(reqarray, MPIR_Request **, comm_size * sizeof(MPIR_Request *), - mpi_errno, "reqarray", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC(starray, MPI_Status *, comm_size * sizeof(MPI_Status), mpi_errno, - "starray", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(reqarray, comm_size * sizeof(MPIR_Request *)); + MPIR_CHKLMEM_MALLOC(starray, comm_size * sizeof(MPI_Status)); reqs = 0; for (i = 0; i < comm_size; i++) { diff --git a/src/mpi/coll/transports/gentran/tsp_gentran.c b/src/mpi/coll/transports/gentran/tsp_gentran.c index 76c20855847..88c49573221 100644 --- a/src/mpi/coll/transports/gentran/tsp_gentran.c +++ b/src/mpi/coll/transports/gentran/tsp_gentran.c @@ -427,15 +427,14 @@ int MPIR_TSP_sched_sink(MPIR_TSP_sched_t s, int *vtx_id) int *in_vtcs; int mpi_errno = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); /* assign a new vertex */ *vtx_id = MPII_Genutil_vtx_create(sched, &vtxp); vtxp->vtx_kind = MPII_GENUTIL_VTX_KIND__SINK; - MPIR_CHKLMEM_MALLOC(in_vtcs, int *, sizeof(int) * (*vtx_id), - mpi_errno, "in_vtcs buffer", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(in_vtcs, sizeof(int) * (*vtx_id)); /* record incoming vertices */ sched_fence = ut_type_array(&sched->vtcs, vtx_t *) + *vtx_id - 1; MPIR_ERR_CHKANDJUMP(sched_fence == NULL, mpi_errno, MPI_ERR_OTHER, "**nofence"); diff --git a/src/mpi/comm/comm_impl.c b/src/mpi/comm/comm_impl.c index 9dbba6d703f..1a907b041e4 100644 --- a/src/mpi/comm/comm_impl.c +++ b/src/mpi/comm/comm_impl.c @@ -406,7 +406,7 @@ int MPIR_Comm_create_inter(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr, MPIR_Co MPIR_Comm *mapping_comm = NULL; int remote_size = -1; int rinfo[2]; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -479,9 +479,7 @@ int MPIR_Comm_create_inter(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr, MPIR_Co } remote_size = rinfo[1]; - MPIR_CHKLMEM_MALLOC(remote_mapping, int *, - remote_size * sizeof(int), - mpi_errno, "remote_mapping", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(remote_mapping, remote_size * sizeof(int)); /* Populate and exchange the ranks */ mpi_errno = MPIC_Sendrecv(mapping, group_ptr->size, MPI_INT, 0, 0, @@ -504,9 +502,7 @@ int MPIR_Comm_create_inter(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr, MPIR_Co (*newcomm_ptr)->context_id = rinfo[0]; } remote_size = rinfo[1]; - MPIR_CHKLMEM_MALLOC(remote_mapping, int *, - remote_size * sizeof(int), - mpi_errno, "remote_mapping", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(remote_mapping, remote_size * sizeof(int)); mpi_errno = MPIR_Bcast(remote_mapping, remote_size, MPI_INT, 0, comm_ptr->local_comm, MPIR_ERR_NONE); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpi/comm/comm_split.c b/src/mpi/comm/comm_split.c index 7c5519278e4..6b85b400387 100644 --- a/src/mpi/comm/comm_split.c +++ b/src/mpi/comm/comm_split.c @@ -90,15 +90,14 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** int in_newcomm; /* TRUE iff *newcomm should be populated */ int new_context_id, remote_context_id; MPIR_Comm_map_t *mapper; - MPIR_CHKLMEM_DECL(4); + MPIR_CHKLMEM_DECL(); rank = comm_ptr->rank; size = comm_ptr->local_size; remote_size = comm_ptr->remote_size; /* Step 1: Find out what color and keys all of the processes have */ - MPIR_CHKLMEM_MALLOC(table, splittype *, size * sizeof(splittype), mpi_errno, - "table", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(table, size * sizeof(splittype)); table[rank].color = color; table[rank].key = key; @@ -150,9 +149,7 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** * local group - perform an (intercommunicator) all gather * of the color and rank information for the remote group. */ - MPIR_CHKLMEM_MALLOC(remotetable, splittype *, - remote_size * sizeof(splittype), mpi_errno, - "remotetable", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(remotetable, remote_size * sizeof(splittype)); /* This is an intercommunicator allgather */ /* We must use a local splittype because we've already modified the @@ -257,8 +254,7 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** * extract the table into a smaller array and sort that. * Also, store in the "color" entry the rank in the input communicator * of the entry. */ - MPIR_CHKLMEM_MALLOC(keytable, sorttype *, new_size * sizeof(sorttype), - mpi_errno, "keytable", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(keytable, new_size * sizeof(sorttype)); for (i = 0; i < new_size; i++) { keytable[i].key = table[first_entry].key; keytable[i].color = first_entry; @@ -270,9 +266,7 @@ int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** MPIU_Sort_inttable(keytable, new_size); if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTERCOMM) { - MPIR_CHKLMEM_MALLOC(remotekeytable, sorttype *, - new_remote_size * sizeof(sorttype), - mpi_errno, "remote keytable", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(remotekeytable, new_remote_size * sizeof(sorttype)); for (i = 0; i < new_remote_size; i++) { remotekeytable[i].key = remotetable[first_remote_entry].key; remotekeytable[i].color = first_remote_entry; diff --git a/src/mpi/datatype/type_create.c b/src/mpi/datatype/type_create.c index 0682adf8d50..2d3e933f1a0 100644 --- a/src/mpi/datatype/type_create.c +++ b/src/mpi/datatype/type_create.c @@ -518,13 +518,12 @@ int MPIR_Type_create_indexed_block_impl(int count, MPIR_Datatype *new_dtp; MPI_Aint *p_disp; int *ints; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); if (sizeof(MPI_Aint) == sizeof(int)) { p_disp = (MPI_Aint *) array_of_displacements; } else { - MPIR_CHKLMEM_MALLOC_ORJUMP(p_disp, MPI_Aint *, count * sizeof(MPI_Aint), mpi_errno, - "aint displacement array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(p_disp, count * sizeof(MPI_Aint)); for (int i = 0; i < count; i++) { p_disp[i] = array_of_displacements[i]; } @@ -533,8 +532,7 @@ int MPIR_Type_create_indexed_block_impl(int count, oldtype, &new_handle); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC_ORJUMP(ints, int *, (count + 2) * sizeof(int), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (count + 2) * sizeof(int)); ints[0] = count; ints[1] = blocklength; @@ -564,14 +562,13 @@ int MPIR_Type_create_indexed_block_large_impl(MPI_Aint count, MPI_Aint blockleng MPI_Datatype new_handle; MPIR_Datatype *new_dtp; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_blockindexed(count, blocklength, array_of_displacements, 0, /* dispinbytes */ oldtype, &new_handle); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC_ORJUMP(counts, MPI_Aint *, (count + 2) * sizeof(MPI_Aint), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(counts, (count + 2) * sizeof(MPI_Aint)); counts[0] = count; counts[1] = blocklength; @@ -631,14 +628,13 @@ int MPIR_Type_create_hindexed_block_large_impl(MPI_Aint count, MPI_Aint blocklen MPI_Datatype new_handle; MPIR_Datatype *new_dtp; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_blockindexed(count, blocklength, array_of_displacements, 1, oldtype, &new_handle); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC_ORJUMP(counts, MPI_Aint *, (count + 2) * sizeof(MPI_Aint), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(counts, (count + 2) * sizeof(MPI_Aint)); counts[0] = count; counts[1] = blocklength; for (MPI_Aint i = 0; i < count; i++) @@ -667,16 +663,14 @@ int MPIR_Type_indexed_impl(int count, const int *array_of_blocklengths, MPIR_Datatype *new_dtp; MPI_Aint *p_blkl, *p_disp; int *ints; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); if (sizeof(MPI_Aint) == sizeof(int)) { p_blkl = (MPI_Aint *) array_of_blocklengths; p_disp = (MPI_Aint *) array_of_displacements; } else { - MPIR_CHKLMEM_MALLOC_ORJUMP(p_blkl, MPI_Aint *, count * sizeof(MPI_Aint), mpi_errno, - "aint blocklengths array", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC_ORJUMP(p_disp, MPI_Aint *, count * sizeof(MPI_Aint), mpi_errno, - "aint displacements array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(p_blkl, count * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(p_disp, count * sizeof(MPI_Aint)); for (int i = 0; i < count; i++) { p_blkl[i] = array_of_blocklengths[i]; p_disp[i] = array_of_displacements[i]; @@ -689,8 +683,7 @@ int MPIR_Type_indexed_impl(int count, const int *array_of_blocklengths, /* copy all integer values into a temporary buffer; this * includes the count, the blocklengths, and the displacements. */ - MPIR_CHKLMEM_MALLOC(ints, int *, (2 * count + 1) * sizeof(int), mpi_errno, - "contents integer array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (2 * count + 1) * sizeof(int)); ints[0] = count; @@ -723,7 +716,7 @@ int MPIR_Type_indexed_large_impl(MPI_Aint count, MPI_Datatype new_handle; MPIR_Datatype *new_dtp; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_indexed(count, array_of_blocklengths, array_of_displacements, 0, /* displacements not in bytes */ oldtype, &new_handle); @@ -732,8 +725,7 @@ int MPIR_Type_indexed_large_impl(MPI_Aint count, /* copy all integer values into a temporary buffer; this * includes the count, the blocklengths, and the displacements. */ - MPIR_CHKLMEM_MALLOC(counts, MPI_Aint *, (2 * count + 1) * sizeof(MPI_Aint), mpi_errno, - "contents counts array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(counts, (2 * count + 1) * sizeof(MPI_Aint)); counts[0] = count; @@ -766,13 +758,12 @@ int MPIR_Type_create_hindexed_impl(int count, const int array_of_blocklengths[], MPIR_Datatype *new_dtp; MPI_Aint *p_blkl; int *ints; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); if (sizeof(MPI_Aint) == sizeof(int)) { p_blkl = (MPI_Aint *) array_of_blocklengths; } else { - MPIR_CHKLMEM_MALLOC_ORJUMP(p_blkl, MPI_Aint *, count * sizeof(MPI_Aint), mpi_errno, - "aint blocklengths array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(p_blkl, count * sizeof(MPI_Aint)); for (int i = 0; i < count; i++) { p_blkl[i] = array_of_blocklengths[i]; } @@ -780,8 +771,7 @@ int MPIR_Type_create_hindexed_impl(int count, const int array_of_blocklengths[], mpi_errno = MPIR_Type_indexed(count, p_blkl, array_of_displacements, 1, /* displacements in bytes */ oldtype, &new_handle); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC_ORJUMP(ints, int *, (count + 1) * sizeof(int), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (count + 1) * sizeof(int)); ints[0] = count; for (int i = 0; i < count; i++) { @@ -810,13 +800,12 @@ int MPIR_Type_create_hindexed_large_impl(MPI_Aint count, MPI_Datatype new_handle; MPIR_Datatype *new_dtp; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_indexed(count, array_of_blocklengths, array_of_displacements, 1, /* displacements in bytes */ oldtype, &new_handle); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC_ORJUMP(counts, MPI_Aint *, (count * 2 + 1) * sizeof(MPI_Aint), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(counts, (count * 2 + 1) * sizeof(MPI_Aint)); counts[0] = count; for (MPI_Aint i = 0; i < count; i++) { @@ -847,15 +836,14 @@ int MPIR_Type_create_struct_large_impl(MPI_Aint count, MPI_Datatype new_handle; MPIR_Datatype *new_dtp; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_struct(count, array_of_blocklengths, array_of_displacements, array_of_types, &new_handle); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(counts, MPI_Aint *, (count * 2 + 1) * sizeof(MPI_Aint), mpi_errno, - "contents counts array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(counts, (count * 2 + 1) * sizeof(MPI_Aint)); counts[0] = count; for (MPI_Aint i = 0; i < count; i++) { @@ -890,13 +878,12 @@ int MPIR_Type_create_struct_impl(int count, const int *array_of_blocklengths, MPIR_Datatype *new_dtp; MPI_Aint *p_blkl; int *ints; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); if (sizeof(MPI_Aint) == sizeof(int)) { p_blkl = (MPI_Aint *) array_of_blocklengths; } else { - MPIR_CHKLMEM_MALLOC_ORJUMP(p_blkl, MPI_Aint *, count * sizeof(MPI_Aint), mpi_errno, - "aint blocklengths array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(p_blkl, count * sizeof(MPI_Aint)); for (int i = 0; i < count; i++) { p_blkl[i] = array_of_blocklengths[i]; } @@ -906,8 +893,7 @@ int MPIR_Type_create_struct_impl(int count, const int *array_of_blocklengths, MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(ints, int *, (count + 1) * sizeof(int), mpi_errno, "contents integer array", - MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (count + 1) * sizeof(int)); ints[0] = count; for (int i = 0; i < count; i++) { diff --git a/src/mpi/datatype/type_create_darray.c b/src/mpi/datatype/type_create_darray.c index eca5759e5ea..6c182d9b6e3 100644 --- a/src/mpi/datatype/type_create_darray.c +++ b/src/mpi/datatype/type_create_darray.c @@ -287,11 +287,10 @@ static int MPIR_Type_create_darray(int size, int rank, int ndims, MPI_Aint *st_offsets, orig_extent, disps[3]; MPI_Datatype type_old, type_new = MPI_DATATYPE_NULL, tmp_type; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); /* calculate position in Cartesian grid as MPI would (row-major ordering) */ - MPIR_CHKLMEM_MALLOC_ORJUMP(coords, int *, ndims * sizeof(int), mpi_errno, - "position is Cartesian grid", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(coords, ndims * sizeof(int)); MPIR_Datatype_get_extent_macro(oldtype, orig_extent); procs = size; @@ -302,8 +301,7 @@ static int MPIR_Type_create_darray(int size, int rank, int ndims, tmp_rank = tmp_rank % procs; } - MPIR_CHKLMEM_MALLOC_ORJUMP(st_offsets, MPI_Aint *, ndims * sizeof(MPI_Aint), mpi_errno, - "st_offsets", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(st_offsets, ndims * sizeof(MPI_Aint)); type_old = oldtype; @@ -451,10 +449,9 @@ int MPIR_Type_create_darray_impl(int size, int rank, int ndims, MPI_Aint *real_array_of_gsizes; int *ints; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); - MPIR_CHKLMEM_MALLOC_ORJUMP(real_array_of_gsizes, MPI_Aint *, ndims * sizeof(MPI_Aint), - mpi_errno, "real_array_of_gsizes", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(real_array_of_gsizes, ndims * sizeof(MPI_Aint)); for (int i = 0; i < ndims; i++) { real_array_of_gsizes[i] = array_of_gsizes[i]; } @@ -469,8 +466,7 @@ int MPIR_Type_create_darray_impl(int size, int rank, int ndims, */ /* Save contents */ - MPIR_CHKLMEM_MALLOC_ORJUMP(ints, int *, (4 * ndims + 4) * sizeof(int), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (4 * ndims + 4) * sizeof(int)); ints[0] = size; ints[1] = rank; @@ -514,17 +510,15 @@ int MPIR_Type_create_darray_large_impl(int size, int rank, int ndims, int *ints; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_create_darray(size, rank, ndims, array_of_gsizes, array_of_distribs, array_of_dargs, array_of_psizes, order, oldtype, newtype); MPIR_ERR_CHECK(mpi_errno); /* Save contents */ - MPIR_CHKLMEM_MALLOC_ORJUMP(ints, int *, (3 * ndims + 4) * sizeof(int), mpi_errno, - "content ints array", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC_ORJUMP(counts, MPI_Aint *, ndims * sizeof(MPI_Aint), mpi_errno, - "content counts array", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (3 * ndims + 4) * sizeof(int)); + MPIR_CHKLMEM_MALLOC(counts, ndims * sizeof(MPI_Aint)); ints[0] = size; ints[1] = rank; diff --git a/src/mpi/datatype/type_create_subarray.c b/src/mpi/datatype/type_create_subarray.c index 91ea82c3ac1..6662ccb372d 100644 --- a/src/mpi/datatype/type_create_subarray.c +++ b/src/mpi/datatype/type_create_subarray.c @@ -122,14 +122,11 @@ int MPIR_Type_create_subarray_impl(int ndims, const int array_of_sizes[], MPI_Aint *p_sizes, *p_subsizes, *p_starts; int *ints; - MPIR_CHKLMEM_DECL(4); - - MPIR_CHKLMEM_MALLOC_ORJUMP(p_sizes, MPI_Aint *, ndims * sizeof(MPI_Aint), mpi_errno, - "real array_of_sizes", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC_ORJUMP(p_subsizes, MPI_Aint *, ndims * sizeof(MPI_Aint), mpi_errno, - "real array_of_subsizes", MPL_MEM_BUFFER); - MPIR_CHKLMEM_MALLOC_ORJUMP(p_starts, MPI_Aint *, ndims * sizeof(MPI_Aint), mpi_errno, - "real array_of_starts", MPL_MEM_BUFFER); + MPIR_CHKLMEM_DECL(); + + MPIR_CHKLMEM_MALLOC(p_sizes, ndims * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(p_subsizes, ndims * sizeof(MPI_Aint)); + MPIR_CHKLMEM_MALLOC(p_starts, ndims * sizeof(MPI_Aint)); for (int i = 0; i < ndims; i++) { p_sizes[i] = array_of_sizes[i]; p_subsizes[i] = array_of_subsizes[i]; @@ -141,8 +138,7 @@ int MPIR_Type_create_subarray_impl(int ndims, const int array_of_sizes[], MPIR_ERR_CHECK(mpi_errno); /* Save contents */ - MPIR_CHKLMEM_MALLOC_ORJUMP(ints, int *, (3 * ndims + 2) * sizeof(int), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(ints, (3 * ndims + 2) * sizeof(int)); ints[0] = ndims; for (int i = 0; i < ndims; i++) { @@ -177,15 +173,14 @@ int MPIR_Type_create_subarray_large_impl(int ndims, const MPI_Aint array_of_size int mpi_errno = MPI_SUCCESS; MPI_Aint *counts; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); mpi_errno = MPIR_Type_create_subarray(ndims, array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype); MPIR_ERR_CHECK(mpi_errno); /* Save contents */ - MPIR_CHKLMEM_MALLOC_ORJUMP(counts, MPI_Aint *, (3 * ndims) * sizeof(MPI_Aint), mpi_errno, - "content description", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(counts, (3 * ndims) * sizeof(MPI_Aint)); int ints[2]; ints[0] = ndims; diff --git a/src/mpi/group/grouputil.c b/src/mpi/group/grouputil.c index ac777e50305..bd398c0cfd5 100644 --- a/src/mpi/group/grouputil.c +++ b/src/mpi/group/grouputil.c @@ -359,12 +359,11 @@ int MPIR_Group_check_subset(MPIR_Group * group_ptr, MPIR_Comm * comm_ptr) MPII_Group_pmap_t *vmap = 0; int vsize = comm_ptr->comm_kind == MPIR_COMM_KIND__INTERCOMM ? comm_ptr->local_size : comm_ptr->remote_size; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_Assert(group_ptr != NULL); - MPIR_CHKLMEM_MALLOC(vmap, MPII_Group_pmap_t *, - vsize * sizeof(MPII_Group_pmap_t), mpi_errno, "", MPL_MEM_GROUP); + MPIR_CHKLMEM_MALLOC(vmap, vsize * sizeof(MPII_Group_pmap_t)); /* Initialize the vmap */ for (i = 0; i < vsize; i++) { MPID_Comm_get_lpid(comm_ptr, i, &vmap[i].lpid, FALSE); diff --git a/src/mpi/misc/utils.c b/src/mpi/misc/utils.c index ca60d7bb7bb..fd237052a9b 100644 --- a/src/mpi/misc/utils.c +++ b/src/mpi/misc/utils.c @@ -63,7 +63,7 @@ static int do_localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype se MPI_Aint sendsize, recvsize, sdata_sz, rdata_sz, copy_sz; char *buf = NULL; MPL_pointer_attr_t send_attr, recv_attr; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -160,7 +160,7 @@ static int do_localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype se } else if (MPL_gpu_attr_is_strict_dev(&send_attr) || MPL_gpu_attr_is_strict_dev(&recv_attr)) { MPL_gpu_malloc_host((void **) &buf, COPY_BUFFER_SZ); } else { - MPIR_CHKLMEM_MALLOC(buf, char *, COPY_BUFFER_SZ, mpi_errno, "buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(buf, COPY_BUFFER_SZ); } sfirst = sendoffset; diff --git a/src/mpi/pt2pt/sendrecv.c b/src/mpi/pt2pt/sendrecv.c index 035d03ad4d3..09616d650b5 100644 --- a/src/mpi/pt2pt/sendrecv.c +++ b/src/mpi/pt2pt/sendrecv.c @@ -96,15 +96,14 @@ int MPIR_Sendrecv_replace_impl(void *buf, MPI_Aint count, MPI_Datatype datatype, void *tmpbuf = NULL; MPI_Aint tmpbuf_size = 0; MPI_Aint actual_pack_bytes = 0; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; if (count > 0 && dest != MPI_PROC_NULL) { MPIR_Pack_size(count, datatype, &tmpbuf_size); - MPIR_CHKLMEM_MALLOC_ORJUMP(tmpbuf, void *, tmpbuf_size, mpi_errno, - "temporary send buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmpbuf, tmpbuf_size); mpi_errno = MPIR_Typerep_pack(buf, count, datatype, 0, tmpbuf, tmpbuf_size, &actual_pack_bytes, diff --git a/src/mpi/spawn/spawn_impl.c b/src/mpi/spawn/spawn_impl.c index 6681e1d0e2c..442f109690c 100644 --- a/src/mpi/spawn/spawn_impl.c +++ b/src/mpi/spawn/spawn_impl.c @@ -128,14 +128,12 @@ int MPIR_Comm_join_impl(int fd, MPIR_Comm ** p_intercomm_ptr) int mpi_errno = MPI_SUCCESS; MPIR_Comm *intercomm_ptr; char *local_port, *remote_port; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; - MPIR_CHKLMEM_MALLOC(local_port, char *, PORT_SIZE, mpi_errno, "local port name", - MPL_MEM_DYNAMIC); - MPIR_CHKLMEM_MALLOC(remote_port, char *, PORT_SIZE, mpi_errno, "remote port name", - MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(local_port, PORT_SIZE); + MPIR_CHKLMEM_MALLOC(remote_port, PORT_SIZE); MPL_VG_MEM_INIT(local_port, PORT_SIZE * sizeof(char)); diff --git a/src/mpi/topo/dims_create.c b/src/mpi/topo/dims_create.c index 486ec068932..b530924c31a 100644 --- a/src/mpi/topo/dims_create.c +++ b/src/mpi/topo/dims_create.c @@ -224,7 +224,8 @@ static int ndivisors_from_factor(int nf, const Factors * factors) static int factor_to_divisors(int nf, Factors * factors, int ndiv, int divs[]) { - int i, powers[MAX_FACTORS], curbase[MAX_FACTORS], nd, idx, val, mpi_errno; + int mpi_errno = MPI_SUCCESS; + int i, powers[MAX_FACTORS], curbase[MAX_FACTORS], nd, idx, val; MPIR_T_PVAR_TIMER_START(DIMS, dims_getdivs); for (i = 0; i < nf; i++) { @@ -262,11 +263,11 @@ static int factor_to_divisors(int nf, Factors * factors, int ndiv, int divs[]) */ if (nf > 1) { int gap, j, j1, j2, k, j1max, j2max; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); int *divs2; int *restrict d1, *restrict d2; - MPIR_CHKLMEM_MALLOC(divs2, int *, nd * sizeof(int), mpi_errno, "divs2", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(divs2, nd * sizeof(int)); MPIR_T_PVAR_TIMER_START(DIMS, dims_sort); /* handling the first set of pairs separately saved about 20%; @@ -393,9 +394,9 @@ static int optbalance(int n, int idx, int nd, int ndivs, const int divs[], MPL_msg_printf("%d%c", trydims[i], (i + 1 < nd) ? 'x' : '\n'); } if (idx > 1) { - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); int *newdivs; - MPIR_CHKLMEM_MALLOC(newdivs, int *, ndivs * sizeof(int), mpi_errno, "divs", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(newdivs, ndivs * sizeof(int)); /* At least 3 divisors to set (0...idx). We try all choices * recursively, but stop looking when we can easily tell that @@ -551,14 +552,15 @@ static int optbalance(int n, int idx, int nd, int ndivs, const int divs[], int MPIR_Dims_create_impl(int nnodes, int ndims, int dims[]) { + int mpi_errno = MPI_SUCCESS; Factors f[MAX_FACTORS]; int nf, nprimes = 0, i, j, k, val, nextidx; int ndivs, curbal; int trydims[MAX_DIMS]; - int dims_needed, dims_product, mpi_errno; + int dims_needed, dims_product; int chosen[MAX_DIMS], foundDecomp; int *divs; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); /* Initialize pvars and cvars if this is the first call */ if (MPIR_DIMS_initPCVars) { @@ -751,8 +753,7 @@ int MPIR_Dims_create_impl(int nnodes, int ndims, int dims[]) * have already trimmed off some large factors */ /* First, find all of the divisors given by the remaining factors */ ndivs = ndivisors_from_factor(nf, (const Factors *) f); - MPIR_CHKLMEM_MALLOC(divs, int *, ((unsigned int) ndivs) * sizeof(int), mpi_errno, "divs", - MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(divs, ((unsigned int) ndivs) * sizeof(int)); ndivs = factor_to_divisors(nf, f, ndivs, divs); if (MPIR_CVAR_DIMS_VERBOSE) { for (i = 0; i < ndivs; i++) { diff --git a/src/mpi/topo/dist_graph_create.c b/src/mpi/topo/dist_graph_create.c index ffe9c27c850..d397869d181 100644 --- a/src/mpi/topo/dist_graph_create.c +++ b/src/mpi/topo/dist_graph_create.c @@ -23,7 +23,7 @@ int MPIR_Dist_graph_create_impl(MPIR_Comm * comm_ptr, int *buf = NULL; int comm_size = comm_ptr->local_size; - MPIR_CHKLMEM_DECL(8); + MPIR_CHKLMEM_DECL(); MPIR_CHKPMEM_DECL(1); /* following the spirit of the old topo interface, attributes do not @@ -39,16 +39,12 @@ int MPIR_Dist_graph_create_impl(MPIR_Comm * comm_ptr, * rout is an array of comm_size containing pointers to arrays of * rout_sizes[x]. rout[x] is the locally known number of edges out of this * process to rank x. */ - MPIR_CHKLMEM_MALLOC(rout, int **, comm_size * sizeof(int *), mpi_errno, "rout", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(rin, int **, comm_size * sizeof(int *), mpi_errno, "rin", MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(rin_sizes, int *, comm_size * sizeof(int), mpi_errno, "rin_sizes", - MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(rout_sizes, int *, comm_size * sizeof(int), mpi_errno, "rout_sizes", - MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(rin_idx, int *, comm_size * sizeof(int), mpi_errno, "rin_idx", - MPL_MEM_COMM); - MPIR_CHKLMEM_MALLOC(rout_idx, int *, comm_size * sizeof(int), mpi_errno, "rout_idx", - MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(rout, comm_size * sizeof(int *)); + MPIR_CHKLMEM_MALLOC(rin, comm_size * sizeof(int *)); + MPIR_CHKLMEM_MALLOC(rin_sizes, comm_size * sizeof(int)); + MPIR_CHKLMEM_MALLOC(rout_sizes, comm_size * sizeof(int)); + MPIR_CHKLMEM_MALLOC(rin_idx, comm_size * sizeof(int)); + MPIR_CHKLMEM_MALLOC(rout_idx, comm_size * sizeof(int)); memset(rout, 0, comm_size * sizeof(int *)); memset(rin, 0, comm_size * sizeof(int *)); @@ -123,8 +119,7 @@ int MPIR_Dist_graph_create_impl(MPIR_Comm * comm_ptr, } int *rs; - MPIR_CHKLMEM_MALLOC(rs, int *, 2 * comm_size * sizeof(int), mpi_errno, "red-scat source buffer", - MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(rs, 2 * comm_size * sizeof(int)); for (int i = 0; i < comm_size; ++i) { rs[2 * i] = (rin_sizes[i] ? 1 : 0); rs[2 * i + 1] = (rout_sizes[i] ? 1 : 0); @@ -143,8 +138,7 @@ int MPIR_Dist_graph_create_impl(MPIR_Comm * comm_ptr, /* must be 2*comm_size requests because we will possibly send inbound and * outbound edges to everyone in our communicator */ MPIR_Request **reqs; - MPIR_CHKLMEM_MALLOC(reqs, MPIR_Request **, 2 * comm_size * sizeof(MPIR_Request *), mpi_errno, - "temp request array", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(reqs, 2 * comm_size * sizeof(MPIR_Request *)); for (int i = 0; i < comm_size; ++i) { if (rin_sizes[i]) { /* send edges where i is a destination to process i */ diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c index 31e608692e8..e1aad2e184b 100644 --- a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c +++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c @@ -548,7 +548,7 @@ static int recv_id_or_tmpvc_info(sockconn_t * const sc, int *got_sc_eof) #endif MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -575,8 +575,7 @@ static int recv_id_or_tmpvc_info(sockconn_t * const sc, int *got_sc_eof) iov[0].iov_len = sizeof(sc->pg_rank); pg_id_len = hdr.datalen - sizeof(MPIDI_nem_tcp_idinfo_t); if (pg_id_len != 0) { - MPIR_CHKLMEM_MALLOC(pg_id, char *, pg_id_len, mpi_errno, "sockconn pg_id", - MPL_MEM_OTHER); + MPIR_CHKLMEM_MALLOC(pg_id, pg_id_len); iov[1].iov_base = (void *) pg_id; iov[1].iov_len = pg_id_len; ++iov_cnt; @@ -777,7 +776,7 @@ int MPID_nem_tcp_connect(struct MPIDI_VC *const vc) char strerrbuf[MPIR_STRERROR_BUF_SIZE]; #endif - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -832,7 +831,7 @@ int MPID_nem_tcp_connect(struct MPIDI_VC *const vc) val_max_sz = MPIR_pmi_max_val_size(); - MPIR_CHKLMEM_MALLOC(bc, char *, val_max_sz, mpi_errno, "bc", MPL_MEM_OTHER); + MPIR_CHKLMEM_MALLOC(bc, val_max_sz); sc->is_tmpvc = FALSE; diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c index ca4039a9d9d..1b40b51b223 100644 --- a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c +++ b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c @@ -129,7 +129,7 @@ static int MPIDI_CH3I_SHM_Wins_match(MPIR_Win ** win_ptr, MPIR_Win ** matched_wi MPIDI_SHM_Win_t *elem = shm_wins_list; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; *matched_win = NULL; @@ -141,9 +141,8 @@ static int MPIDI_CH3I_SHM_Wins_match(MPIR_Win ** win_ptr, MPIR_Win ** matched_wi comm_size = (*win_ptr)->comm_ptr->local_size; - MPIR_CHKLMEM_MALLOC(node_ranks, int *, node_size * sizeof(int), mpi_errno, "node_ranks", MPL_MEM_RMA); - MPIR_CHKLMEM_MALLOC(node_ranks_in_shm_node, int *, node_size * sizeof(int), - mpi_errno, "node_ranks_in_shm_comm", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(node_ranks, node_size * sizeof(int)); + MPIR_CHKLMEM_MALLOC(node_ranks_in_shm_node, node_size * sizeof(int)); for (i = 0; i < node_size; i++) { node_ranks[i] = i; @@ -251,7 +250,7 @@ static int MPIDI_CH3I_Win_detect_shm(MPIR_Win ** win_ptr) MPI_Aint *base_shm_offs; MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; if ((*win_ptr)->comm_ptr->node_comm == NULL) { @@ -260,8 +259,7 @@ static int MPIDI_CH3I_Win_detect_shm(MPIR_Win ** win_ptr) node_size = (*win_ptr)->comm_ptr->node_comm->local_size; - MPIR_CHKLMEM_MALLOC(base_shm_offs, MPI_Aint *, node_size * sizeof(MPI_Aint), - mpi_errno, "base_shm_offs", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(base_shm_offs, node_size * sizeof(MPI_Aint)); /* Return the first matched shared window. * It is noted that the shared windows including all local processes are @@ -308,7 +306,7 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, int i, k; int mpi_errno = MPI_SUCCESS; int mpl_err = 0; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -382,8 +380,7 @@ static int MPIDI_CH3I_Win_gather_info(void *base, MPI_Aint size, int disp_unit, (*win_ptr)->basic_info_table = (MPIDI_Win_basic_info_t *) ((*win_ptr)->info_shm_base_addr); - MPIR_CHKLMEM_MALLOC(tmp_buf, MPI_Aint *, 4 * comm_size * sizeof(MPI_Aint), - mpi_errno, "tmp_buf", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(tmp_buf, 4 * comm_size * sizeof(MPI_Aint)); tmp_buf[4 * comm_rank] = MPIR_Ptr_to_aint(base); tmp_buf[4 * comm_rank + 1] = size; @@ -431,7 +428,7 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * MPI_Aint *node_sizes; int noncontig = FALSE; MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -472,8 +469,7 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPIR_Info * /* get the sizes of the windows and window objectsof * all processes. allocate temp. buffer for communication */ - MPIR_CHKLMEM_MALLOC(node_sizes, MPI_Aint *, node_size * sizeof(MPI_Aint), mpi_errno, - "node_sizes", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(node_sizes, node_size * sizeof(MPI_Aint)); node_sizes[node_rank] = (MPI_Aint) size; diff --git a/src/mpid/ch3/include/mpidrma.h b/src/mpid/ch3/include/mpidrma.h index 68e7aaf3a63..08a242e5a92 100644 --- a/src/mpid/ch3/include/mpidrma.h +++ b/src/mpid/ch3/include/mpidrma.h @@ -1048,12 +1048,11 @@ static inline int fill_ranks_in_win_grp(MPIR_Win * win_ptr, MPIR_Group * group_p int mpi_errno = MPI_SUCCESS; int i, *ranks_in_grp; MPIR_Group *win_grp_ptr; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; - MPIR_CHKLMEM_MALLOC(ranks_in_grp, int *, group_ptr->size * sizeof(int), - mpi_errno, "ranks_in_grp", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(ranks_in_grp, group_ptr->size * sizeof(int)); for (i = 0; i < group_ptr->size; i++) ranks_in_grp[i] = i; diff --git a/src/mpid/ch3/src/ch3u_comm.c b/src/mpid/ch3/src/ch3u_comm.c index b704d3042e2..60d9221032c 100644 --- a/src/mpid/ch3/src/ch3u_comm.c +++ b/src/mpid/ch3/src/ch3u_comm.c @@ -53,7 +53,7 @@ int MPIDI_CH3I_Comm_init(void) { int mpi_errno = MPI_SUCCESS; #if defined HAVE_HCOLL && MPID_CH3I_CH_HCOLL_BCOL - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); #endif MPIR_FUNC_ENTER; @@ -83,7 +83,7 @@ int MPIDI_CH3I_Comm_init(void) char *envstr; int size = strlen("HCOLL_BCOL=") + strlen(MPID_CH3I_CH_HCOLL_BCOL) + 1; - MPIR_CHKLMEM_MALLOC(envstr, char *, size, mpi_errno, "**malloc", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(envstr, size); snprintf(envstr, size, "HCOLL_BCOL=%s", MPID_CH3I_CH_HCOLL_BCOL); r = MPL_putenv(envstr); diff --git a/src/mpid/ch3/src/ch3u_port.c b/src/mpid/ch3/src/ch3u_port.c index bd6c8bebfeb..427baaa1b99 100644 --- a/src/mpid/ch3/src/ch3u_port.c +++ b/src/mpid/ch3/src/ch3u_port.c @@ -586,7 +586,7 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, pg_node *pg_list = NULL; MPIDI_PG_t **remote_pg = NULL; int recvcontext_id = MPIR_INVALID_CONTEXT_ID; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -621,9 +621,7 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, /* Make an array to translate local ranks to process group index and rank */ - MPIR_CHKLMEM_MALLOC(local_translation,pg_translation*, - local_comm_size*sizeof(pg_translation), - mpi_errno,"local_translation", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(local_translation, local_comm_size*sizeof(pg_translation)); /* Make a list of the local communicator's process groups and encode them in strings to be sent to the other side. @@ -667,12 +665,8 @@ int MPIDI_Comm_connect(const char *port_name, MPIR_Info *info, int root, remote_comm_size = recv_ints[1]; context_id = recv_ints[2]; - MPIR_CHKLMEM_MALLOC(remote_pg,MPIDI_PG_t**, - n_remote_pgs * sizeof(MPIDI_PG_t*), - mpi_errno,"remote_pg", MPL_MEM_DYNAMIC); - MPIR_CHKLMEM_MALLOC(remote_translation,pg_translation*, - remote_comm_size * sizeof(pg_translation), - mpi_errno,"remote_translation", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(remote_pg, n_remote_pgs * sizeof(MPIDI_PG_t*)); + MPIR_CHKLMEM_MALLOC(remote_translation, remote_comm_size * sizeof(pg_translation)); MPL_DBG_MSG(MPIDI_CH3_DBG_CONNECT,VERBOSE,"allocated remote process groups"); /* Exchange the process groups and their corresponding KVSes */ @@ -982,14 +976,12 @@ int MPID_PG_BCast( MPIR_Comm *peercomm_p, MPIR_Comm *comm_p, int root ) pg_translation *local_translation = 0; pg_node *pg_list, *pg_next, *pg_head = 0; int rank, i, peer_comm_size; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); peer_comm_size = comm_p->local_size; rank = comm_p->rank; - MPIR_CHKLMEM_MALLOC(local_translation,pg_translation*, - peer_comm_size*sizeof(pg_translation), - mpi_errno,"local_translation", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(local_translation, peer_comm_size*sizeof(pg_translation)); if (rank == root) { /* Get the process groups known to the *peercomm* */ @@ -1135,7 +1127,7 @@ int MPIDI_Comm_accept(const char *port_name, MPIR_Info *info, int root, pg_translation *local_translation = NULL, *remote_translation = NULL; pg_node *pg_list = NULL; MPIDI_PG_t **remote_pg = NULL; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -1161,9 +1153,7 @@ int MPIDI_Comm_accept(const char *port_name, MPIR_Info *info, int root, /* Make an array to translate local ranks to process group index and rank */ - MPIR_CHKLMEM_MALLOC(local_translation,pg_translation*, - local_comm_size*sizeof(pg_translation), - mpi_errno,"local_translation", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(local_translation, local_comm_size*sizeof(pg_translation)); /* Make a list of the local communicator's process groups and encode them in strings to be sent to the other side. @@ -1196,12 +1186,8 @@ int MPIDI_Comm_accept(const char *port_name, MPIR_Info *info, int root, n_remote_pgs = recv_ints[0]; remote_comm_size = recv_ints[1]; context_id = recv_ints[2]; - MPIR_CHKLMEM_MALLOC(remote_pg,MPIDI_PG_t**, - n_remote_pgs * sizeof(MPIDI_PG_t*), - mpi_errno,"remote_pg", MPL_MEM_DYNAMIC); - MPIR_CHKLMEM_MALLOC(remote_translation,pg_translation*, - remote_comm_size * sizeof(pg_translation), - mpi_errno, "remote_translation", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(remote_pg, n_remote_pgs * sizeof(MPIDI_PG_t*)); + MPIR_CHKLMEM_MALLOC(remote_translation, remote_comm_size * sizeof(pg_translation)); MPL_DBG_MSG_FMT(MPIDI_CH3_DBG_OTHER,TERSE,(MPL_DBG_FDEST,"[%d]accept:remote process groups: %d\nremote comm size: %d\n", rank, n_remote_pgs, remote_comm_size)); /* Exchange the process groups and their corresponding KVSes */ diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index 6463c17ab4a..2301b7000be 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -459,7 +459,7 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) int scalable_fence_enabled = 0; int *rma_target_marks = NULL; int mpi_errno = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -523,8 +523,7 @@ int MPID_Win_fence(int assert, MPIR_Win * win_ptr) /* Perform basic algorithm by calling reduce-scatter */ if (!scalable_fence_enabled) { - MPIR_CHKLMEM_MALLOC(rma_target_marks, int *, comm_size * sizeof(int), - mpi_errno, "rma_target_marks", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(rma_target_marks, comm_size * sizeof(int)); for (i = 0; i < comm_size; i++) rma_target_marks[i] = 0; @@ -656,7 +655,7 @@ int MPID_Win_post(MPIR_Group * post_grp_ptr, int assert, MPIR_Win * win_ptr) { int *post_ranks_in_win_grp; int mpi_errno = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -690,15 +689,12 @@ int MPID_Win_post(MPIR_Group * post_grp_ptr, int assert, MPIR_Win * win_ptr) win_comm_ptr = win_ptr->comm_ptr; rank = win_ptr->comm_ptr->rank; - MPIR_CHKLMEM_MALLOC(post_ranks_in_win_grp, int *, - post_grp_size * sizeof(int), mpi_errno, "post_ranks_in_win_grp", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(post_ranks_in_win_grp, post_grp_size * sizeof(int)); mpi_errno = fill_ranks_in_win_grp(win_ptr, post_grp_ptr, post_ranks_in_win_grp); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(req, MPIR_Request **, post_grp_size * sizeof(MPIR_Request *), - mpi_errno, "req", MPL_MEM_RMA); - MPIR_CHKLMEM_MALLOC(status, MPI_Status *, post_grp_size * sizeof(MPI_Status), - mpi_errno, "status", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(req, post_grp_size * sizeof(MPIR_Request *)); + MPIR_CHKLMEM_MALLOC(status, post_grp_size * sizeof(MPI_Status)); /* Send a 0-byte message to the source processes */ for (i = 0; i < post_grp_size; i++) { @@ -774,7 +770,7 @@ static int start_req_complete(MPIR_Request * req) int MPID_Win_start(MPIR_Group * group_ptr, int assert, MPIR_Win * win_ptr) { int mpi_errno = MPI_SUCCESS; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); MPIR_CHKPMEM_DECL(1); MPIR_FUNC_ENTER; @@ -811,11 +807,8 @@ int MPID_Win_start(MPIR_Group * group_ptr, int assert, MPIR_Win * win_ptr) /* post IRECVs */ if (win_ptr->shm_allocated == TRUE) { int node_comm_size = comm_ptr->node_comm->local_size; - MPIR_CHKLMEM_MALLOC(intra_start_req, MPIR_Request **, - node_comm_size * sizeof(MPIR_Request *), mpi_errno, "intra_start_req", MPL_MEM_RMA); - MPIR_CHKLMEM_MALLOC(intra_start_status, MPI_Status *, - node_comm_size * sizeof(MPI_Status), - mpi_errno, "intra_start_status", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(intra_start_req, node_comm_size * sizeof(MPIR_Request *)); + MPIR_CHKLMEM_MALLOC(intra_start_status, node_comm_size * sizeof(MPI_Status)); } intra_cnt = 0; diff --git a/src/mpid/ch3/src/ch3u_win_fns.c b/src/mpid/ch3/src/ch3u_win_fns.c index 0891b21d723..d50598f8f7b 100644 --- a/src/mpid/ch3/src/ch3u_win_fns.c +++ b/src/mpid/ch3/src/ch3u_win_fns.c @@ -34,7 +34,7 @@ int MPIDI_CH3U_Win_gather_info(void *base, MPI_Aint size, int disp_unit, int mpi_errno = MPI_SUCCESS, i, k, comm_size, rank; MPI_Aint *tmp_buf; MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -51,8 +51,7 @@ int MPIDI_CH3U_Win_gather_info(void *base, MPI_Aint size, int disp_unit, /* get the addresses of the windows, window objects, and completion * counters of all processes. allocate temp. buffer for communication */ - MPIR_CHKLMEM_MALLOC(tmp_buf, MPI_Aint *, 4 * comm_size * sizeof(MPI_Aint), - mpi_errno, "tmp_buf", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, 4 * comm_size * sizeof(MPI_Aint)); /* FIXME: If we wanted to validate the transfer as within range at the * origin, we'd also need the window size. */ diff --git a/src/mpid/ch3/src/mpid_vc.c b/src/mpid/ch3/src/mpid_vc.c index 81cb71c91e6..48c77c42224 100644 --- a/src/mpid/ch3/src/mpid_vc.c +++ b/src/mpid/ch3/src/mpid_vc.c @@ -402,7 +402,7 @@ static int check_disjoint_lpids(uint64_t lpids1[], int n1, uint64_t lpids2[], in int mpi_errno = MPI_SUCCESS; uint32_t lpidmaskPrealloc[N_STATIC_LPID32]; uint32_t *lpidmask; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); /* Find the max lpid */ for (i=0; i N_STATIC_LPID32) { - MPIR_CHKLMEM_MALLOC(lpidmask,uint32_t*,mask_size*sizeof(uint32_t), - mpi_errno,"lpidmask", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(lpidmask, mask_size*sizeof(uint32_t)); } else { lpidmask = lpidmaskPrealloc; @@ -471,7 +470,7 @@ int MPID_Intercomm_exchange_map(MPIR_Comm *local_comm_ptr, int local_leader, MPIDI_Gpid *local_gpids=NULL, *remote_gpids=NULL; int comm_info[2]; int cts_tag; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); cts_tag = 0 | MPIR_TAG_COLL_BIT; @@ -499,10 +498,10 @@ int MPID_Intercomm_exchange_map(MPIR_Comm *local_comm_ptr, int local_leader, *remote_size )); /* With this information, we can now send and receive the global process ids from the peer. */ - MPIR_CHKLMEM_MALLOC(remote_gpids,MPIDI_Gpid*,(*remote_size)*sizeof(MPIDI_Gpid), mpi_errno,"remote_gpids", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid)); *remote_lpids = (uint64_t*) MPL_malloc((*remote_size)*sizeof(uint64_t), MPL_MEM_ADDRESS); - MPIR_CHKLMEM_MALLOC(local_gpids,MPIDI_Gpid*,local_size*sizeof(MPIDI_Gpid), mpi_errno,"local_gpids", MPL_MEM_DYNAMIC); - MPIR_CHKLMEM_MALLOC(local_lpids,uint64_t*,local_size*sizeof(uint64_t), mpi_errno,"local_lpids", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(local_gpids, local_size*sizeof(MPIDI_Gpid)); + MPIR_CHKLMEM_MALLOC(local_lpids, local_size*sizeof(uint64_t)); mpi_errno = MPIDI_GPID_GetAllInComm( local_comm_ptr, local_size, local_gpids, &singlePG ); MPIR_ERR_CHECK(mpi_errno); @@ -569,7 +568,7 @@ int MPID_Intercomm_exchange_map(MPIR_Comm *local_comm_ptr, int local_leader, mpi_errno = MPIR_Bcast( comm_info, 2, MPI_INT, local_leader, local_comm_ptr, MPIR_ERR_NONE ); MPIR_ERR_CHECK(mpi_errno); *remote_size = comm_info[0]; - MPIR_CHKLMEM_MALLOC(remote_gpids,MPIDI_Gpid*,(*remote_size)*sizeof(MPIDI_Gpid), mpi_errno,"remote_gpids", MPL_MEM_DYNAMIC); + MPIR_CHKLMEM_MALLOC(remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid)); *remote_lpids = (uint64_t*) MPL_malloc((*remote_size)*sizeof(uint64_t), MPL_MEM_ADDRESS); mpi_errno = MPIR_Bcast( remote_gpids, (*remote_size)*sizeof(MPIDI_Gpid), MPI_BYTE, local_leader, local_comm_ptr, MPIR_ERR_NONE ); diff --git a/src/mpid/ch4/netmod/ofi/init_addrxchg.c b/src/mpid/ch4/netmod/ofi/init_addrxchg.c index 7a1766df84e..544e71cac10 100644 --- a/src/mpid/ch4/netmod/ofi/init_addrxchg.c +++ b/src/mpid/ch4/netmod/ofi/init_addrxchg.c @@ -213,7 +213,7 @@ int MPIDI_OFI_addr_exchange_all_ctx(void) MPIR_Comm *comm = MPIR_Process.comm_world; int size = MPIR_Process.size; int rank = MPIR_Process.rank; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); int max_vcis; int *all_num_vcis; @@ -223,8 +223,7 @@ int MPIDI_OFI_addr_exchange_all_ctx(void) all_num_vcis = NULL; #else /* Allgather num_vcis */ - MPIR_CHKLMEM_MALLOC(all_num_vcis, void *, sizeof(int) * size, - mpi_errno, "all_num_vcis", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(all_num_vcis, sizeof(int) * size); mpi_errno = MPIR_Allgather_fallback(&MPIDI_OFI_global.num_vcis, 1, MPI_INT, all_num_vcis, 1, MPI_INT, comm, MPIR_ERR_NONE); MPIR_ERR_CHECK(mpi_errno); @@ -249,7 +248,7 @@ int MPIDI_OFI_addr_exchange_all_ctx(void) int name_len = MPIDI_OFI_global.addrnamelen; int my_len = max_vcis * num_nics * name_len; char *all_names; - MPIR_CHKLMEM_MALLOC(all_names, char *, size * my_len, mpi_errno, "all_names", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(all_names, size * my_len); char *my_names = all_names + rank * my_len; /* put in my addrnames */ @@ -284,8 +283,7 @@ int MPIDI_OFI_addr_exchange_all_ctx(void) int *is_node_roots = NULL; if (MPIR_CVAR_CH4_ROOTS_ONLY_PMI) { - MPIR_CHKLMEM_MALLOC(is_node_roots, int *, size * sizeof(int), - mpi_errno, "is_node_roots", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(is_node_roots, size * sizeof(int)); for (int r = 0; r < size; r++) { is_node_roots[r] = 0; } diff --git a/src/mpid/ch4/netmod/ofi/ofi_am_impl.h b/src/mpid/ch4/netmod/ofi/ofi_am_impl.h index fddadc97ef3..05b73bd10ce 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_am_impl.h +++ b/src/mpid/ch4/netmod/ofi/ofi_am_impl.h @@ -573,7 +573,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_do_inject(int rank, int nic = 0; int ctx_idx = MPIDI_OFI_get_ctx_index(vci_src, nic); fi_addr_t dst_addr = MPIDI_OFI_comm_to_phys(comm, rank, nic, vci_dst); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -595,7 +595,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_do_inject(int rank, } buff_len = sizeof(msg_hdr) + am_hdr_sz; - MPIR_CHKLMEM_MALLOC(buff, char *, buff_len, mpi_errno, "buff", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(buff, buff_len); memcpy(buff, &msg_hdr, sizeof(msg_hdr)); memcpy(buff + sizeof(msg_hdr), am_hdr, am_hdr_sz); diff --git a/src/mpid/ch4/netmod/ofi/ofi_nic.c b/src/mpid/ch4/netmod/ofi/ofi_nic.c index 7ee60b1f60f..c8dcd79d92a 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_nic.c +++ b/src/mpid/ch4/netmod/ofi/ofi_nic.c @@ -256,7 +256,7 @@ static int setup_multi_nic(int nic_count) int num_parents = 0; int local_rank = MPIR_Process.local_rank; MPIDI_OFI_nic_info_t *nics = MPIDI_OFI_global.nic_info; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); bool pref_nic_set = false; MPIDI_OFI_global.num_nics = nic_count; @@ -364,8 +364,7 @@ static int setup_multi_nic(int nic_count) /* When using this CVAR, the rank can only use 1 NIC. We do not reset num_close_nics again * in case a NIC is down and it needs to use another NIC. */ MPIDI_OFI_nic_info_t *tmp_nic; - MPIR_CHKLMEM_MALLOC(tmp_nic, MPIDI_OFI_nic_info_t *, sizeof(MPIDI_OFI_nic_info_t), - mpi_errno, "temporary nic info", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(tmp_nic, sizeof(MPIDI_OFI_nic_info_t)); int idx_to = 0; int idx_from = MPIR_CVAR_CH4_OFI_PREF_NIC; memcpy(tmp_nic, &nics[idx_from], sizeof(MPIDI_OFI_nic_info_t)); @@ -390,9 +389,7 @@ static int setup_multi_nic(int nic_count) if (old_idx != 0) { MPIDI_OFI_nic_info_t *old_nics; - MPIR_CHKLMEM_MALLOC(old_nics, MPIDI_OFI_nic_info_t *, sizeof(MPIDI_OFI_nic_info_t) * - MPIDI_OFI_global.num_nics, mpi_errno, "temporary nic info", - MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(old_nics, sizeof(MPIDI_OFI_nic_info_t) * MPIDI_OFI_global.num_nics); memcpy(old_nics, nics, sizeof(MPIDI_OFI_nic_info_t) * MPIDI_OFI_global.num_nics); /* Rotate the preferred NIC for each process starting at old_idx. */ diff --git a/src/mpid/ch4/netmod/ofi/ofi_spawn.c b/src/mpid/ch4/netmod/ofi/ofi_spawn.c index 20adc54b3b1..a342e366907 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_spawn.c +++ b/src/mpid/ch4/netmod/ofi/ofi_spawn.c @@ -147,12 +147,10 @@ int MPIDI_OFI_upids_to_gpids(int size, int *remote_upid_size, char *remote_upids int nic = 0; int ctx_idx = MPIDI_OFI_get_ctx_index(0, nic); - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); - MPIR_CHKLMEM_MALLOC(new_avt_procs, int *, sizeof(int) * size, mpi_errno, "new_avt_procs", - MPL_MEM_ADDRESS); - MPIR_CHKLMEM_MALLOC(new_upids, char **, sizeof(char *) * size, mpi_errno, "new_upids", - MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(new_avt_procs, sizeof(int) * size); + MPIR_CHKLMEM_MALLOC(new_upids, sizeof(char *) * size); n_avts = MPIDIU_get_n_avts(); diff --git a/src/mpid/ch4/netmod/ofi/ofi_win.c b/src/mpid/ch4/netmod/ofi/ofi_win.c index 997a4dfd111..0b269d2df6e 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_win.c +++ b/src/mpid/ch4/netmod/ofi/ofi_win.c @@ -936,7 +936,7 @@ int MPIDI_OFI_mpi_win_attach_hook(MPIR_Win * win, void *base, MPI_Aint size) MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (!MPIDI_OFI_ENABLE_RMA || MPIDI_OFI_WIN(win).mr || !MPIDIG_WIN(win, info_args).coll_attach) goto fn_exit; @@ -982,10 +982,7 @@ int MPIDI_OFI_mpi_win_attach_hook(MPIR_Win * win, void *base, MPI_Aint size) (uintptr_t) size, (const void *) mr); MPIR_ERR_CHKANDJUMP(mpl_err != MPL_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**mpl_gavl_insert"); - MPIR_CHKLMEM_MALLOC(target_mrs, dwin_target_mr_t *, - sizeof(dwin_target_mr_t) * comm_ptr->local_size, - mpi_errno, "temp buffer for dynamic win remote memory regions", - MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(target_mrs, sizeof(dwin_target_mr_t) * comm_ptr->local_size); /* Exchange remote MR across all processes because "coll_attach" info ensures * that all processes collectively call attach. */ @@ -1031,7 +1028,7 @@ int MPIDI_OFI_mpi_win_detach_hook(MPIR_Win * win, const void *base) const void **target_bases; int mpl_err = MPL_SUCCESS, i; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); if (!MPIDI_OFI_ENABLE_RMA || MPIDI_OFI_WIN(win).mr || !MPIDIG_WIN(win, info_args).coll_attach) goto fn_exit; @@ -1043,10 +1040,7 @@ int MPIDI_OFI_mpi_win_detach_hook(MPIR_Win * win, const void *base) "**mpl_gavl_delete_start_addr"); /* Notify remote processes to delete their local cached MR key */ - MPIR_CHKLMEM_MALLOC(target_bases, const void **, - sizeof(const void *) * comm_ptr->local_size, - mpi_errno, "temp buffer for dynamic win remote memory regions", - MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(target_bases, sizeof(const void *) * comm_ptr->local_size); /* Exchange remote MR across all processes because "coll_attach" info ensures * that all processes collectively call detach. */ diff --git a/src/mpid/ch4/netmod/ucx/ucx_spawn.c b/src/mpid/ch4/netmod/ucx/ucx_spawn.c index 05e888d5639..52c7cc3975e 100644 --- a/src/mpid/ch4/netmod/ucx/ucx_spawn.c +++ b/src/mpid/ch4/netmod/ucx/ucx_spawn.c @@ -156,12 +156,10 @@ int MPIDI_UCX_upids_to_gpids(int size, int *remote_upid_size, char *remote_upids int *new_avt_procs; char **new_upids; int vci = 0; - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); - MPIR_CHKLMEM_MALLOC(new_avt_procs, int *, sizeof(int) * size, mpi_errno, "new_avt_procs", - MPL_MEM_ADDRESS); - MPIR_CHKLMEM_MALLOC(new_upids, char **, sizeof(char *) * size, mpi_errno, "new_upids", - MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(new_avt_procs, sizeof(int) * size); + MPIR_CHKLMEM_MALLOC(new_upids, sizeof(char *) * size); char *curr_upid = remote_upids; for (int i = 0; i < size; i++) { diff --git a/src/mpid/ch4/shm/ipc/src/ipc_p2p.h b/src/mpid/ch4/shm/ipc/src/ipc_p2p.h index 05f627a9638..9cacfd2baa6 100644 --- a/src/mpid/ch4/shm/ipc/src/ipc_p2p.h +++ b/src/mpid/ch4/shm/ipc/src/ipc_p2p.h @@ -42,7 +42,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_IPCI_send_lmt(const void *buf, MPI_Aint count int mpi_errno = MPI_SUCCESS; MPIR_Request *sreq = NULL; MPIDI_IPC_rts_t am_hdr; - MPIR_CHKLMEM_DECL(1); /* we may need allocate hdr for non-contig case */ + MPIR_CHKLMEM_DECL(); /* we may need allocate hdr for non-contig case */ int flags = syncflag ? MPIDIG_AM_SEND_FLAGS_SYNC : MPIDIG_AM_SEND_FLAGS_NONE; MPIR_FUNC_ENTER; @@ -120,7 +120,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_IPCI_send_lmt(const void *buf, MPI_Aint count am_hdr.ipc_hdr.count = count; hdr_sz = sizeof(am_hdr) + flattened_sz; - MPIR_CHKLMEM_MALLOC(hdr, void *, hdr_sz, mpi_errno, "hdr", MPL_MEM_OTHER); + MPIR_CHKLMEM_MALLOC(hdr, hdr_sz); memcpy(hdr, &am_hdr, sizeof(am_hdr)); memcpy((char *) hdr + sizeof(am_hdr), flattened_dt, flattened_sz); diff --git a/src/mpid/ch4/shm/ipc/src/ipc_win.c b/src/mpid/ch4/shm/ipc/src/ipc_win.c index 03b72f8c682..0c4af95f0b1 100644 --- a/src/mpid/ch4/shm/ipc/src/ipc_win.c +++ b/src/mpid/ch4/shm/ipc/src/ipc_win.c @@ -69,7 +69,7 @@ int MPIDI_IPC_mpi_win_create_hook(MPIR_Win * win) MPIR_FUNC_ENTER; MPIR_CHKPMEM_DECL(2); - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); /* Skip IPC initialization if no local process */ if (!shm_comm_ptr) @@ -124,9 +124,7 @@ int MPIDI_IPC_mpi_win_create_hook(MPIR_Win * win) mpi_errno, "shared table", MPL_MEM_RMA); shared_table = MPIDIG_WIN(win, shared_table); - MPIR_CHKLMEM_MALLOC(ipc_shared_table, win_shared_info_t *, - sizeof(win_shared_info_t) * shm_comm_ptr->local_size, - mpi_errno, "IPC temporary shared table", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(ipc_shared_table, sizeof(win_shared_info_t) * shm_comm_ptr->local_size); memset(&ipc_shared_table[shm_comm_ptr->rank], 0, sizeof(win_shared_info_t)); ipc_shared_table[shm_comm_ptr->rank].size = win->size; @@ -176,8 +174,7 @@ int MPIDI_IPC_mpi_win_create_hook(MPIR_Win * win) } /* Attach remote memory regions based on its IPC type */ - MPIR_CHKLMEM_MALLOC(ranks_in_shm_grp, int *, shm_comm_ptr->local_size * sizeof(int) * 2, - mpi_errno, "ranks in shm group", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(ranks_in_shm_grp, shm_comm_ptr->local_size * sizeof(int) * 2); mpi_errno = get_node_ranks(shm_comm_ptr, ranks_in_shm_grp, &ranks_in_shm_grp[shm_comm_ptr->local_size]); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h b/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h index 466d575dff9..d573c6fd17a 100644 --- a/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h +++ b/src/mpid/ch4/shm/posix/posix_coll_gpu_ipc.h @@ -201,7 +201,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_alltoall_gpu_ipc_read(const void *s MPIR_Errflag_t errflag) { MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); int mpi_errno = MPI_SUCCESS; @@ -231,8 +231,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_alltoall_gpu_ipc_read(const void *s /* map ipc_handles to remote_bufs */ void **remote_bufs = NULL; - MPIR_CHKLMEM_MALLOC(remote_bufs, void **, sizeof(void *) * comm_size, mpi_errno, "Remote bufs", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(remote_bufs, sizeof(void *) * comm_size); for (int i = 0; i < comm_size; i++) { if (i != my_rank) { int remote_dev = @@ -246,8 +245,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_alltoall_gpu_ipc_read(const void *s } /* use imemcpy to copy the data concurrently */ MPL_gpu_request *reqs = NULL; - MPIR_CHKLMEM_MALLOC(reqs, MPL_gpu_request *, sizeof(MPL_gpu_request) * comm_size, mpi_errno, - "Memcpy requests", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reqs, sizeof(MPL_gpu_request) * comm_size); for (int i = 0; i < comm_size; i++) { int target = (my_rank + 1 + i) % comm_size; char *temp_recv = (char *) recv_mem_addr + target * data_sz; @@ -295,7 +293,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allgather_gpu_ipc_read(const void * MPIR_Errflag_t errflag) { MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); int mpi_errno = MPI_SUCCESS; @@ -325,8 +323,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allgather_gpu_ipc_read(const void * /* map ipc_handles to remote_bufs */ void **remote_bufs = NULL; - MPIR_CHKLMEM_MALLOC(remote_bufs, void **, sizeof(void *) * comm_size, mpi_errno, "Remote bufs", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(remote_bufs, sizeof(void *) * comm_size); for (int i = 0; i < comm_size; i++) { if (i != my_rank) { int remote_dev = @@ -340,8 +337,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allgather_gpu_ipc_read(const void * } /* use imemcpy to copy the data concurrently */ MPL_gpu_request *reqs = NULL; - MPIR_CHKLMEM_MALLOC(reqs, MPL_gpu_request *, sizeof(MPL_gpu_request) * comm_size, mpi_errno, - "Memcpy requests", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reqs, sizeof(MPL_gpu_request) * comm_size); for (int i = 0; i < comm_size; i++) { int target = (my_rank + 1 + i) % comm_size; char *temp_recv = (char *) recv_mem_addr + target * data_sz; @@ -390,7 +386,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allgatherv_gpu_ipc_read(const void MPIR_Errflag_t errflag) { MPIR_FUNC_ENTER; - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); int mpi_errno = MPI_SUCCESS; @@ -421,8 +417,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allgatherv_gpu_ipc_read(const void /* map ipc_handles to remote_bufs */ void **remote_bufs = NULL; - MPIR_CHKLMEM_MALLOC(remote_bufs, void **, sizeof(void *) * comm_size, mpi_errno, "Remote bufs", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(remote_bufs, sizeof(void *) * comm_size); for (int i = 0; i < comm_size; i++) { if (i != my_rank) { int remote_dev = @@ -436,8 +431,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allgatherv_gpu_ipc_read(const void } /* use imemcpy to copy the data concurrently */ MPL_gpu_request *reqs = NULL; - MPIR_CHKLMEM_MALLOC(reqs, MPL_gpu_request *, sizeof(MPL_gpu_request) * comm_size, mpi_errno, - "Memcpy requests", MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(reqs, sizeof(MPL_gpu_request) * comm_size); MPI_Aint recvtype_extent; MPIR_Datatype_get_extent_macro(recvtype, recvtype_extent); for (int i = 0; i < comm_size; i++) { diff --git a/src/mpid/ch4/shm/posix/release_gather/nb_bcast_release_gather.h b/src/mpid/ch4/shm/posix/release_gather/nb_bcast_release_gather.h index f11907a4d5b..18b51f61e15 100644 --- a/src/mpid/ch4/shm/posix/release_gather/nb_bcast_release_gather.h +++ b/src/mpid/ch4/shm/posix/release_gather/nb_bcast_release_gather.h @@ -354,7 +354,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_nb_release_gather_ibcast_impl(void *loc void *ori_local_buf = local_buf; MPI_Datatype ori_datatype = datatype; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); /* Register the vertices */ root_datacopy_type_id = MPIR_TSP_sched_new_type(sched, MPIDI_POSIX_NB_RG_root_datacopy_issue, @@ -401,8 +401,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_nb_release_gather_ibcast_impl(void *loc MPIR_Algo_calculate_pipeline_chunk_info(MPIDI_POSIX_RELEASE_GATHER_BCAST_CELLSIZE, 1, nbytes, &num_chunks, &chunk_count_floor, &chunk_count_ceil); - MPIR_CHKLMEM_MALLOC(sixth_vtx_id, int *, num_chunks * sizeof(int), mpi_errno, "sixth_vtx_ids", - MPL_MEM_COLL); + MPIR_CHKLMEM_MALLOC(sixth_vtx_id, num_chunks * sizeof(int)); /* Do pipelined release-gather */ /* A schedule gets created in the form of a forest, where each tree has 6 vertices (to perform diff --git a/src/mpid/ch4/src/ch4_coll_impl.h b/src/mpid/ch4/src/ch4_coll_impl.h index fd3e193dddf..43e16bdf5e2 100644 --- a/src/mpid/ch4/src/ch4_coll_impl.h +++ b/src/mpid/ch4/src/ch4_coll_impl.h @@ -950,7 +950,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Reduce_intra_composition_alpha(const void *se MPI_Aint extent = 0; void *ori_recvbuf = recvbuf; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); /* TODO: we can safe the last send/recv if -- * 1. if node_comm is the same size as original comm, fallback * 2. if root is in node_roots_comm but not rank 0, reduce to root rather than 0 @@ -963,8 +963,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Reduce_intra_composition_alpha(const void *se MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(recvbuf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(recvbuf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ recvbuf = (void *) ((char *) recvbuf - true_lb); } @@ -1034,7 +1033,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Reduce_intra_composition_beta(const void *sen MPI_Aint true_extent = 0; MPI_Aint extent = 0; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); void *tmp_buf = NULL; @@ -1044,8 +1043,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Reduce_intra_composition_beta(const void *sen MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tmp_buf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tmp_buf, count * (MPL_MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ tmp_buf = (void *) ((char *) tmp_buf - true_lb); } @@ -1678,26 +1676,23 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Scan_intra_composition_alpha(const void *send MPI_Aint extent = 0; int noneed = 1; /* noneed=1 means no need to bcast tempbuf and * reduce tempbuf & recvbuf */ - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent); MPIR_Datatype_get_extent_macro(datatype, extent); - MPIR_CHKLMEM_MALLOC(tempbuf, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "temporary buffer", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(tempbuf, count * (MPL_MAX(extent, true_extent))); tempbuf = (void *) ((char *) tempbuf - true_lb); /* Create prefulldata and localfulldata on local roots of all nodes */ if (comm_ptr->node_roots_comm != NULL) { - MPIR_CHKLMEM_MALLOC(prefulldata, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "prefulldata for scan", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(prefulldata, count * (MPL_MAX(extent, true_extent))); prefulldata = (void *) ((char *) prefulldata - true_lb); if (comm_ptr->node_comm != NULL) { - MPIR_CHKLMEM_MALLOC(localfulldata, void *, count * (MPL_MAX(extent, true_extent)), - mpi_errno, "localfulldata for scan", MPL_MEM_BUFFER); + MPIR_CHKLMEM_MALLOC(localfulldata, count * (MPL_MAX(extent, true_extent))); localfulldata = (void *) ((char *) localfulldata - true_lb); } } diff --git a/src/mpid/ch4/src/ch4_comm.c b/src/mpid/ch4/src/ch4_comm.c index 808d6f6e21b..88815116ef0 100644 --- a/src/mpid/ch4/src/ch4_comm.c +++ b/src/mpid/ch4/src/ch4_comm.c @@ -414,7 +414,7 @@ int MPID_Intercomm_exchange_map(MPIR_Comm * local_comm, int local_leader, MPIR_C MPIR_FUNC_ENTER; MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(5); + MPIR_CHKLMEM_DECL(); cts_tag = 0 | MPIR_TAG_COLL_BIT; local_size = local_comm->local_size; @@ -464,8 +464,7 @@ int MPID_Intercomm_exchange_map(MPIR_Comm * local_comm, int local_leader, MPIR_C MPIR_CHKPMEM_MALLOC((*remote_gpids), uint64_t *, (*remote_size) * sizeof(uint64_t), mpi_errno, "remote_gpids", MPL_MEM_ADDRESS); - MPIR_CHKLMEM_MALLOC(local_gpids, uint64_t *, local_size * sizeof(uint64_t), - mpi_errno, "local_gpids", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(local_gpids, local_size * sizeof(uint64_t)); for (i = 0; i < local_size; i++) { MPIDIU_comm_rank_to_pid(local_comm, i, &lpid, &avtid); local_gpids[i] = MPIDIU_GPID_CREATE(avtid, lpid); @@ -479,8 +478,7 @@ int MPID_Intercomm_exchange_map(MPIR_Comm * local_comm, int local_leader, MPIR_C (MPL_DBG_FDEST, "Intercomm map exchange stage 1: leaders")); if (!pure_intracomm) { /* Stage 1.1 UPID exchange between leaders */ - MPIR_CHKLMEM_MALLOC(remote_upid_size, int *, (*remote_size) * sizeof(int), - mpi_errno, "remote_upid_size", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(remote_upid_size, (*remote_size) * sizeof(int)); mpi_errno = MPIDI_NM_get_local_upids(local_comm, &local_upid_size, &local_upids); MPIR_ERR_CHECK(mpi_errno); @@ -496,8 +494,7 @@ int MPID_Intercomm_exchange_map(MPIR_Comm * local_comm, int local_leader, MPIR_C upid_recv_size = 0; for (i = 0; i < *remote_size; i++) upid_recv_size += remote_upid_size[i]; - MPIR_CHKLMEM_MALLOC(remote_upids, char *, upid_recv_size * sizeof(char), - mpi_errno, "remote_upids", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(remote_upids, upid_recv_size * sizeof(char)); mpi_errno = MPIC_Sendrecv(local_upids, upid_send_size, MPI_BYTE, remote_leader, cts_tag, remote_upids, upid_recv_size, MPI_BYTE, @@ -607,7 +604,7 @@ int MPIDIU_Intercomm_map_bcast_intra(MPIR_Comm * local_comm, int local_leader, i char *_remote_upids = NULL; MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(3); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -648,13 +645,11 @@ int MPIDIU_Intercomm_map_bcast_intra(MPIR_Comm * local_comm, int local_leader, i MPIR_CHKPMEM_MALLOC((*remote_gpids), uint64_t *, (*remote_size) * sizeof(uint64_t), mpi_errno, "remote_gpids", MPL_MEM_COMM); if (!pure_intracomm) { - MPIR_CHKLMEM_MALLOC(_remote_upid_size, int *, (*remote_size) * sizeof(int), - mpi_errno, "_remote_upid_size", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(_remote_upid_size, (*remote_size) * sizeof(int)); mpi_errno = MPIR_Bcast_allcomm_auto(_remote_upid_size, *remote_size, MPI_INT, local_leader, local_comm, MPIR_ERR_NONE); MPIR_ERR_CHECK(mpi_errno); - MPIR_CHKLMEM_MALLOC(_remote_upids, char *, upid_recv_size * sizeof(char), - mpi_errno, "_remote_upids", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(_remote_upids, upid_recv_size * sizeof(char)); mpi_errno = MPIR_Bcast_allcomm_auto(_remote_upids, upid_recv_size, MPI_BYTE, local_leader, local_comm, MPIR_ERR_NONE); MPIR_ERR_CHECK(mpi_errno); diff --git a/src/mpid/ch4/src/ch4i_comm.c b/src/mpid/ch4/src/ch4i_comm.c index 7a8b5a97d9f..f56e894a71e 100644 --- a/src/mpid/ch4/src/ch4i_comm.c +++ b/src/mpid/ch4/src/ch4i_comm.c @@ -933,7 +933,7 @@ int MPIDI_check_disjoint_gpids(uint64_t gpids1[], int n1, uint64_t gpids2[], int int mpi_errno = MPI_SUCCESS; uint32_t gpidmaskPrealloc[128]; uint32_t *gpidmask; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -970,8 +970,7 @@ int MPIDI_check_disjoint_gpids(uint64_t gpids1[], int n1, uint64_t gpids2[], int uint64_t mask_size = (max_gpid / 32) + 1; if (mask_size > 128) { - MPIR_CHKLMEM_MALLOC(gpidmask, uint32_t *, mask_size * sizeof(uint32_t), - mpi_errno, "gpidmask", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(gpidmask, mask_size * sizeof(uint32_t)); } else { gpidmask = gpidmaskPrealloc; } diff --git a/src/mpid/ch4/src/mpidig_win.c b/src/mpid/ch4/src/mpidig_win.c index 1438c198de0..f3497857ad4 100644 --- a/src/mpid/ch4/src/mpidig_win.c +++ b/src/mpid/ch4/src/mpidig_win.c @@ -501,7 +501,7 @@ static int win_shm_alloc_impl(MPI_Aint size, int disp_unit, MPIR_Comm * comm_ptr bool symheap_flag = true, global_symheap_flag = false; MPIR_CHKPMEM_DECL(2); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; win = *win_ptr; @@ -529,8 +529,7 @@ static int win_shm_alloc_impl(MPI_Aint size, int disp_unit, MPIR_Comm * comm_ptr if (mpi_errno != MPI_SUCCESS) goto fn_fail; - MPIR_CHKLMEM_MALLOC(shm_offsets, MPI_Aint *, shm_comm_ptr->local_size * sizeof(MPI_Aint), - mpi_errno, "shm offset", MPL_MEM_RMA); + MPIR_CHKLMEM_MALLOC(shm_offsets, shm_comm_ptr->local_size * sizeof(MPI_Aint)); for (i = 0; i < shm_comm_ptr->local_size; i++) { shm_offsets[i] = (MPI_Aint) total_shm_size; diff --git a/src/mpid/common/shm/mpidu_init_shm.c b/src/mpid/common/shm/mpidu_init_shm.c index 899865e2488..2af778df305 100644 --- a/src/mpid/common/shm/mpidu_init_shm.c +++ b/src/mpid/common/shm/mpidu_init_shm.c @@ -113,7 +113,7 @@ int MPIDU_Init_shm_init(void) { int mpi_errno = MPI_SUCCESS, mpl_err = 0; MPIR_CHKPMEM_DECL(1); - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_FUNC_ENTER; @@ -163,8 +163,7 @@ int MPIDU_Init_shm_init(void) } else { /* non-root prepare to recv */ serialized_hnd_size = MPIR_pmi_max_val_size(); - MPIR_CHKLMEM_MALLOC(serialized_hnd, char *, serialized_hnd_size, mpi_errno, "val", - MPL_MEM_OTHER); + MPIR_CHKLMEM_MALLOC(serialized_hnd, serialized_hnd_size); } } /* All processes need call MPIR_pmi_bcast. This is because we may need call MPIR_pmi_barrier diff --git a/src/util/mpir_localproc.c b/src/util/mpir_localproc.c index 69af386f8d0..0ef55ee2400 100644 --- a/src/util/mpir_localproc.c +++ b/src/util/mpir_localproc.c @@ -143,7 +143,7 @@ int MPIR_Find_external(MPIR_Comm * comm, int *external_size_p, int *external_ran int *external_ranks, *internode_table; int node_id; - MPIR_CHKLMEM_DECL(1); + MPIR_CHKLMEM_DECL(); MPIR_CHKPMEM_DECL(2); /* Scan through the list of processes in comm and add one @@ -164,7 +164,7 @@ int MPIR_Find_external(MPIR_Comm * comm, int *external_size_p, int *external_ran if (MPIR_Process.node_hostnames) { num_nodes = utarray_len(MPIR_Process.node_hostnames); } - MPIR_CHKLMEM_MALLOC(nodes, int *, sizeof(int) * num_nodes, mpi_errno, "nodes", MPL_MEM_COMM); + MPIR_CHKLMEM_MALLOC(nodes, sizeof(int) * num_nodes); /* nodes maps node_id to rank in external_ranks of leader for that node */ for (i = 0; i < num_nodes; ++i) diff --git a/src/util/mpir_nodemap.c b/src/util/mpir_nodemap.c index a3d5fea409a..e5b58505ba9 100644 --- a/src/util/mpir_nodemap.c +++ b/src/util/mpir_nodemap.c @@ -275,7 +275,7 @@ static int pmi_publish_node_id(int sz, int myrank) int key_max_sz; char hostname[MAX_HOSTNAME_LEN]; char strerrbuf[MPIR_STRERROR_BUF_SIZE] ATTRIBUTE((unused)); - MPIR_CHKLMEM_DECL(2); + MPIR_CHKLMEM_DECL(); /* set hostname */ @@ -287,7 +287,7 @@ static int pmi_publish_node_id(int sz, int myrank) /* Allocate space for pmi key */ key_max_sz = MPIR_pmi_max_key_size(); - MPIR_CHKLMEM_MALLOC(key, char *, key_max_sz, mpi_errno, "key", MPL_MEM_ADDRESS); + MPIR_CHKLMEM_MALLOC(key, key_max_sz); /* Put my hostname id */ if (sz > 1) {