[mpich2-commits] r3928 - mpich2/trunk/src/mpi/coll
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Tue Mar 3 16:11:28 CST 2009
Author: balaji
Date: 2009-03-03 16:11:28 -0600 (Tue, 03 Mar 2009)
New Revision: 3928
Modified:
mpich2/trunk/src/mpi/coll/gatherv.c
mpich2/trunk/src/mpi/coll/scatterv.c
Log:
Use MPIU_CHKLMEM_MALLOC instead of MPIU_Malloc. No reviewer.
Modified: mpich2/trunk/src/mpi/coll/gatherv.c
===================================================================
--- mpich2/trunk/src/mpi/coll/gatherv.c 2009-03-03 21:29:01 UTC (rev 3927)
+++ mpich2/trunk/src/mpi/coll/gatherv.c 2009-03-03 22:11:28 UTC (rev 3928)
@@ -60,6 +60,7 @@
int i, reqs;
MPI_Request *reqarray;
MPI_Status *starray;
+ MPIU_CHKLMEM_DECL(2);
comm = comm_ptr->handle;
rank = comm_ptr->rank;
@@ -80,8 +81,8 @@
MPID_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
displs[rank] * extent);
- reqarray = (MPI_Request *) MPIU_Malloc(comm_size * sizeof(MPI_Request));
- starray = (MPI_Request *) MPIU_Malloc(comm_size * sizeof(MPI_Status));
+ MPIU_CHKLMEM_MALLOC(reqarray, MPI_Request *, comm_size * sizeof(MPI_Request), mpi_errno, "reqarray");
+ MPIU_CHKLMEM_MALLOC(starray, MPI_Status *, comm_size * sizeof(MPI_Status), mpi_errno, "starray");
reqs = 0;
for (i = 0; i < comm_size; i++) {
@@ -115,9 +116,6 @@
mpi_errno = starray[i].MPI_ERROR;
}
}
-
- MPIU_Free(reqarray);
- MPIU_Free(starray);
}
else if (root != MPI_PROC_NULL) { /* non-root nodes, and in the intercomm. case, non-root nodes on remote side */
@@ -128,8 +126,12 @@
/* check if multiple threads are calling this collective function */
MPIDU_ERR_CHECK_MULTIPLE_THREADS_EXIT( comm_ptr );
-
- return (mpi_errno);
+
+fn_exit:
+ MPIU_CHKLMEM_FREEALL();
+ return mpi_errno;
+fn_fail:
+ goto fn_exit;
}
#endif
Modified: mpich2/trunk/src/mpi/coll/scatterv.c
===================================================================
--- mpich2/trunk/src/mpi/coll/scatterv.c 2009-03-03 21:29:01 UTC (rev 3927)
+++ mpich2/trunk/src/mpi/coll/scatterv.c 2009-03-03 22:11:28 UTC (rev 3928)
@@ -61,6 +61,7 @@
int i, reqs;
MPI_Request *reqarray;
MPI_Status *starray;
+ MPIU_CHKLMEM_DECL(2);
comm = comm_ptr->handle;
rank = comm_ptr->rank;
@@ -85,8 +86,8 @@
* this? */
MPID_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf + extent);
- reqarray = (MPI_Request *) MPIU_Malloc(comm_size * sizeof(MPI_Request));
- starray = (MPI_Request *) MPIU_Malloc(comm_size * sizeof(MPI_Status));
+ MPIU_CHKLMEM_MALLOC(reqarray, MPI_Request *, comm_size * sizeof(MPI_Request), mpi_errno, "reqarray");
+ MPIU_CHKLMEM_MALLOC(starray, MPI_Status *, comm_size * sizeof(MPI_Status), mpi_errno, "starray");
reqs = 0;
for (i = 0; i < comm_size; i++) {
@@ -119,9 +120,6 @@
mpi_errno = starray[i].MPI_ERROR;
}
}
-
- MPIU_Free(reqarray);
- MPIU_Free(starray);
}
else if (root != MPI_PROC_NULL) { /* non-root nodes, and in the intercomm. case, non-root nodes on remote side */
@@ -133,7 +131,11 @@
/* check if multiple threads are calling this collective function */
MPIDU_ERR_CHECK_MULTIPLE_THREADS_EXIT( comm_ptr );
- return (mpi_errno);
+fn_exit:
+ MPIU_CHKLMEM_FREEALL();
+ return mpi_errno;
+fn_fail:
+ goto fn_exit;
}
#endif
More information about the mpich2-commits
mailing list