[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2-37-gf53a662

Service Account noreply at mpich.org
Wed Dec 23 09:47:44 CST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  f53a662b5ca97fc2a0556f5f5c9ed5bd960f78bf (commit)
       via  88ca8ae7ac344c9b216f80da87bb10c8ffb916a2 (commit)
       via  06c7c4dbcd15544d812ec871ba3a869c8f6c0b9e (commit)
      from  31c81dac2a09d9117597c13b7956ca84f4b164e8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/f53a662b5ca97fc2a0556f5f5c9ed5bd960f78bf

commit f53a662b5ca97fc2a0556f5f5c9ed5bd960f78bf
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Fri Sep 11 11:06:27 2015 -0500

    consolidate min and max macros in MPL
    
    Provide a single implementation of min and max macros to be used in all
    layers of MPICH. Removes scattered definitions from the rest of the code.
    
    Signed-off-by: Yanfei Guo <yguo at anl.gov>

diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index 91d6a62..1057c66 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -3859,14 +3859,6 @@ extern MPIR_Op_check_dtype_fn *MPIR_Op_check_dtype_table[];
 #define MPIR_OP_HDL_TO_FN(op) MPIR_Op_table[((op)&0xf) - 1]
 #define MPIR_OP_HDL_TO_DTYPE_FN(op) MPIR_Op_check_dtype_table[((op)&0xf) - 1]
 
-#if !defined MPIR_MIN
-#define MPIR_MIN(a,b) (((a)>(b))?(b):(a))
-#endif /* MPIR_MIN */
-
-#if !defined MPIR_MAX
-#define MPIR_MAX(a,b) (((b)>(a))?(b):(a))
-#endif /* MPIR_MAX */
-
 int MPIR_Type_is_rma_atomic(MPI_Datatype type);
 int MPIR_Compare_equal(const void *a, const void *b, MPI_Datatype type);
 
diff --git a/src/mpi/coll/allgather.c b/src/mpi/coll/allgather.c
index fc9483e..b5a6240 100644
--- a/src/mpi/coll/allgather.c
+++ b/src/mpi/coll/allgather.c
@@ -489,7 +489,7 @@ int MPIR_Allgather_intra (
         MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
             
         recvbuf_extent = recvcount * comm_size *
-            (MPIR_MAX(recvtype_true_extent, recvtype_extent));
+            (MPL_MAX(recvtype_true_extent, recvtype_extent));
 
         MPIU_CHKLMEM_MALLOC(tmp_buf, void*, recvbuf_extent, mpi_errno, "tmp_buf");
             
@@ -680,7 +680,7 @@ int MPIR_Allgather_inter (
         MPIR_Type_get_true_extent_impl(sendtype, &true_lb, &true_extent);
 
         MPID_Datatype_get_extent_macro( sendtype, send_extent );
-        extent = MPIR_MAX(send_extent, true_extent);
+        extent = MPL_MAX(send_extent, true_extent);
 
 	MPIU_Ensure_Aint_fits_in_pointer(extent * sendcount * local_size);
         MPIU_CHKLMEM_MALLOC(tmp_buf, void*, extent*sendcount*local_size, mpi_errno, "tmp_buf");
diff --git a/src/mpi/coll/allgatherv.c b/src/mpi/coll/allgatherv.c
index fc642df..0577c2c 100644
--- a/src/mpi/coll/allgatherv.c
+++ b/src/mpi/coll/allgatherv.c
@@ -150,8 +150,8 @@ int MPIR_Allgatherv_intra (
             MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
             MPIU_Ensure_Aint_fits_in_pointer(total_count *
-                           (MPIR_MAX(recvtype_true_extent, recvtype_extent)));
-            MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(recvtype_true_extent,recvtype_extent)), mpi_errno, "tmp_buf");
+                           (MPL_MAX(recvtype_true_extent, recvtype_extent)));
+            MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPL_MAX(recvtype_true_extent,recvtype_extent)), mpi_errno, "tmp_buf");
 
             /* adjust for potential negative lower bound in datatype */
             tmp_buf = (void *)((char*)tmp_buf - recvtype_true_lb);
@@ -540,9 +540,9 @@ int MPIR_Allgatherv_intra (
         MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
             
         MPIU_Ensure_Aint_fits_in_pointer(total_count *
-                        MPIR_MAX(recvtype_true_extent, recvtype_extent));
+                        MPL_MAX(recvtype_true_extent, recvtype_extent));
         recvbuf_extent = total_count *
-            (MPIR_MAX(recvtype_true_extent, recvtype_extent));
+            (MPL_MAX(recvtype_true_extent, recvtype_extent));
 
         MPIU_CHKLMEM_MALLOC(tmp_buf, void *, recvbuf_extent, mpi_errno, "tmp_buf");
             
diff --git a/src/mpi/coll/allred_group.c b/src/mpi/coll/allred_group.c
index 7a6d279..b8ffee1 100644
--- a/src/mpi/coll/allred_group.c
+++ b/src/mpi/coll/allred_group.c
@@ -58,8 +58,8 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
     MPID_Datatype_get_extent_macro(datatype, extent);
 
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
 
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/allreduce.c b/src/mpi/coll/allreduce.c
index be26c3d..550066a 100644
--- a/src/mpi/coll/allreduce.c
+++ b/src/mpi/coll/allreduce.c
@@ -315,8 +315,8 @@ int MPIR_Allreduce_intra (
         MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
         MPID_Datatype_get_extent_macro(datatype, extent);
 
-        MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+        MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
 	
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -646,8 +646,8 @@ int MPIR_Allreduce_inter (
         /* I think this is the worse case, so we can avoid an assert()
          * inside the for loop */
         /* Should MPIU_CHKLMEM_MALLOC do this? */
-        MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+        MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
     }
diff --git a/src/mpi/coll/alltoall.c b/src/mpi/coll/alltoall.c
index 19332f4..a9a6614 100644
--- a/src/mpi/coll/alltoall.c
+++ b/src/mpi/coll/alltoall.c
@@ -293,7 +293,7 @@ int MPIR_Alltoall_intra(
         MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
         recvbuf_extent = recvcount * comm_size *
-            (MPIR_MAX(recvtype_true_extent, recvtype_extent));
+            (MPL_MAX(recvtype_true_extent, recvtype_extent));
         MPIU_CHKLMEM_MALLOC(tmp_buf, void *, recvbuf_extent, mpi_errno, "tmp_buf");
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - recvtype_true_lb);
@@ -500,7 +500,7 @@ int MPIR_Alltoall_inter(
     MPIDU_ERR_CHECK_MULTIPLE_THREADS_ENTER( comm_ptr );
 
     /* Do the pairwise exchanges */
-    max_size = MPIR_MAX(local_size, remote_size);
+    max_size = MPL_MAX(local_size, remote_size);
     MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 				     max_size*recvcount*recvtype_extent);
     MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
diff --git a/src/mpi/coll/alltoallv.c b/src/mpi/coll/alltoallv.c
index 7e0135b..047cef7 100644
--- a/src/mpi/coll/alltoallv.c
+++ b/src/mpi/coll/alltoallv.c
@@ -272,7 +272,7 @@ int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *
     MPIDU_ERR_CHECK_MULTIPLE_THREADS_ENTER( comm_ptr );
 
     /* Use pairwise exchange algorithm. */
-    max_size = MPIR_MAX(local_size, remote_size);
+    max_size = MPL_MAX(local_size, remote_size);
     for (i=0; i<max_size; i++) {
         src = (rank - i + max_size) % max_size;
         dst = (rank + i) % max_size;
diff --git a/src/mpi/coll/alltoallw.c b/src/mpi/coll/alltoallw.c
index 4a8f315..b00dd9c 100644
--- a/src/mpi/coll/alltoallw.c
+++ b/src/mpi/coll/alltoallw.c
@@ -267,7 +267,7 @@ int MPIR_Alltoallw_inter(const void *sendbuf, const int sendcounts[], const int
     MPIDU_ERR_CHECK_MULTIPLE_THREADS_ENTER( comm_ptr );
 
     /* Use pairwise exchange algorithm. */
-    max_size = MPIR_MAX(local_size, remote_size);
+    max_size = MPL_MAX(local_size, remote_size);
     for (i=0; i<max_size; i++) {
         src = (rank - i + max_size) % max_size;
         dst = (rank + i) % max_size;
diff --git a/src/mpi/coll/bcast.c b/src/mpi/coll/bcast.c
index 64536a3..01f65a6 100644
--- a/src/mpi/coll/bcast.c
+++ b/src/mpi/coll/bcast.c
@@ -570,7 +570,7 @@ static int MPIR_Bcast_scatter_doubling_allgather(
 
     /* curr_size is the amount of data that this process now has stored in
      * buffer at byte offset (relative_rank*scatter_size) */
-    curr_size = MPIU_MIN(scatter_size, (nbytes - (relative_rank * scatter_size)));
+    curr_size = MPL_MIN(scatter_size, (nbytes - (relative_rank * scatter_size)));
     if (curr_size < 0)
         curr_size = 0;
 
@@ -876,7 +876,7 @@ static int MPIR_Bcast_scatter_ring_allgather(
     /* long-message allgather or medium-size but non-power-of-two. use ring algorithm. */ 
 
     /* Calculate how much data we already have */
-    curr_size = MPIR_MIN(scatter_size,
+    curr_size = MPL_MIN(scatter_size,
                          nbytes - ((rank - root + comm_size) % comm_size) * scatter_size);
     if (curr_size < 0)
         curr_size = 0;
@@ -891,11 +891,11 @@ static int MPIR_Bcast_scatter_ring_allgather(
 
         rel_j     = (j     - root + comm_size) % comm_size;
         rel_jnext = (jnext - root + comm_size) % comm_size;
-        left_count = MPIR_MIN(scatter_size, (nbytes - rel_jnext * scatter_size));
+        left_count = MPL_MIN(scatter_size, (nbytes - rel_jnext * scatter_size));
         if (left_count < 0)
             left_count = 0;
         left_disp = rel_jnext * scatter_size;
-        right_count = MPIR_MIN(scatter_size, (nbytes - rel_j * scatter_size));
+        right_count = MPL_MIN(scatter_size, (nbytes - rel_j * scatter_size));
         if (right_count < 0)
             right_count = 0;
         right_disp = rel_j * scatter_size;
diff --git a/src/mpi/coll/exscan.c b/src/mpi/coll/exscan.c
index a17e54b..038487d 100644
--- a/src/mpi/coll/exscan.c
+++ b/src/mpi/coll/exscan.c
@@ -130,12 +130,12 @@ int MPIR_Exscan (
 
     MPID_Datatype_get_extent_macro( datatype, extent );
 
-    MPIU_CHKLMEM_MALLOC(partial_scan, void *, (count*(MPIR_MAX(true_extent,extent))), mpi_errno, "partial_scan");
+    MPIU_CHKLMEM_MALLOC(partial_scan, void *, (count*(MPL_MAX(true_extent,extent))), mpi_errno, "partial_scan");
     /* 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*/
-    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, (count*(MPIR_MAX(true_extent,extent))), mpi_errno, "tmp_buf");
+    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, (count*(MPL_MAX(true_extent,extent))), mpi_errno, "tmp_buf");
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
 
diff --git a/src/mpi/coll/gather.c b/src/mpi/coll/gather.c
index 5cd00f3..741ce5b 100644
--- a/src/mpi/coll/gather.c
+++ b/src/mpi/coll/gather.c
@@ -578,8 +578,8 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 MPID_Datatype_get_extent_macro(sendtype, extent);
  
 		MPIU_Ensure_Aint_fits_in_pointer(sendcount*local_size*
-						 (MPIR_MAX(extent, true_extent)));
-                MPIU_CHKLMEM_MALLOC(tmp_buf, void *, sendcount*local_size*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+						 (MPL_MAX(extent, true_extent)));
+                MPIU_CHKLMEM_MALLOC(tmp_buf, void *, sendcount*local_size*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
                 /* adjust for potential negative lower bound in datatype */
                 tmp_buf = (void *)((char*)tmp_buf - true_lb);
             }
diff --git a/src/mpi/coll/iallgather.c b/src/mpi/coll/iallgather.c
index b8ccc8e..e596d79 100644
--- a/src/mpi/coll/iallgather.c
+++ b/src/mpi/coll/iallgather.c
@@ -258,7 +258,7 @@ int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendt
     /* allocate a temporary buffer of the same size as recvbuf. */
     /* get true extent of recvtype */
 
-    recvbuf_extent = recvcount * comm_size * (MPIR_MAX(recvtype_true_extent, recvtype_extent));
+    recvbuf_extent = recvcount * comm_size * (MPL_MAX(recvtype_true_extent, recvtype_extent));
 
     MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void*, recvbuf_extent, mpi_errno, "tmp_buf");
 
@@ -511,7 +511,7 @@ int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendt
         MPIR_Type_get_true_extent_impl(sendtype, &true_lb, &true_extent);
 
         MPID_Datatype_get_extent_macro( sendtype, send_extent );
-        extent = MPIR_MAX(send_extent, true_extent);
+        extent = MPL_MAX(send_extent, true_extent);
 
         MPIU_Ensure_Aint_fits_in_pointer(extent * sendcount * local_size);
         MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void*, extent*sendcount*local_size, mpi_errno, "tmp_buf");
diff --git a/src/mpi/coll/iallgatherv.c b/src/mpi/coll/iallgatherv.c
index e737956..cd66a23 100644
--- a/src/mpi/coll/iallgatherv.c
+++ b/src/mpi/coll/iallgatherv.c
@@ -66,8 +66,8 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
     if (total_count == 0)
         goto fn_exit;
 
-    MPIU_Ensure_Aint_fits_in_pointer(total_count*(MPIR_MAX(recvtype_true_extent, recvtype_extent)));
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(recvtype_true_extent,recvtype_extent)), mpi_errno, "tmp_buf");
+    MPIU_Ensure_Aint_fits_in_pointer(total_count*(MPL_MAX(recvtype_true_extent, recvtype_extent)));
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, total_count*(MPL_MAX(recvtype_true_extent,recvtype_extent)), mpi_errno, "tmp_buf");
 
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - recvtype_true_lb);
@@ -302,8 +302,8 @@ int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype send
     /* get true extent of recvtype */
     MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(recvtype_true_extent, recvtype_extent));
-    recvbuf_extent = total_count * (MPIR_MAX(recvtype_true_extent, recvtype_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(recvtype_true_extent, recvtype_extent));
+    recvbuf_extent = total_count * (MPL_MAX(recvtype_true_extent, recvtype_extent));
 
     MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, recvbuf_extent, mpi_errno, "tmp_buf");
 
diff --git a/src/mpi/coll/iallreduce.c b/src/mpi/coll/iallreduce.c
index 1eb80e5..7b31bd0 100644
--- a/src/mpi/coll/iallreduce.c
+++ b/src/mpi/coll/iallreduce.c
@@ -88,8 +88,8 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
     MPID_Datatype_get_extent_macro(datatype, extent);
 
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
 
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -309,8 +309,8 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
     MPID_Datatype_get_extent_macro(datatype, extent);
 
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
 
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/ialltoall.c b/src/mpi/coll/ialltoall.c
index f2b47e8..b9a3dd4 100644
--- a/src/mpi/coll/ialltoall.c
+++ b/src/mpi/coll/ialltoall.c
@@ -209,7 +209,7 @@ int MPIR_Ialltoall_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendty
     /* get true extent of recvtype */
     MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
-    recvbuf_extent = recvcount * comm_size * (MPIR_MAX(recvtype_true_extent, recvtype_extent));
+    recvbuf_extent = recvcount * comm_size * (MPL_MAX(recvtype_true_extent, recvtype_extent));
     /* not a leak, old tmp_buf value is still tracked by CHKPMEM macros */
     MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, recvbuf_extent, mpi_errno, "tmp_buf");
     /* adjust for potential negative lower bound in datatype */
@@ -479,7 +479,7 @@ int MPIR_Ialltoall_inter(const void *sendbuf, int sendcount, MPI_Datatype sendty
     MPID_Datatype_get_extent_macro(recvtype, recvtype_extent);
 
     /* Do the pairwise exchanges */
-    max_size = MPIR_MAX(local_size, remote_size);
+    max_size = MPL_MAX(local_size, remote_size);
     MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      max_size*recvcount*recvtype_extent);
     MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
diff --git a/src/mpi/coll/ialltoallv.c b/src/mpi/coll/ialltoallv.c
index 977c725..887903f 100644
--- a/src/mpi/coll/ialltoallv.c
+++ b/src/mpi/coll/ialltoallv.c
@@ -74,7 +74,7 @@ int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int
          * algorithm. */
         max_count = 0;
         for (i = 0; i < comm_size; ++i) {
-            max_count = MPIU_MAX(max_count, recvcounts[i]);
+            max_count = MPL_MAX(max_count, recvcounts[i]);
         }
 
         MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, max_count*recv_extent, mpi_errno, "Ialltoallv tmp_buf");
@@ -195,7 +195,7 @@ int MPIR_Ialltoallv_inter(const void *sendbuf, const int sendcounts[], const int
     MPID_Datatype_get_size_macro(recvtype, recvtype_size);
 
     /* Use pairwise exchange algorithm. */
-    max_size = MPIR_MAX(local_size, remote_size);
+    max_size = MPL_MAX(local_size, remote_size);
     for (i=0; i<max_size; i++) {
         src = (rank - i + max_size) % max_size;
         dst = (rank + i) % max_size;
diff --git a/src/mpi/coll/ialltoallw.c b/src/mpi/coll/ialltoallw.c
index 0060ad2..0527332 100644
--- a/src/mpi/coll/ialltoallw.c
+++ b/src/mpi/coll/ialltoallw.c
@@ -93,7 +93,7 @@ int MPIR_Ialltoallw_intra(const void *sendbuf, const int sendcounts[], const int
              * ignored when sendbuf==MPI_IN_PLACE */
             MPIR_Type_get_true_extent_impl(recvtypes[i], &true_lb, &true_extent);
             MPID_Datatype_get_extent_macro(recvtypes[i], recv_extent);
-            max_size = MPIU_MAX(max_size, recvcounts[i] * MPIU_MAX(recv_extent, true_extent));
+            max_size = MPL_MAX(max_size, recvcounts[i] * MPL_MAX(recv_extent, true_extent));
         }
         MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, max_size, mpi_errno, "Ialltoallw tmp_buf");
 
@@ -205,7 +205,7 @@ int MPIR_Ialltoallw_inter(const void *sendbuf, const int sendcounts[], const int
     rank = comm_ptr->rank;
 
     /* Use pairwise exchange algorithm. */
-    max_size = MPIR_MAX(local_size, remote_size);
+    max_size = MPL_MAX(local_size, remote_size);
     for (i=0; i<max_size; i++) {
         src = (rank - i + max_size) % max_size;
         dst = (rank + i) % max_size;
diff --git a/src/mpi/coll/ibcast.c b/src/mpi/coll/ibcast.c
index a4223e3..f00ec9b 100644
--- a/src/mpi/coll/ibcast.c
+++ b/src/mpi/coll/ibcast.c
@@ -457,7 +457,7 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
 
     /* curr_size is the amount of data that this process now has stored in
      * buffer at byte offset (relative_rank*scatter_size) */
-    curr_size = MPIU_MIN(scatter_size, (nbytes - (relative_rank * scatter_size)));
+    curr_size = MPL_MIN(scatter_size, (nbytes - (relative_rank * scatter_size)));
     if (curr_size < 0)
         curr_size = 0;
 
@@ -490,7 +490,7 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
             /* calculate the exact amount of data to be received */
             /* alternative */
             if ((nbytes - recv_offset) > 0)
-                incoming_count = MPIU_MIN((nbytes-recv_offset), (mask * scatter_size));
+                incoming_count = MPL_MIN((nbytes-recv_offset), (mask * scatter_size));
             else
                 incoming_count = 0;
 
@@ -574,7 +574,7 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
                     /* recalculate incoming_count, since not all processes will have
                      * this value */
                     if ((nbytes - offset) > 0)
-                        incoming_count = MPIU_MIN((nbytes-offset), (mask * scatter_size));
+                        incoming_count = MPL_MIN((nbytes-offset), (mask * scatter_size));
                     else
                         incoming_count = 0;
 
@@ -715,11 +715,11 @@ int MPIR_Ibcast_scatter_ring_allgather(void *buffer, int count, MPI_Datatype dat
 
         rel_j     = (j     - root + comm_size) % comm_size;
         rel_jnext = (jnext - root + comm_size) % comm_size;
-        left_count = MPIR_MIN(scatter_size, (nbytes - rel_jnext * scatter_size));
+        left_count = MPL_MIN(scatter_size, (nbytes - rel_jnext * scatter_size));
         if (left_count < 0)
             left_count = 0;
         left_disp = rel_jnext * scatter_size;
-        right_count = MPIR_MIN(scatter_size, (nbytes - rel_j * scatter_size));
+        right_count = MPL_MIN(scatter_size, (nbytes - rel_j * scatter_size));
         if (right_count < 0)
             right_count = 0;
         right_disp = rel_j * scatter_size;
diff --git a/src/mpi/coll/iexscan.c b/src/mpi/coll/iexscan.c
index d828e48..9a5cefe 100644
--- a/src/mpi/coll/iexscan.c
+++ b/src/mpi/coll/iexscan.c
@@ -97,12 +97,12 @@ int MPIR_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
     MPID_Datatype_get_extent_macro(datatype, extent);
 
-    MPIR_SCHED_CHKPMEM_MALLOC(partial_scan, void *, (count*(MPIR_MAX(true_extent,extent))), mpi_errno, "partial_scan");
+    MPIR_SCHED_CHKPMEM_MALLOC(partial_scan, void *, (count*(MPL_MAX(true_extent,extent))), mpi_errno, "partial_scan");
     /* 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_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, (count*(MPIR_MAX(true_extent,extent))), mpi_errno, "tmp_buf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, (count*(MPL_MAX(true_extent,extent))), mpi_errno, "tmp_buf");
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
 
diff --git a/src/mpi/coll/igather.c b/src/mpi/coll/igather.c
index 8cb2283..2eb441e 100644
--- a/src/mpi/coll/igather.c
+++ b/src/mpi/coll/igather.c
@@ -463,8 +463,8 @@ int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
                 MPIR_Type_get_true_extent_impl(sendtype, &true_lb, &true_extent);
                 MPID_Datatype_get_extent_macro(sendtype, extent);
 
-                MPIU_Ensure_Aint_fits_in_pointer(sendcount*local_size*(MPIR_MAX(extent, true_extent)));
-                MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, sendcount*local_size*(MPIR_MAX(extent,true_extent)),
+                MPIU_Ensure_Aint_fits_in_pointer(sendcount*local_size*(MPL_MAX(extent, true_extent)));
+                MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, sendcount*local_size*(MPL_MAX(extent,true_extent)),
                                           mpi_errno, "tmp_buf");
                 /* adjust for potential negative lower bound in datatype */
                 tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/ired_scat.c b/src/mpi/coll/ired_scat.c
index 0245e05..fa1227b 100644
--- a/src/mpi/coll/ired_scat.c
+++ b/src/mpi/coll/ired_scat.c
@@ -74,13 +74,13 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
     MPID_Datatype_get_size_macro(datatype, type_size);
 
     /* allocate temp. buffer to receive incoming data */
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
     /* 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_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
     /* adjust for potential negative lower bound in datatype */
     tmp_results = (void *)((char*)tmp_results - true_lb);
 
@@ -298,7 +298,7 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
     }
     /* total_count*extent eventually gets malloced. it isn't added to
      * a user-passed in buffer */
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(true_extent, extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
 
     if (sendbuf != MPI_IN_PLACE) {
         /* copy local data into recvbuf */
@@ -310,7 +310,7 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
     }
 
     /* allocate temporary buffer to store incoming data */
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, recvcounts[rank]*(MPIR_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, recvcounts[rank]*(MPL_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
     /* adjust for potential negative lower bound in datatype */
     tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
 
@@ -440,17 +440,17 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
 
     /* total_count*extent eventually gets malloced. it isn't added to
      * a user-passed in buffer */
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(true_extent, extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
 
 
     /* need to allocate temporary buffer to receive incoming data*/
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
     /* 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_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
     /* adjust for potential negative lower bound in datatype */
     tmp_results = (void *)((char*)tmp_results - true_lb);
 
@@ -938,7 +938,7 @@ int MPIR_Ireduce_scatter_inter(const void *sendbuf, void *recvbuf, const int rec
         MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
         MPID_Datatype_get_extent_macro(datatype, extent);
 
-        MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+        MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, total_count*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
 
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/ired_scat_block.c b/src/mpi/coll/ired_scat_block.c
index 22233c9..6960ed0 100644
--- a/src/mpi/coll/ired_scat_block.c
+++ b/src/mpi/coll/ired_scat_block.c
@@ -73,13 +73,13 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
     MPID_Datatype_get_size_macro(datatype, type_size);
 
     /* allocate temp. buffer to receive incoming data */
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
     /* 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_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
     /* adjust for potential negative lower bound in datatype */
     tmp_results = (void *)((char*)tmp_results - true_lb);
 
@@ -290,7 +290,7 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
     }
     /* total_count*extent eventually gets malloced. it isn't added to
      * a user-passed in buffer */
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(true_extent, extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
 
     if (sendbuf != MPI_IN_PLACE) {
         /* copy local data into recvbuf */
@@ -302,7 +302,7 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
     }
 
     /* allocate temporary buffer to store incoming data */
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, recvcount*(MPIR_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, recvcount*(MPL_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
     /* adjust for potential negative lower bound in datatype */
     tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
 
@@ -430,17 +430,17 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
 
     /* total_count*extent eventually gets malloced. it isn't added to
      * a user-passed in buffer */
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(true_extent, extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
 
 
     /* need to allocate temporary buffer to receive incoming data*/
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
     /* 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_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
     /* adjust for potential negative lower bound in datatype */
     tmp_results = (void *)((char*)tmp_results - true_lb);
 
@@ -482,7 +482,7 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
             blklens[1] = 0;
 
         dis[0] = 0;
-        dis[1] = blklens[0] + recvcount * (MPIR_MIN((my_tree_root + mask), comm_size) - my_tree_root);
+        dis[1] = blklens[0] + recvcount * (MPL_MIN((my_tree_root + mask), comm_size) - my_tree_root);
 
         mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &sendtype);
         if (mpi_errno) MPIR_ERR_POP(mpi_errno);
@@ -491,14 +491,14 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
         if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* calculate recvtype */
-        blklens[0] = recvcount * MPIR_MIN(dst_tree_root, comm_size);
+        blklens[0] = recvcount * MPL_MIN(dst_tree_root, comm_size);
         blklens[1] = recvcount * (comm_size - (dst_tree_root + mask));
         if (blklens[1] < 0)
             blklens[1] = 0;
 
         dis[0] = 0;
         dis[1] = blklens[0];
-        dis[1] = blklens[0] + recvcount * (MPIR_MIN((dst_tree_root + mask), comm_size) - dst_tree_root);
+        dis[1] = blklens[0] + recvcount * (MPL_MIN((dst_tree_root + mask), comm_size) - dst_tree_root);
 
         mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &recvtype);
         if (mpi_errno) MPIR_ERR_POP(mpi_errno);
@@ -843,7 +843,7 @@ int MPIR_Ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int rec
         MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
         MPID_Datatype_get_extent_macro(datatype, extent);
 
-        MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+        MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, total_count*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
 
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/ireduce.c b/src/mpi/coll/ireduce.c
index 262312e..1b80e8a 100644
--- a/src/mpi/coll/ireduce.c
+++ b/src/mpi/coll/ireduce.c
@@ -64,9 +64,9 @@ int MPIR_Ireduce_binomial(const void *sendbuf, void *recvbuf, int count, MPI_Dat
     /* I think this is the worse case, so we can avoid an assert()
      * inside the for loop */
     /* should be buf+{this}? */
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)),
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)),
                         mpi_errno, "temporary buffer");
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -75,7 +75,7 @@ int MPIR_Ireduce_binomial(const void *sendbuf, void *recvbuf, int count, MPI_Dat
        I have to allocate a temporary one */
     if (rank != root) {
         MPIR_SCHED_CHKPMEM_MALLOC(recvbuf, void *,
-                            count*(MPIR_MAX(extent,true_extent)),
+                            count*(MPL_MAX(extent,true_extent)),
                             mpi_errno, "receive buffer");
         recvbuf = (void *)((char*)recvbuf - true_lb);
     }
@@ -253,9 +253,9 @@ int MPIR_Ireduce_redscat_gather(const void *sendbuf, void *recvbuf, int count, M
     /* I think this is the worse case, so we can avoid an assert()
      * inside the for loop */
     /* should be buf+{this}? */
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)),
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)),
                               mpi_errno, "temporary buffer");
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -270,7 +270,7 @@ int MPIR_Ireduce_redscat_gather(const void *sendbuf, void *recvbuf, int count, M
     /* 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_SCHED_CHKPMEM_MALLOC(recvbuf, void *, count*(MPIR_MAX(extent,true_extent)),
+        MPIR_SCHED_CHKPMEM_MALLOC(recvbuf, void *, count*(MPL_MAX(extent,true_extent)),
                                   mpi_errno, "receive buffer");
         recvbuf = (void *)((char*)recvbuf - true_lb);
     }
@@ -605,9 +605,9 @@ int MPIR_Ireduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datatype
         MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
         MPID_Datatype_get_extent_macro(datatype, extent);
 
-        MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+        MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-        MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)),
+        MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)),
                                   mpi_errno, "temporary buffer");
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -725,8 +725,8 @@ int MPIR_Ireduce_inter(const void *sendbuf, void *recvbuf, int count, MPI_Dataty
             /* I think this is the worse case, so we can avoid an assert()
              * inside the for loop */
             /* Should MPIR_SCHED_CHKPMEM_MALLOC do this? */
-            MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-            MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+            MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+            MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
             /* adjust for potential negative lower bound in datatype */
             tmp_buf = (void *)((char*)tmp_buf - true_lb);
         }
diff --git a/src/mpi/coll/iscan.c b/src/mpi/coll/iscan.c
index fb98f52..9b0fbca 100644
--- a/src/mpi/coll/iscan.c
+++ b/src/mpi/coll/iscan.c
@@ -91,17 +91,17 @@ int MPIR_Iscan_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_Dataty
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
 
     MPID_Datatype_get_extent_macro(datatype, extent);
-    MPIR_SCHED_CHKPMEM_MALLOC(partial_scan, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "partial_scan");
+    MPIR_SCHED_CHKPMEM_MALLOC(partial_scan, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "partial_scan");
 
     /* This eventually gets malloc()ed as a temp buffer, not added to
      * any user buffers */
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(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_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+    MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
 
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -208,20 +208,20 @@ int MPIR_Iscan_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datatype d
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
     MPID_Datatype_get_extent_macro(datatype, extent);
 
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-    MPIR_SCHED_CHKPMEM_MALLOC(tempbuf, void *, count*(MPIR_MAX(extent, true_extent)),
+    MPIR_SCHED_CHKPMEM_MALLOC(tempbuf, void *, count*(MPL_MAX(extent, true_extent)),
                         mpi_errno, "temporary buffer");
     tempbuf = (void *)((char*)tempbuf - true_lb);
 
     /* Create prefulldata and localfulldata on local roots of all nodes */
     if (comm_ptr->node_roots_comm != NULL) {
-        MPIR_SCHED_CHKPMEM_MALLOC(prefulldata, void *, count*(MPIR_MAX(extent, true_extent)),
+        MPIR_SCHED_CHKPMEM_MALLOC(prefulldata, void *, count*(MPL_MAX(extent, true_extent)),
                             mpi_errno, "prefulldata for scan");
         prefulldata = (void *)((char*)prefulldata - true_lb);
 
         if (node_comm != NULL) {
-            MPIR_SCHED_CHKPMEM_MALLOC(localfulldata, void *, count*(MPIR_MAX(extent, true_extent)),
+            MPIR_SCHED_CHKPMEM_MALLOC(localfulldata, void *, count*(MPL_MAX(extent, true_extent)),
                                 mpi_errno, "localfulldata for scan");
             localfulldata = (void *)((char*)localfulldata - true_lb);
         }
diff --git a/src/mpi/coll/iscatter.c b/src/mpi/coll/iscatter.c
index 5bec8c1..390f788 100644
--- a/src/mpi/coll/iscatter.c
+++ b/src/mpi/coll/iscatter.c
@@ -489,7 +489,7 @@ int MPIR_Iscatter_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtyp
                 MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                                  sendcount*remote_size*extent);
 
-                MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, recvcount*local_size*(MPIR_MAX(extent,true_extent)),
+                MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, recvcount*local_size*(MPL_MAX(extent,true_extent)),
                                           mpi_errno, "tmp_buf");
 
                 /* adjust for potential negative lower bound in datatype */
diff --git a/src/mpi/coll/opmax.c b/src/mpi/coll/opmax.c
index ec72607..e809f8b 100644
--- a/src/mpi/coll/opmax.c
+++ b/src/mpi/coll/opmax.c
@@ -27,7 +27,7 @@ void MPIR_MAXF(
 
     switch (*type) {
 #undef MPIR_OP_TYPE_MACRO
-#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPIR_MAX)
+#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPL_MAX)
         /* no semicolons by necessity */
         MPIR_OP_TYPE_GROUP(C_INTEGER)
         MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
diff --git a/src/mpi/coll/opmaxloc.c b/src/mpi/coll/opmaxloc.c
index 52b1f70..3c9f781 100644
--- a/src/mpi/coll/opmaxloc.c
+++ b/src/mpi/coll/opmaxloc.c
@@ -53,7 +53,7 @@ typedef struct MPIR_longdoubleint_loctype {
                 a[i].value = b[i].value;                \
                 a[i].loc   = b[i].loc;                  \
             } else if (a[i].value <= b[i].value)        \
-                a[i].loc = MPIR_MIN(a[i].loc,b[i].loc); \
+                a[i].loc = MPL_MIN(a[i].loc,b[i].loc); \
         }                                               \
     }                                                   \
     break
@@ -66,7 +66,7 @@ typedef struct MPIR_longdoubleint_loctype {
                 a[i]   = b[i];                          \
                 a[i+1] = b[i+1];                        \
             } else if (a[i] <= b[i])                    \
-                a[i+1] = MPIR_MIN(a[i+1],b[i+1]);       \
+                a[i+1] = MPL_MIN(a[i+1],b[i+1]);       \
         }                                               \
     }                                                   \
     break
diff --git a/src/mpi/coll/opmin.c b/src/mpi/coll/opmin.c
index 7634f07..8db5101 100644
--- a/src/mpi/coll/opmin.c
+++ b/src/mpi/coll/opmin.c
@@ -26,7 +26,7 @@ void MPIR_MINF (
 
     switch (*type) {
 #undef MPIR_OP_TYPE_MACRO
-#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPIR_MIN)
+#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_, type_name_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPL_MIN)
         /* no semicolons by necessity */
         MPIR_OP_TYPE_GROUP(C_INTEGER)
         MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
diff --git a/src/mpi/coll/opminloc.c b/src/mpi/coll/opminloc.c
index 1c934e9..6ee7660 100644
--- a/src/mpi/coll/opminloc.c
+++ b/src/mpi/coll/opminloc.c
@@ -53,7 +53,7 @@ typedef struct MPIR_longdoubleint_loctype {
                 a[i].value = b[i].value;                \
                 a[i].loc   = b[i].loc;                  \
             } else if (a[i].value >= b[i].value)        \
-                a[i].loc = MPIR_MIN(a[i].loc,b[i].loc); \
+                a[i].loc = MPL_MIN(a[i].loc,b[i].loc); \
         }                                               \
     }                                                   \
     break
@@ -66,7 +66,7 @@ typedef struct MPIR_longdoubleint_loctype {
                 a[i]   = b[i];                          \
                 a[i+1] = b[i+1];                        \
             } else if (a[i] >= b[i])                    \
-                a[i+1] = MPIR_MIN(a[i+1],b[i+1]);       \
+                a[i+1] = MPL_MIN(a[i+1],b[i+1]);       \
         }                                               \
     }                                                   \
     break
diff --git a/src/mpi/coll/red_scat.c b/src/mpi/coll/red_scat.c
index bf5d6c1..ec32a50 100644
--- a/src/mpi/coll/red_scat.c
+++ b/src/mpi/coll/red_scat.c
@@ -300,19 +300,19 @@ int MPIR_Reduce_scatter_intra(const void *sendbuf, void *recvbuf, const int recv
 
     /* total_count*extent eventually gets malloced. it isn't added to
      * a user-passed in buffer */
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(true_extent, extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
 
     if ((is_commutative) && (nbytes < MPIR_CVAR_REDSCAT_COMMUTATIVE_LONG_MSG_SIZE)) {
         /* commutative and short. use recursive halving algorithm */
 
         /* allocate temp. buffer to receive incoming data */
-        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
         /* 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 */
-        MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+        MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
         /* adjust for potential negative lower bound in datatype */
         tmp_results = (void *)((char*)tmp_results - true_lb);
         
@@ -539,7 +539,7 @@ int MPIR_Reduce_scatter_intra(const void *sendbuf, void *recvbuf, const int recv
         }
         
         /* allocate temporary buffer to store incoming data */
-        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, recvcounts[rank]*(MPIR_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
+        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, recvcounts[rank]*(MPL_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
         /* adjust for potential negative lower bound in datatype */
         tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
         
@@ -652,13 +652,13 @@ int MPIR_Reduce_scatter_intra(const void *sendbuf, void *recvbuf, const int recv
             /* noncommutative and (non-pof2 or block irregular), use recursive doubling. */
 
             /* need to allocate temporary buffer to receive incoming data*/
-            MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+            MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
             /* 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 */
-            MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+            MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
             /* adjust for potential negative lower bound in datatype */
             tmp_results = (void *)((char*)tmp_results - true_lb);
 
@@ -931,7 +931,7 @@ int MPIR_Reduce_scatter_inter(const void *sendbuf, void *recvbuf, const int recv
         MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
         MPID_Datatype_get_extent_macro(datatype, extent);
 
-        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
 
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/red_scat_block.c b/src/mpi/coll/red_scat_block.c
index a937c38..2321bde 100644
--- a/src/mpi/coll/red_scat_block.c
+++ b/src/mpi/coll/red_scat_block.c
@@ -299,19 +299,19 @@ int MPIR_Reduce_scatter_block_intra (
 
     /* total_count*extent eventually gets malloced. it isn't added to
      * a user-passed in buffer */
-    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPIR_MAX(true_extent, extent));
+    MPIU_Ensure_Aint_fits_in_pointer(total_count * MPL_MAX(true_extent, extent));
 
     if ((is_commutative) && (nbytes < MPIR_CVAR_REDSCAT_COMMUTATIVE_LONG_MSG_SIZE)) {
         /* commutative and short. use recursive halving algorithm */
 
         /* allocate temp. buffer to receive incoming data */
-        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
         /* 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 */
-        MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+        MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
         /* adjust for potential negative lower bound in datatype */
         tmp_results = (void *)((char*)tmp_results - true_lb);
         
@@ -525,7 +525,7 @@ int MPIR_Reduce_scatter_block_intra (
         }
         
         /* allocate temporary buffer to store incoming data */
-        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, recvcount*(MPIR_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
+        MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, recvcount*(MPL_MAX(true_extent,extent))+1, mpi_errno, "tmp_recvbuf");
         /* adjust for potential negative lower bound in datatype */
         tmp_recvbuf = (void *)((char*)tmp_recvbuf - true_lb);
         
@@ -627,13 +627,13 @@ int MPIR_Reduce_scatter_block_intra (
             /* noncommutative and non-pof2, use recursive doubling. */
 
             /* need to allocate temporary buffer to receive incoming data*/
-            MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
+            MPIU_CHKLMEM_MALLOC(tmp_recvbuf, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_recvbuf");
             /* 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 */
-            MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPIR_MAX(true_extent,extent)), mpi_errno, "tmp_results");
+            MPIU_CHKLMEM_MALLOC(tmp_results, void *, total_count*(MPL_MAX(true_extent,extent)), mpi_errno, "tmp_results");
             /* adjust for potential negative lower bound in datatype */
             tmp_results = (void *)((char*)tmp_results - true_lb);
 
@@ -898,7 +898,7 @@ int MPIR_Reduce_scatter_block_inter (
         MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
         MPID_Datatype_get_extent_macro(datatype, extent);
 
-        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+        MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
 
         /* adjust for potential negative lower bound in datatype */
         tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/coll/reduce.c b/src/mpi/coll/reduce.c
index aaeffa3..ef03577 100644
--- a/src/mpi/coll/reduce.c
+++ b/src/mpi/coll/reduce.c
@@ -110,9 +110,9 @@ static int MPIR_Reduce_binomial (
     /* I think this is the worse case, so we can avoid an assert() 
      * inside the for loop */
     /* should be buf+{this}? */
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)),
+    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)),
                         mpi_errno, "temporary buffer");
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -121,7 +121,7 @@ static int MPIR_Reduce_binomial (
        I have to allocate a temporary one */
     if (rank != root) {
         MPIU_CHKLMEM_MALLOC(recvbuf, void *, 
-                            count*(MPIR_MAX(extent,true_extent)), 
+                            count*(MPL_MAX(extent,true_extent)), 
                             mpi_errno, "receive buffer");
         recvbuf = (void *)((char*)recvbuf - true_lb);
     }
@@ -319,9 +319,9 @@ static int MPIR_Reduce_redscat_gather (
     /* I think this is the worse case, so we can avoid an assert() 
      * inside the for loop */
     /* should be buf+{this}? */
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)),
+    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)),
                         mpi_errno, "temporary buffer");
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -330,7 +330,7 @@ static int MPIR_Reduce_redscat_gather (
        I have to allocate a temporary one */
     if (rank != root) {
         MPIU_CHKLMEM_MALLOC(recvbuf, void *, 
-                            count*(MPIR_MAX(extent,true_extent)), 
+                            count*(MPL_MAX(extent,true_extent)), 
                             mpi_errno, "receive buffer");
         recvbuf = (void *)((char*)recvbuf - true_lb);
     }
@@ -756,9 +756,9 @@ int MPIR_Reduce_intra (
             MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
             MPID_Datatype_get_extent_macro(datatype, extent);
 
-            MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+            MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-            MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)),
+            MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)),
                                 mpi_errno, "temporary buffer");
             /* adjust for potential negative lower bound in datatype */
             tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -961,8 +961,8 @@ int MPIR_Reduce_inter (
 	    /* I think this is the worse case, so we can avoid an assert() 
 	     * inside the for loop */
 	    /* Should MPIU_CHKLMEM_MALLOC do this? */
-	    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
-	    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
+	    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
+	    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "temporary buffer");
             /* adjust for potential negative lower bound in datatype */
             tmp_buf = (void *)((char*)tmp_buf - true_lb);
         }
diff --git a/src/mpi/coll/scan.c b/src/mpi/coll/scan.c
index cd5366b..a5c1375 100644
--- a/src/mpi/coll/scan.c
+++ b/src/mpi/coll/scan.c
@@ -116,17 +116,17 @@ static int MPIR_Scan_generic (
     MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
 
     MPID_Datatype_get_extent_macro(datatype, extent);
-    MPIU_CHKLMEM_MALLOC(partial_scan, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "partial_scan");
+    MPIU_CHKLMEM_MALLOC(partial_scan, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "partial_scan");
 
     /* This eventually gets malloc()ed as a temp buffer, not added to
      * any user buffers */
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(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*/
-    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+    MPIU_CHKLMEM_MALLOC(tmp_buf, void *, count*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
     
     /* adjust for potential negative lower bound in datatype */
     tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -256,20 +256,20 @@ int MPIR_Scan(
 
     MPID_Datatype_get_extent_macro(datatype, extent);
 
-    MPIU_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
+    MPIU_Ensure_Aint_fits_in_pointer(count * MPL_MAX(extent, true_extent));
 
-    MPIU_CHKLMEM_MALLOC(tempbuf, void *, count*(MPIR_MAX(extent, true_extent)),
+    MPIU_CHKLMEM_MALLOC(tempbuf, void *, count*(MPL_MAX(extent, true_extent)),
                         mpi_errno, "temporary buffer");
     tempbuf = (void *)((char*)tempbuf - true_lb);
 
     /* Create prefulldata and localfulldata on local roots of all nodes */
     if (comm_ptr->node_roots_comm != NULL) {
-        MPIU_CHKLMEM_MALLOC(prefulldata, void *, count*(MPIR_MAX(extent, true_extent)),
+        MPIU_CHKLMEM_MALLOC(prefulldata, void *, count*(MPL_MAX(extent, true_extent)),
                             mpi_errno, "prefulldata for scan");
         prefulldata = (void *)((char*)prefulldata - true_lb);
 
         if (comm_ptr->node_comm != NULL) {
-            MPIU_CHKLMEM_MALLOC(localfulldata, void *, count*(MPIR_MAX(extent, true_extent)),
+            MPIU_CHKLMEM_MALLOC(localfulldata, void *, count*(MPL_MAX(extent, true_extent)),
                                 mpi_errno, "localfulldata for scan");
             localfulldata = (void *)((char*)localfulldata - true_lb);
         }
diff --git a/src/mpi/coll/scatter.c b/src/mpi/coll/scatter.c
index 56022f4..f8068c6 100644
--- a/src/mpi/coll/scatter.c
+++ b/src/mpi/coll/scatter.c
@@ -488,7 +488,7 @@ int MPIR_Scatter_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
 		MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
 						 sendcount*remote_size*extent);
 
-                MPIU_CHKLMEM_MALLOC(tmp_buf, void *, recvcount*local_size*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
+                MPIU_CHKLMEM_MALLOC(tmp_buf, void *, recvcount*local_size*(MPL_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
                 
                 /* adjust for potential negative lower bound in datatype */
                 tmp_buf = (void *)((char*)tmp_buf - true_lb);
diff --git a/src/mpi/datatype/get_elements_x.c b/src/mpi/datatype/get_elements_x.c
index 128a2e5..7a1a2c6 100644
--- a/src/mpi/datatype/get_elements_x.c
+++ b/src/mpi/datatype/get_elements_x.c
@@ -76,7 +76,7 @@ PMPI_LOCAL MPI_Count MPIR_Type_get_basic_type_elements(MPI_Count *bytes_p,
         usable_bytes = *bytes_p;
     }
     else {
-        usable_bytes = MPIR_MIN(*bytes_p,
+        usable_bytes = MPL_MIN(*bytes_p,
                            count * MPID_Datatype_get_basic_size(datatype));
     }
 
diff --git a/src/mpi/datatype/type_create_darray.c b/src/mpi/datatype/type_create_darray.c
index e8c73db..a944662 100644
--- a/src/mpi/datatype/type_create_darray.c
+++ b/src/mpi/datatype/type_create_darray.c
@@ -106,7 +106,7 @@ PMPI_LOCAL int MPIR_Type_block(const int *array_of_gsizes,
     }
 
     j = global_size - blksize*rank;
-    mysize = MPIR_MIN(blksize, j);
+    mysize = MPL_MIN(blksize, j);
     if (mysize < 0) mysize = 0;
 
     stride = orig_extent;
@@ -223,7 +223,7 @@ PMPI_LOCAL int MPIR_Type_cyclic(const int *array_of_gsizes,
     else {
 	local_size = ((end_index - st_index + 1)/(nprocs*blksize))*blksize;
 	rem = (end_index - st_index + 1) % (nprocs*blksize);
-	local_size += MPIR_MIN(rem, blksize);
+	local_size += MPL_MIN(rem, blksize);
     }
 
     count = local_size/blksize;
diff --git a/src/mpi/errhan/errutil.c b/src/mpi/errhan/errutil.c
index 83f107c..99f514d 100644
--- a/src/mpi/errhan/errutil.c
+++ b/src/mpi/errhan/errutil.c
@@ -1138,7 +1138,7 @@ static void MPIR_Err_print_stack_string(int errcode, char *str, int maxlen )
 	    
 	    if (ErrorRing[ring_idx].id == ring_id) {
 		len = (int)strlen(ErrorRing[ring_idx].location);
-		max_location_len = MPIR_MAX(max_location_len, len);
+		max_location_len = MPL_MAX(max_location_len, len);
 		tmp_errcode = ErrorRing[ring_idx].prev_error;
 	    }
 	    else
diff --git a/src/mpi/pt2pt/bsendutil.c b/src/mpi/pt2pt/bsendutil.c
index aa48a8f..734e2be 100644
--- a/src/mpi/pt2pt/bsendutil.c
+++ b/src/mpi/pt2pt/bsendutil.c
@@ -134,7 +134,7 @@ int MPIR_Bsend_attach( void *buffer, int buffer_size )
        code assumes pointer-alignment, and some code assumes double alignment.
        Further, GCC 4.5.1 generates bad code on 32-bit platforms when this is
        only 4-byte aligned (see #1149). */
-    align_sz = MPIR_MAX(sizeof(void *), sizeof(double));
+    align_sz = MPL_MAX(sizeof(void *), sizeof(double));
     offset = ((size_t)buffer) % align_sz;
     if (offset) {
         offset = align_sz - offset;
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
index 3eb3d84..77f148c 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
@@ -223,8 +223,8 @@ void ADIOI_GPFS_Calc_file_domains(ADIO_File fd,
     min_st_offset  = st_offsets [0];
     max_end_offset = end_offsets[0];
     for (i=1; i<nprocs; i++) {
-        min_st_offset = ADIOI_MIN(min_st_offset, st_offsets[i]);
-        max_end_offset = ADIOI_MAX(max_end_offset, end_offsets[i]);
+        min_st_offset = MPL_MIN(min_st_offset, st_offsets[i]);
+        max_end_offset = MPL_MAX(max_end_offset, end_offsets[i]);
     }
 
     /* DBG_FPRINTF(stderr, "_calc_file_domains, min_st_offset, max_
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
index 36f1f5c..81587b9 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
@@ -553,8 +553,8 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
     /* now find the real values */
     for (i=0; i < nprocs; i++)
 	for (j=0; j<others_req[i].count; j++) {
-	    st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-	    end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j]
+	    st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+	    end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j]
 					  + others_req[i].lens[j] - 1));
 	}
 
@@ -660,7 +660,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
 #ifdef PROFILE
         MPE_Log_event(13, 0, "start computation");
 #endif
-	size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
+	size = MPL_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
 	real_off = off - for_curr_iter;
 	real_size = size + for_curr_iter;
 
@@ -697,7 +697,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
 			MPI_Address(read_buf+req_off-real_off, 
                                &(others_req[i].mem_ptrs[j]));
       ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off));
-			send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off, 
+			send_size[i] += (int)(MPL_MIN(real_off + real_size - req_off, 
                                       (ADIO_Offset)(unsigned)req_len)); 
 
 			if (real_off+real_size-req_off < (ADIO_Offset)(unsigned)req_len) {
@@ -707,7 +707,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
                                      real_off+real_size)) { 
 				/* this is the case illustrated in the
 				   figure above. */
-				for_next_iter = ADIOI_MAX(for_next_iter,
+				for_next_iter = MPL_MAX(for_next_iter,
 					  real_off + real_size - others_req[i].offsets[j+1]); 
 				/* max because it must cover requests 
 				   from different processes */
@@ -970,7 +970,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 #define ADIOI_BUF_INCR \
 { \
     while (buf_incr) { \
-	size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \
+	size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \
 	user_buf_idx += size_in_buf; \
 	flat_buf_sz -= size_in_buf; \
 	if (!flat_buf_sz) { \
@@ -991,7 +991,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 #define ADIOI_BUF_COPY \
 { \
     while (size) { \
-	size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
+	size_in_buf = MPL_MIN(size, flat_buf_sz); \
   ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)(buf + user_buf_idx)); \
   ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \
 	memcpy(((char *) buf) + user_buf_idx, \
@@ -1086,7 +1086,7 @@ static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 	    if (recv_buf_idx[p] < recv_size[p]) {
 		if (curr_from_proc[p]+len > done_from_proc[p]) {
 		    if (done_from_proc[p] > curr_from_proc[p]) {
-			size = ADIOI_MIN(curr_from_proc[p] + len - 
+			size = MPL_MIN(curr_from_proc[p] + len - 
 			      done_from_proc[p], recv_size[p]-recv_buf_idx[p]);
 			buf_incr = done_from_proc[p] - curr_from_proc[p];
 			ADIOI_BUF_INCR
@@ -1096,7 +1096,7 @@ static void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 			ADIOI_BUF_COPY
 		    }
 		    else {
-			size = ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]);
+			size = MPL_MIN(len,recv_size[p]-recv_buf_idx[p]);
 			buf_incr = len;
       ADIOI_Assert((curr_from_proc[p] + size) == (unsigned)((ADIO_Offset)curr_from_proc[p] + size));
 			curr_from_proc[p] += (unsigned) size;
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
index acb6d1e..eae6ad5 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
@@ -593,8 +593,8 @@ static int gpfs_find_access_for_ion(ADIO_File fd,
 
     for (i=0; i<fd->hints->cb_nodes; i++ ){
 	if (my_ionode == rank_to_ionode[fd->hints->ranklist[i]] ) {
-	    group_start = ADIOI_MIN(fd_start[i], group_start);
-	    group_end = ADIOI_MAX(fd_end[i], group_end);
+	    group_start = MPL_MIN(fd_start[i], group_start);
+	    group_end = MPL_MAX(fd_end[i], group_end);
 	}
     }
     *start = group_start;
@@ -674,8 +674,8 @@ static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype
 
     for (i=0; i < nprocs; i++)
 	for (j=0; j < others_req[i].count; j++) {
-	    st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-	    end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j]
+	    st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+	    end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j]
 				       + others_req[i].lens[j] - 1));
 	}
 
@@ -799,7 +799,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype
 #endif
 	for (i=0; i < nprocs; i++) count[i] = recv_size[i] = 0;
 
-	size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
+	size = MPL_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
 
 	for (i=0; i < nprocs; i++) {
 	    if (others_req[i].count) {
@@ -827,7 +827,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, const void *buf, MPI_Datatype
 			MPI_Address(write_buf+req_off-off, 
                                &(others_req[i].mem_ptrs[j]));
       ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off));
-			recv_size[i] += (int)(ADIOI_MIN(off + size - req_off, 
+			recv_size[i] += (int)(MPL_MIN(off + size - req_off, 
                                       (unsigned)req_len));
 
 			if (off+size-req_off < (unsigned)req_len)
@@ -1247,7 +1247,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, const void *buf, char *write_buf
 #define ADIOI_BUF_INCR \
 { \
     while (buf_incr) { \
-        size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \
+        size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \
         user_buf_idx += size_in_buf; \
         flat_buf_sz -= size_in_buf; \
         if (!flat_buf_sz) { \
@@ -1268,7 +1268,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, const void *buf, char *write_buf
 #define ADIOI_BUF_COPY \
 { \
     while (size) { \
-        size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
+        size_in_buf = MPL_MIN(size, flat_buf_sz); \
   ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \
   ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \
         memcpy(&(send_buf[p][send_buf_idx[p]]), \
@@ -1355,7 +1355,7 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, const void *buf, ADIOI_Flatlist
 	    if (send_buf_idx[p] < send_size[p]) {
 		if (curr_to_proc[p]+len > done_to_proc[p]) {
 		    if (done_to_proc[p] > curr_to_proc[p]) {
-			size = ADIOI_MIN(curr_to_proc[p] + len - 
+			size = MPL_MIN(curr_to_proc[p] + len - 
                                 done_to_proc[p], send_size[p]-send_buf_idx[p]);
 			buf_incr = done_to_proc[p] - curr_to_proc[p];
 			ADIOI_BUF_INCR
@@ -1366,7 +1366,7 @@ static void ADIOI_Fill_send_buffer(ADIO_File fd, const void *buf, ADIOI_Flatlist
 		        ADIOI_BUF_COPY
 		    }
 		    else {
-			size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]);
+			size = MPL_MIN(len,send_size[p]-send_buf_idx[p]);
 			buf_incr = len;
       ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size));
 			curr_to_proc[p] += size;
@@ -1768,7 +1768,7 @@ static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, const void *buf, ADIOI_F
 	    if (send_buf_idx[p] < send_size[p]) {
 		if (curr_to_proc[p]+len > done_to_proc[p]) {
 		    if (done_to_proc[p] > curr_to_proc[p]) {
-			size = ADIOI_MIN(curr_to_proc[p] + len - 
+			size = MPL_MIN(curr_to_proc[p] + len - 
                                 done_to_proc[p], send_size[p]-send_buf_idx[p]);
 			buf_incr = done_to_proc[p] - curr_to_proc[p];
 			ADIOI_BUF_INCR
@@ -1779,7 +1779,7 @@ static void ADIOI_Fill_send_buffer_nosend(ADIO_File fd, const void *buf, ADIOI_F
 		        ADIOI_BUF_COPY
 		    }
 		    else {
-			size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]);
+			size = MPL_MIN(len,send_size[p]-send_buf_idx[p]);
 			buf_incr = len;
       ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size));
 			curr_to_proc[p] += size;
diff --git a/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.c b/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.c
index a94c996..b8ca777 100644
--- a/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.c
+++ b/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.c
@@ -350,7 +350,7 @@ ADIOI_BG_persInfo_init(ADIOI_BG_ConfInfo_t *conf,
       if(conf->nAggrs <=0)
          conf->nAggrs = gpfsmpio_bg_nagg_pset;
       if(conf->ioMinSize <= conf->nAggrs)
-        conf->nAggrs = ADIOI_MAX(1,conf->ioMinSize-1); /* not including bridge itself */
+        conf->nAggrs = MPL_MAX(1,conf->ioMinSize-1); /* not including bridge itself */
 /*      if(conf->nAggrs > conf->numBridgeRanks) 
          conf->nAggrs = conf->numBridgeRanks; 
 */
diff --git a/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.h b/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.h
index bcdc61f..487a52b 100644
--- a/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.h
+++ b/src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.h
@@ -55,9 +55,6 @@ typedef struct {
 } ADIOI_BG_ConfInfo_t __attribute__((aligned(16)));
 
 
-#undef MIN
-#define MIN(a,b) (((a)<(b) ? (a) : (b)))
-
 
 
 
diff --git a/src/mpi/romio/adio/ad_gridftp/ad_gridftp_read.c b/src/mpi/romio/adio/ad_gridftp/ad_gridftp_read.c
index 19351b7..55cd10b 100644
--- a/src/mpi/romio/adio/ad_gridftp/ad_gridftp_read.c
+++ b/src/mpi/romio/adio/ad_gridftp/ad_gridftp_read.c
@@ -265,7 +265,7 @@ void ADIOI_GRIDFTP_ReadDiscontig(ADIO_File fd, void *buf, int count,
 		    /* compute extent -- the nblks*ftype_extent bit is
 		       there so we remember how many ftypes we've already
 		       been through */
-		    extent=MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen);
+		    extent=MPL_MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen);
 		    if ( boff>=(count*btype_size) )
 			break;
 		}
diff --git a/src/mpi/romio/adio/ad_gridftp/ad_gridftp_write.c b/src/mpi/romio/adio/ad_gridftp/ad_gridftp_write.c
index 22e2523..4466dde 100644
--- a/src/mpi/romio/adio/ad_gridftp/ad_gridftp_write.c
+++ b/src/mpi/romio/adio/ad_gridftp/ad_gridftp_write.c
@@ -262,7 +262,7 @@ void ADIOI_GRIDFTP_WriteDiscontig(ADIO_File fd, void *buf, int count,
 		    else
 			blklen=(count*btype_size)-boff;
 		    boff+=blklen;
-		    extent=MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen);
+		    extent=MPL_MAX(extent,nblks*ftype_extent+flat_file->indices[i]+blklen);
 		    if ( boff>=(count*btype_size) )
 			break;
 		}
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_aggregate.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_aggregate.c
index da54d71..39f158d 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_aggregate.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_aggregate.c
@@ -61,7 +61,7 @@ void ADIOI_LUSTRE_Get_striping_info(ADIO_File fd, int **striping_info_ptr,
 	 * e.g. if stripe_count=20, nprocs_for_coll=42 and CO=3 then 
 	 * avail_cb_nodes should be equal to 40 */
         avail_cb_nodes = 
-		stripe_count * ADIOI_MIN(nprocs_for_coll/stripe_count, CO);
+		stripe_count * MPL_MIN(nprocs_for_coll/stripe_count, CO);
     else {
         /* nprocs_for_coll is less than stripe_count */
         /* avail_cb_nodes should divide stripe_count */
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_fcntl.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_fcntl.c
index a4bd6fc..f322835 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_fcntl.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_fcntl.c
@@ -45,14 +45,14 @@ void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
 	curr_fsize = lseek(fd->fd_sys, 0, SEEK_END);
 	alloc_size = fcntl_struct->diskspace;
 
-	size = ADIOI_MIN(curr_fsize, alloc_size);
+	size = MPL_MIN(curr_fsize, alloc_size);
 	
 	ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
 	buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
 	done = 0;
 
 	for (i=0; i<ntimes; i++) {
-	    len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
+	    len = MPL_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
 	    ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, done,
 			    &status, error_code);
 	    if (*error_code != MPI_SUCCESS) {
@@ -72,7 +72,7 @@ void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
 	    size = alloc_size - curr_fsize;
 	    ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
 	    for (i=0; i<ntimes; i++) {
-		len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
+		len = MPL_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
 		ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, 
 				 done, &status, error_code);
 		if (*error_code != MPI_SUCCESS) return;
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c
index cb187a3..31c86be 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c
@@ -65,7 +65,7 @@ static int ADIOI_LUSTRE_Directio(ADIO_File fd, const void *buf, int len,
 
     if (offset % fd->d_miniosz) {
 	diff = fd->d_miniosz - (offset % fd->d_miniosz);
-	diff = ADIOI_MIN(diff, len);
+	diff = MPL_MIN(diff, len);
 	if (rw)
 	    nbytes = pwrite(fd->fd_sys, (void *)buf, diff, offset);
 	else
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c
index 9dca62d..af5c40b 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c
@@ -344,8 +344,8 @@ static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf,
     }
     for (i = 0; i < nprocs; i++) {
 	for (j = 0; j < others_req[i].count; j++) {
-	    st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-	    end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j] +
+	    st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+	    end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j] +
                                           others_req[i].lens[j] - 1));
 	}
     }
@@ -379,7 +379,7 @@ static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf,
         for (j = 0; j < others_req[i].count; j ++) {
             req_off = others_req[i].offsets[j];
             m = (int)((req_off - min_st_loc) / step_size);
-            off_list[m] = ADIOI_MIN(off_list[m], req_off);
+            off_list[m] = MPL_MIN(off_list[m], req_off);
         }
     }
 
@@ -471,8 +471,8 @@ static void ADIOI_LUSTRE_Exch_and_write(ADIO_File fd, const void *buf,
 	    recv_count[i] = recv_size[i] = send_size[i] = 0;
 
         off = off_list[m];
-        max_size = ADIOI_MIN(step_size, max_end_loc - iter_st_off + 1);
-        real_size = (int) ADIOI_MIN((off / stripe_size + 1) * stripe_size -
+        max_size = MPL_MIN(step_size, max_end_loc - iter_st_off + 1);
+        real_size = (int) MPL_MIN((off / stripe_size + 1) * stripe_size -
                                     off,
                                     end_loc - off + 1);
 
@@ -837,7 +837,7 @@ static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, const void *buf,
 #define ADIOI_BUF_INCR \
 { \
     while (buf_incr) { \
-        size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \
+        size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \
         user_buf_idx += size_in_buf; \
         flat_buf_sz -= size_in_buf; \
         if (!flat_buf_sz) { \
@@ -858,7 +858,7 @@ static void ADIOI_LUSTRE_W_Exchange_data(ADIO_File fd, const void *buf,
 #define ADIOI_BUF_COPY \
 { \
     while (size) { \
-        size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
+        size_in_buf = MPL_MIN(size, flat_buf_sz); \
         ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \
         ADIOI_Assert(size_in_buf == (size_t)size_in_buf);               \
         memcpy(&(send_buf[p][send_buf_idx[p]]), \
@@ -940,7 +940,7 @@ static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, const void *buf,
 	    if (send_buf_idx[p] < send_size[p]) {
 		if (curr_to_proc[p] + len > done_to_proc[p]) {
 		    if (done_to_proc[p] > curr_to_proc[p]) {
-			size = (int) ADIOI_MIN(curr_to_proc[p] + len -
+			size = (int) MPL_MIN(curr_to_proc[p] + len -
 					       done_to_proc[p],
 					       send_size[p] -
 					       send_buf_idx[p]);
@@ -953,7 +953,7 @@ static void ADIOI_LUSTRE_Fill_send_buffer(ADIO_File fd, const void *buf,
 			curr_to_proc[p] = done_to_proc[p] + size;
 		        ADIOI_BUF_COPY
                     } else {
-			size = (int) ADIOI_MIN(len, send_size[p] -
+			size = (int) MPL_MIN(len, send_size[p] -
 					       send_buf_idx[p]);
 			buf_incr = (int) len;
                         ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size));
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
index 071c51e..1e69575 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c
@@ -32,7 +32,7 @@
         } \
 	writebuf_off = req_off; \
         /* stripe_size alignment */ \
-        writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \
+        writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \
                                        (writebuf_off / stripe_size + 1) * \
                                             stripe_size - writebuf_off); \
 	if (!(fd->atomicity)) \
@@ -50,10 +50,10 @@
 	    return; \
 	} \
     } \
-    write_sz = (unsigned) (ADIOI_MIN(req_len,                           \
+    write_sz = (unsigned) (MPL_MIN(req_len,                           \
                                      writebuf_off + writebuf_len - req_off)); \
     ADIOI_Assert((ADIO_Offset)write_sz ==                               \
-                 ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+                 MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
     memcpy(writebuf + req_off - writebuf_off, (char *)buf +userbuf_off, write_sz); \
     while (write_sz != req_len) {                                       \
         ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
@@ -72,7 +72,7 @@
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
         /* stripe_size alignment */ \
-        writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \
+        writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \
                                        (writebuf_off / stripe_size + 1) * \
                                             stripe_size - writebuf_off); \
 	if (!(fd->atomicity)) \
@@ -88,7 +88,7 @@
             ADIOI_Free(writebuf); \
 	    return; \
 	} \
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);          \
     } \
 }
@@ -113,12 +113,12 @@
         }                                                               \
 	writebuf_off = req_off; \
         /* stripe_size alignment */ \
-        writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \
+        writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \
                                        (writebuf_off / stripe_size + 1) * \
                                             stripe_size - writebuf_off); \
     } \
-    write_sz = (unsigned) ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off); \
-    ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    write_sz = (unsigned) MPL_MIN(req_len, writebuf_off + writebuf_len - req_off); \
+    ADIOI_Assert((ADIO_Offset)write_sz == MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
     memcpy(writebuf + req_off - writebuf_off,                           \
            (char *)buf + userbuf_off, write_sz);                        \
     while (write_sz != req_len) {                                       \
@@ -136,10 +136,10 @@
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
         /* stripe_size alignment */ \
-        writebuf_len = (unsigned) ADIOI_MIN(end_offset - writebuf_off + 1, \
+        writebuf_len = (unsigned) MPL_MIN(end_offset - writebuf_off + 1, \
                                        (writebuf_off / stripe_size + 1) * \
                                             stripe_size - writebuf_off); \
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);          \
     } \
 }
@@ -217,7 +217,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
 	start_off = off;
 	end_offset = start_off + bufsize - 1;
         /* write stripe size buffer each time */
-	writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size));
+	writebuf = (char *) ADIOI_Malloc(MPL_MIN(bufsize, stripe_size));
         writebuf_off = 0;
         writebuf_len = 0;
 
@@ -318,8 +318,8 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
             req_off = start_off;
             req_len = bufsize;
             end_offset = start_off + bufsize - 1;
-	    writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size));
-	    memset(writebuf, -1, ADIOI_MIN(bufsize, stripe_size));
+	    writebuf = (char *) ADIOI_Malloc(MPL_MIN(bufsize, stripe_size));
+	    memset(writebuf, -1, MPL_MIN(bufsize, stripe_size));
             writebuf_off = 0;
             writebuf_len = 0;
             userbuf_off = 0;
@@ -361,7 +361,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
         i_offset = 0;
 	    j = st_index;
 	    off = offset;
-	    fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	    fwr_size = MPL_MIN(st_fwr_size, bufsize);
         while (i_offset < bufsize) {
             i_offset += fwr_size;
 		end_offset = off + fwr_size - 1;
@@ -375,7 +375,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
 
 		off = disp + flat_file->indices[j] +
                 n_filetypes*(ADIO_Offset)filetype_extent;
-            fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+            fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 	    }
 
 /* if atomicity is true, lock the region to be accessed */
@@ -396,7 +396,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
 		j = st_index;
 		off = offset;
 		n_filetypes = st_n_filetypes;
-		fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+		fwr_size = MPL_MIN(st_fwr_size, bufsize);
             while (i_offset < bufsize) {
 		    if (fwr_size) {
 			/* TYPE_UB and TYPE_LB can result in
@@ -426,7 +426,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
 			}
 			off = disp + flat_file->indices[j] +
                         n_filetypes*(ADIO_Offset)filetype_extent;
-			fwr_size = ADIOI_MIN(flat_file->blocklens[j],
+			fwr_size = MPL_MIN(flat_file->blocklens[j],
                                          bufsize-i_offset);
 		    }
 		}
@@ -444,7 +444,7 @@ void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, const void *buf, int count,
 		bwr_size = flat_buf->blocklens[0];
 
 		while (num < bufsize) {
-		    size = ADIOI_MIN(fwr_size, bwr_size);
+		    size = MPL_MIN(fwr_size, bwr_size);
 		    if (size) {
                     /* lseek(fd->fd_sys, off, SEEK_SET);
                        err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */
diff --git a/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c b/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
index dd2f1c8..a183c6d 100644
--- a/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
+++ b/src/mpi/romio/adio/ad_nfs/ad_nfs_read.c
@@ -92,7 +92,7 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
 { \
     if (req_off >= readbuf_off + readbuf_len) { \
 	readbuf_off = req_off; \
-	readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\
+	readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));\
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \
 	lseek(fd->fd_sys, readbuf_off, SEEK_SET);\
         MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL ); \
@@ -112,7 +112,7 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
 	memcpy(readbuf, tmp_buf, partial_read); \
 	ADIOI_Free(tmp_buf); \
 	readbuf_off += readbuf_len-partial_read; \
-	readbuf_len = (int) (partial_read + ADIOI_MIN(max_bufsize, \
+	readbuf_len = (int) (partial_read + MPL_MIN(max_bufsize, \
 				       end_offset-readbuf_off+1)); \
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \
 	lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET);\
@@ -131,7 +131,7 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
 { \
     if (req_off >= readbuf_off + readbuf_len) { \
 	readbuf_off = req_off; \
-	readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\
+	readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));\
 	lseek(fd->fd_sys, readbuf_off, SEEK_SET);\
         if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len);\
         err = read(fd->fd_sys, readbuf, readbuf_len);\
@@ -147,7 +147,7 @@ void ADIOI_NFS_ReadContig(ADIO_File fd, void *buf, int count,
 	memcpy(readbuf, tmp_buf, partial_read); \
 	ADIOI_Free(tmp_buf); \
 	readbuf_off += readbuf_len-partial_read; \
-	readbuf_len = (int) (partial_read + ADIOI_MIN(max_bufsize, \
+	readbuf_len = (int) (partial_read + MPL_MIN(max_bufsize, \
 				       end_offset-readbuf_off+1)); \
 	lseek(fd->fd_sys, readbuf_off+partial_read, SEEK_SET);\
         if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off+partial_read, SEEK_SET, readbuf_len-partial_read);\
@@ -224,7 +224,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	end_offset = off + bufsize - 1;
         readbuf_off = off;
         readbuf = (char *) ADIOI_Malloc(max_bufsize);
-        readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));
+        readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));
 
 /* if atomicity is true, lock (exclusive) the region to be accessed */
         if (fd->atomicity)
@@ -370,7 +370,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	i = 0;
 	j = st_index;
 	off = offset;
-	frd_size = ADIOI_MIN(st_frd_size, bufsize);
+	frd_size = MPL_MIN(st_frd_size, bufsize);
 	while (i < bufsize) {
 	    i += frd_size;
 	    end_offset = off + frd_size - 1;
@@ -382,7 +382,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	    }
 
 	    off = disp + flat_file->indices[j] + (ADIO_Offset) n_filetypes*filetype_extent;
-	    frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i);
+	    frd_size = MPL_MIN(flat_file->blocklens[j], bufsize-i);
 	}
 
 /* if atomicity is true, lock (exclusive) the region to be accessed */
@@ -392,7 +392,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
         /* initial read into readbuf */
 	readbuf_off = offset;
 	readbuf = (char *) ADIOI_Malloc(max_bufsize);
-	readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));
+	readbuf_len = (int) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));
 
 #ifdef ADIOI_MPE_LOGGING
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
@@ -422,7 +422,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	    j = st_index;
 	    off = offset;
 	    n_filetypes = st_n_filetypes;
-	    frd_size = ADIOI_MIN(st_frd_size, bufsize);
+	    frd_size = MPL_MIN(st_frd_size, bufsize);
 	    while (i < bufsize) {
                 if (frd_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -451,7 +451,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
                     }
 		    off = disp + flat_file->indices[j] + 
                                         (ADIO_Offset) n_filetypes*filetype_extent;
-		    frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i);
+		    frd_size = MPL_MIN(flat_file->blocklens[j], bufsize-i);
 		}
 	    }
 	}
@@ -469,7 +469,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	    brd_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(frd_size, brd_size);
+		size = MPL_MIN(frd_size, brd_size);
 		if (size) {
 		    /* lseek(fd->fd_sys, off, SEEK_SET);
 		    err = read(fd->fd_sys, ((char *) buf) + i, size); */
diff --git a/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c b/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
index d9ee5d2..2df8df6 100644
--- a/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
+++ b/src/mpi/romio/adio/ad_nfs/ad_nfs_write.c
@@ -98,7 +98,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         if (err == -1) err_flag = 1; \
 	writebuf_off = req_off; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \
 	lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
@@ -114,7 +114,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
 	    goto fn_exit; \
         } \
     } \
-    write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
     memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\
     while (write_sz != req_len) { \
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \
@@ -128,7 +128,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         req_len -= write_sz; \
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \
 	lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
@@ -143,7 +143,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
 					       "**ioRMWrdwr", 0); \
 	    goto fn_exit; \
         } \
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
     } \
 }
@@ -156,7 +156,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         if (err == -1) err_flag = 1; \
 	writebuf_off = req_off; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
 	lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
 	err = read(fd->fd_sys, writebuf, writebuf_len); \
@@ -168,7 +168,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
 	    goto fn_exit; \
         } \
     } \
-    write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
     memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\
     while (write_sz != req_len) { \
 	lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
@@ -178,7 +178,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         req_len -= write_sz; \
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
 	lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
 	err = read(fd->fd_sys, writebuf, writebuf_len); \
@@ -189,7 +189,7 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
 					       "**ioRMWrdwr", 0); \
 	    goto fn_exit; \
         } \
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
     } \
 }
@@ -211,9 +211,9 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         if (err == -1) err_flag = 1; \
 	writebuf_off = req_off; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
     } \
-    write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
     memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\
     while (write_sz != req_len) { \
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL ); \
@@ -228,8 +228,8 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         req_len -= write_sz; \
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
     } \
 }
@@ -243,9 +243,9 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         if (err == -1) err_flag = 1; \
 	writebuf_off = req_off; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
     } \
-    write_sz = (int) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    write_sz = (int) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
     memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\
     while (write_sz != req_len) { \
 	lseek(fd->fd_sys, writebuf_off, SEEK_SET); \
@@ -256,8 +256,8 @@ void ADIOI_NFS_WriteContig(ADIO_File fd, const void *buf, int count,
         req_len -= write_sz; \
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
     } \
 }
@@ -327,7 +327,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
 	end_offset = off + bufsize - 1;
         writebuf_off = off;
         writebuf = (char *) ADIOI_Malloc(max_bufsize);
-        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));
+        writebuf_len = (int) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));
 
 /* if atomicity is true, lock the region to be accessed */
         if (fd->atomicity) 
@@ -470,7 +470,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
 	i = 0;
 	j = st_index;
 	off = offset;
-	fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	fwr_size = MPL_MIN(st_fwr_size, bufsize);
 	while (i < bufsize) {
 	    i += fwr_size;
 	    end_offset = off + fwr_size - 1;
@@ -483,7 +483,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
 
 	    off = disp + flat_file->indices[j] + 
 		    (ADIO_Offset) n_filetypes*filetype_extent;
-	    fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i);
+	    fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i);
 	}
 
 /* if atomicity is true, lock the region to be accessed */
@@ -493,7 +493,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
         /* initial read for the read-modify-write */
         writebuf_off = offset;
         writebuf = (char *) ADIOI_Malloc(max_bufsize);
-        writebuf_len = (int)(ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));
+        writebuf_len = (int)(MPL_MIN(max_bufsize,end_offset-writebuf_off+1));
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len);
 #ifdef ADIOI_MPE_LOGGING
         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
@@ -527,7 +527,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
 	    j = st_index;
 	    off = offset;
 	    n_filetypes = st_n_filetypes;
-	    fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	    fwr_size = MPL_MIN(st_fwr_size, bufsize);
 	    while (i < bufsize) {
                 if (fwr_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -556,7 +556,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
                     }
 		    off = disp + flat_file->indices[j] + 
                                       (ADIO_Offset) n_filetypes*filetype_extent;
-		    fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i);
+		    fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i);
 		}
 	    }
 	}
@@ -574,7 +574,7 @@ void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,
 	    bwr_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(fwr_size, bwr_size);
+		size = MPL_MIN(fwr_size, bwr_size);
 		if (size) {
 		    /* lseek(fd->fd_sys, off, SEEK_SET);
 		    err = write(fd->fd_sys, ((char *) buf) + i, size); */
diff --git a/src/mpi/romio/adio/ad_piofs/ad_piofs_hints.c b/src/mpi/romio/adio/ad_piofs/ad_piofs_hints.c
index 242ebb3..b21785e 100644
--- a/src/mpi/romio/adio/ad_piofs/ad_piofs_hints.c
+++ b/src/mpi/romio/adio/ad_piofs/ad_piofs_hints.c
@@ -93,7 +93,7 @@ void ADIOI_PIOFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
 		    ADIOI_Free(path);
 
-		    str_factor = ADIOI_MIN(nioservers, str_factor);
+		    str_factor = MPL_MIN(nioservers, str_factor);
 		    if (start_iodev >= nioservers) start_iodev = -1;
 
 		    ADIOI_Strncpy(piofs_create.name, fd->filename, len);
diff --git a/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c b/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
index 4da38ba..252424a 100644
--- a/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
+++ b/src/mpi/romio/adio/ad_piofs/ad_piofs_write.c
@@ -225,7 +225,7 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
 	    i = 0;
 	    j = st_index;
 	    off = offset;
-	    fwr_size = ADIOI_MIN(fwr_size, bufsize);
+	    fwr_size = MPL_MIN(fwr_size, bufsize);
 	    while (i < bufsize) {
                 if (fwr_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -249,7 +249,7 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
 		    }
 		    off = disp + flat_file->indices[j] + 
                                         (ADIO_Offset) n_filetypes*filetype_extent;
-		    fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i);
+		    fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i);
 		}
 	    }
 	}
@@ -265,7 +265,7 @@ void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,
 	    bwr_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(fwr_size, bwr_size);
+		size = MPL_MIN(fwr_size, bwr_size);
 		if (size) {
 		    llseek(fd->fd_sys, off, SEEK_SET);
 		    err = write(fd->fd_sys, ((char *) buf) + indx, size);
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
index 1d294ea..3495145 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c
@@ -317,7 +317,7 @@ void ADIOI_PVFS_ReadStridedListIO(ADIO_File fd, void *buf, int count,
 	mem_list_count = 1;
 	
 	/* determine how many blocks in file to read */
-	f_data_read = ADIOI_MIN(st_frd_size, bufsize);
+	f_data_read = MPL_MIN(st_frd_size, bufsize);
 	total_blks_to_read = 1;
 	j++;
 	while (f_data_read < bufsize) {
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
index 5388de4..5113ad3 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c
@@ -321,7 +321,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
 	    i = 0;
 	    j = st_index;
 	    off = offset;
-	    fwr_size = ADIOI_MIN(fwr_size, bufsize);
+	    fwr_size = MPL_MIN(fwr_size, bufsize);
 	    while (i < bufsize) {
                 if (fwr_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -357,7 +357,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
 		    }
 		    off = disp + flat_file->indices[j] + 
                                         (ADIO_Offset) n_filetypes*filetype_extent;
-		    fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i);
+		    fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i);
 		}
 	    }
 	}
@@ -373,7 +373,7 @@ void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,
 	    bwr_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(fwr_size, bwr_size);
+		size = MPL_MIN(fwr_size, bwr_size);
 		if (size) {
 #ifdef ADIOI_MPE_LOGGING
                     MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
@@ -706,7 +706,7 @@ void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,
 	mem_list_count = 1;
         
 	/* determine how many blocks in file to read */
-	f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize);
+	f_data_wrote = MPL_MIN(st_fwr_size, bufsize);
 	total_blks_to_write = 1;
 	j++;
 	while (f_data_wrote < bufsize) {
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
index 40ff2c1..b85c3d2 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_read_list_classic.c
@@ -270,7 +270,7 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
 	mem_list_count = 1;
 	
 	/* determine how many blocks in file to read */
-	f_data_read = ADIOI_MIN(st_frd_size, bufsize);
+	f_data_read = MPL_MIN(st_frd_size, bufsize);
 	total_blks_to_read = 1;
 	if (j < (flat_file->count-1)) j++;
 	else {
@@ -394,7 +394,7 @@ void ADIOI_PVFS2_OldReadStrided(ADIO_File fd, void *buf, int count,
 	    file_list_count = extra_blks;
 	    if(!i) {
 	        file_offsets[0] = offset;
-		file_lengths[0] = ADIOI_MIN(st_frd_size, bufsize);
+		file_lengths[0] = MPL_MIN(st_frd_size, bufsize);
 	    }
 	    for (k=0; k<extra_blks; k++) {
 	        if(i || k) {
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
index 5adae31..2f412e2 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_write_list_classic.c
@@ -312,7 +312,7 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
 	mem_list_count = 1;
         
 	/* determine how many blocks in file to write */
-	f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize);
+	f_data_wrote = MPL_MIN(st_fwr_size, bufsize);
 	total_blks_to_write = 1;
 	if (j < (flat_file->count -1)) j++;
 	else {
@@ -437,7 +437,7 @@ void ADIOI_PVFS2_OldWriteStrided(ADIO_File fd, const void *buf, int count,
             file_list_count = extra_blks;
             if(!i) {
                 file_offsets[0] = offset;
-                file_lengths[0] = ADIOI_MIN(st_fwr_size, bufsize);
+                file_lengths[0] = MPL_MIN(st_fwr_size, bufsize);
             }
             for (k=0; k<extra_blks; k++) {
                 if(i || k) {
diff --git a/src/mpi/romio/adio/ad_xfs/ad_xfs_read.c b/src/mpi/romio/adio/ad_xfs/ad_xfs_read.c
index c3c237c..c893fce 100644
--- a/src/mpi/romio/adio/ad_xfs/ad_xfs_read.c
+++ b/src/mpi/romio/adio/ad_xfs/ad_xfs_read.c
@@ -48,7 +48,7 @@ void ADIOI_XFS_ReadContig(ADIO_File fd, void *buf, int count,
    		        else copy into aligned buf and then use (1) */
 	else if (offset % fd->d_miniosz) {
 	    diff = fd->d_miniosz - (offset % fd->d_miniosz);
-	    diff = ADIOI_MIN(diff, len);
+	    diff = MPL_MIN(diff, len);
 	    nbytes = pread(fd->fd_sys, buf, diff, offset);
 
 	    buf = ((char *) buf) + diff;
diff --git a/src/mpi/romio/adio/ad_xfs/ad_xfs_write.c b/src/mpi/romio/adio/ad_xfs/ad_xfs_write.c
index 9ab8276..d0901c5 100644
--- a/src/mpi/romio/adio/ad_xfs/ad_xfs_write.c
+++ b/src/mpi/romio/adio/ad_xfs/ad_xfs_write.c
@@ -52,7 +52,7 @@ void ADIOI_XFS_WriteContig(ADIO_File fd, void *buf, int count,
    		        else copy into aligned buf and then use (1) */
 	} else if (offset % fd->d_miniosz) {
 	    diff = fd->d_miniosz - (offset % fd->d_miniosz);
-	    diff = ADIOI_MIN(diff, len);
+	    diff = MPL_MIN(diff, len);
 	    err = pwrite(fd->fd_sys, buf, diff, offset);
 	    if (err < 0) {goto leaving;}
 
diff --git a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
index 3541072..7422ecf 100644
--- a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
+++ b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c
@@ -266,7 +266,7 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	mem_list_count = 1;
 	
 	/* determine how many blocks in file to read */
-	f_data_read = ADIOI_MIN(st_frd_size, bufsize);
+	f_data_read = MPL_MIN(st_frd_size, bufsize);
 	total_blks_to_read = 1;
 	if (j < (flat_file->count-1)) j++;
 	else {
@@ -360,7 +360,7 @@ void ADIOI_ZOIDFS_ReadStrided(ADIO_File fd, void *buf, int count,
 	    file_list_count = extra_blks;
 	    if(!i) {
 	        file_offsets[0] = offset;
-		file_lengths[0] = ADIOI_MIN(st_frd_size, bufsize);
+		file_lengths[0] = MPL_MIN(st_frd_size, bufsize);
 	    }
 	    for (k=0; k<extra_blks; k++) {
 	        if(i || k) {
diff --git a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
index 040d92a..f078ed4 100644
--- a/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
+++ b/src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_write_list.c
@@ -293,7 +293,7 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
 	mem_list_count = 1;
         
 	/* determine how many blocks in file to write */
-	f_data_wrote = ADIOI_MIN(st_fwr_size, bufsize);
+	f_data_wrote = MPL_MIN(st_fwr_size, bufsize);
 	total_blks_to_write = 1;
 	if (j < (flat_file->count -1)) j++;
 	else {
@@ -388,7 +388,7 @@ void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,
             file_list_count = extra_blks;
             if(!i) {
                 file_offsets[0] = offset;
-                file_lengths[0] = ADIOI_MIN(st_fwr_size, bufsize);
+                file_lengths[0] = MPL_MIN(st_fwr_size, bufsize);
             }
             for (k=0; k<extra_blks; k++) {
                 if(i || k) {
diff --git a/src/mpi/romio/adio/common/ad_aggregate.c b/src/mpi/romio/adio/common/ad_aggregate.c
index 77c69bd..0585562 100644
--- a/src/mpi/romio/adio/common/ad_aggregate.c
+++ b/src/mpi/romio/adio/common/ad_aggregate.c
@@ -154,8 +154,8 @@ void ADIOI_Calc_file_domains(ADIO_Offset *st_offsets, ADIO_Offset
     max_end_offset = end_offsets[0];
 
     for (i=1; i<nprocs; i++) {
-	min_st_offset = ADIOI_MIN(min_st_offset, st_offsets[i]);
-	max_end_offset = ADIOI_MAX(max_end_offset, end_offsets[i]);
+	min_st_offset = MPL_MIN(min_st_offset, st_offsets[i]);
+	max_end_offset = MPL_MAX(max_end_offset, end_offsets[i]);
     }
 
 /* determine the "file domain (FD)" of each process, i.e., the portion of
diff --git a/src/mpi/romio/adio/common/ad_aggregate_new.c b/src/mpi/romio/adio/common/ad_aggregate_new.c
index ba5af6b..fa6fa1e 100644
--- a/src/mpi/romio/adio/common/ad_aggregate_new.c
+++ b/src/mpi/romio/adio/common/ad_aggregate_new.c
@@ -220,7 +220,7 @@ void ADIOI_Calc_file_realms_fsize (ADIO_File fd, int nprocs_for_coll,
     ADIO_Fcntl (fd, ADIO_FCNTL_GET_FSIZE, &fcntl_struct, &error_code);
     
     /* use impending file size since a write call may lengthen the file */
-    fsize = ADIOI_MAX (fcntl_struct.fsize, max_end_offset+1);
+    fsize = MPL_MAX (fcntl_struct.fsize, max_end_offset+1);
     fr_size = (fsize + nprocs_for_coll - 1) / nprocs_for_coll;
     align_fr(fr_size, 0, fd->hints->cb_fr_alignment,
 	     &aligned_fr_size, &aligned_fr_off);
diff --git a/src/mpi/romio/adio/common/ad_coll_exch_new.c b/src/mpi/romio/adio/common/ad_coll_exch_new.c
index cbc6454..9db2d98 100644
--- a/src/mpi/romio/adio/common/ad_coll_exch_new.c
+++ b/src/mpi/romio/adio/common/ad_coll_exch_new.c
@@ -435,7 +435,7 @@ void ADIOI_Exch_file_views(int myrank, int nprocs, int file_ptr_type,
     /* Since ADIOI_Malloc may do other things we add the +1 
      * to avoid a 0-size malloc */    
     statuses = (MPI_Status *) 
-	ADIOI_Malloc(1 + 2 * ADIOI_MAX(send_req_arr_sz,recv_req_arr_sz)
+	ADIOI_Malloc(1 + 2 * MPL_MAX(send_req_arr_sz,recv_req_arr_sz)
 		     * sizeof(MPI_Status));
 
     if (send_req_arr_sz > 0) {
diff --git a/src/mpi/romio/adio/common/ad_darray.c b/src/mpi/romio/adio/common/ad_darray.c
index 23715c4..632669b 100644
--- a/src/mpi/romio/adio/common/ad_darray.c
+++ b/src/mpi/romio/adio/common/ad_darray.c
@@ -175,7 +175,7 @@ static int MPIOI_Type_block(int *array_of_gsizes, int dim, int ndims, int nprocs
     }
 
     j = global_size - blksize*rank;
-    mysize = ADIOI_MIN(blksize, j);
+    mysize = MPL_MIN(blksize, j);
     if (mysize < 0) mysize = 0;
 
     stride = orig_extent;
@@ -235,7 +235,7 @@ static int MPIOI_Type_cyclic(int *array_of_gsizes, int dim, int ndims, int nproc
     else {
 	local_size = ((end_index - st_index + 1)/(nprocs*blksize))*blksize;
 	rem = (end_index - st_index + 1) % (nprocs*blksize);
-	local_size += ADIOI_MIN(rem, blksize);
+	local_size += MPL_MIN(rem, blksize);
     }
 
     count = local_size/blksize;
diff --git a/src/mpi/romio/adio/common/ad_io_coll.c b/src/mpi/romio/adio/common/ad_io_coll.c
index 7e980e1..c52bea0 100644
--- a/src/mpi/romio/adio/common/ad_io_coll.c
+++ b/src/mpi/romio/adio/common/ad_io_coll.c
@@ -142,9 +142,9 @@ void ADIOI_IOStridedColl (ADIO_File fd, void *buf, int count, int rdwr,
 	    /* This is a rudimentary check for interleaving, but should
 	     * suffice for the moment. */
 	    
-	    min_st_offset = ADIOI_MIN(all_st_end_offsets[i*2],
+	    min_st_offset = MPL_MIN(all_st_end_offsets[i*2],
 				      min_st_offset);
-	    max_end_offset = ADIOI_MAX(all_st_end_offsets[i*2+1],
+	    max_end_offset = MPL_MAX(all_st_end_offsets[i*2+1],
 				       max_end_offset);
 	}
     }
diff --git a/src/mpi/romio/adio/common/ad_iread_coll.c b/src/mpi/romio/adio/common/ad_iread_coll.c
index 2ec23fb..3255106 100644
--- a/src/mpi/romio/adio/common/ad_iread_coll.c
+++ b/src/mpi/romio/adio/common/ad_iread_coll.c
@@ -614,8 +614,8 @@ static void ADIOI_Iread_and_exch(ADIOI_NBC_Request *nbc_req, int *error_code)
     /* now find the real values */
     for (i = 0; i < nprocs; i++)
         for (j = 0; j < others_req[i].count; j++) {
-            st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-            end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j]
+            st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+            end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j]
                           + others_req[i].lens[j] - 1));
         }
 
@@ -754,7 +754,7 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req,
                  minus what was satisfied in previous iteration
        req_size = size corresponding to req_off */
 
-    size = ADIOI_MIN((unsigned)vars->coll_bufsize,
+    size = MPL_MIN((unsigned)vars->coll_bufsize,
                      vars->end_loc - vars->st_loc + 1 - vars->done);
     real_off = vars->off - vars->for_curr_iter;
     real_size = size + vars->for_curr_iter;
@@ -793,7 +793,7 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req,
                     MPI_Address(read_buf + req_off - real_off,
                                 &(others_req[i].mem_ptrs[j]));
                     ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off));
-                    send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off,
+                    send_size[i] += (int)(MPL_MIN(real_off + real_size - req_off,
                                                     (ADIO_Offset)(unsigned)req_len));
 
                     if (real_off + real_size - req_off < (ADIO_Offset)(unsigned)req_len) {
@@ -802,7 +802,7 @@ static void ADIOI_Iread_and_exch_l1_begin(ADIOI_NBC_Request *nbc_req,
                             (others_req[i].offsets[j+1] < real_off + real_size)) {
                             /* this is the case illustrated in the
                                figure above. */
-                            for_next_iter = ADIOI_MAX(for_next_iter,
+                            for_next_iter = MPL_MAX(for_next_iter,
                                     real_off + real_size - others_req[i].offsets[j+1]);
                             /* max because it must cover requests
                                from different processes */
diff --git a/src/mpi/romio/adio/common/ad_iwrite_coll.c b/src/mpi/romio/adio/common/ad_iwrite_coll.c
index d275f78..9796d9a 100644
--- a/src/mpi/romio/adio/common/ad_iwrite_coll.c
+++ b/src/mpi/romio/adio/common/ad_iwrite_coll.c
@@ -663,8 +663,8 @@ static void ADIOI_Iexch_and_write(ADIOI_NBC_Request *nbc_req, int *error_code)
 
     for (i = 0; i < nprocs; i++)
         for (j = 0; j < others_req[i].count; j++) {
-            st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-            end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j]
+            st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+            end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j]
                         + others_req[i].lens[j] - 1));
         }
 
@@ -794,7 +794,7 @@ static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req,
 
     for (i = 0; i < nprocs; i++) count[i] = recv_size[i] = 0;
 
-    size = ADIOI_MIN((unsigned)vars->coll_bufsize,
+    size = MPL_MIN((unsigned)vars->coll_bufsize,
                      vars->end_loc - vars->st_loc + 1 - vars->done);
     vars->size = size;
 
@@ -824,7 +824,7 @@ static void ADIOI_Iexch_and_write_l1_begin(ADIOI_NBC_Request *nbc_req,
                     MPI_Address(write_buf + req_off - off,
                                 &(others_req[i].mem_ptrs[j]));
                     ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off));
-                    recv_size[i] += (int)(ADIOI_MIN(off + size - req_off,
+                    recv_size[i] += (int)(MPL_MIN(off + size - req_off,
                                                     (unsigned)req_len));
 
                     if (off+size-req_off < (unsigned)req_len)
diff --git a/src/mpi/romio/adio/common/ad_prealloc.c b/src/mpi/romio/adio/common/ad_prealloc.c
index 9462f77..58168e8 100644
--- a/src/mpi/romio/adio/common/ad_prealloc.c
+++ b/src/mpi/romio/adio/common/ad_prealloc.c
@@ -39,14 +39,14 @@ void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code)
 					    working on a pre-existing file */
 	alloc_size = diskspace;
 
-	size = ADIOI_MIN(curr_fsize, alloc_size);
+	size = MPL_MIN(curr_fsize, alloc_size);
 	
 	ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
 	buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
 	done = 0;
 
 	for (i=0; i<ntimes; i++) {
-	    len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
+	    len = MPL_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
 	    ADIO_ReadContig(fd, buf, 
                       (int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
                               so it fits in an int parameter */
@@ -75,7 +75,7 @@ void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code)
 	    size = alloc_size - curr_fsize;
 	    ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
 	    for (i=0; i<ntimes; i++) {
-		len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
+		len = MPL_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
 		ADIO_WriteContig(fd, buf, 
                      (int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
                              so it fits in an int parameter */
diff --git a/src/mpi/romio/adio/common/ad_read_coll.c b/src/mpi/romio/adio/common/ad_read_coll.c
index 4cd481b..93d22ed 100644
--- a/src/mpi/romio/adio/common/ad_read_coll.c
+++ b/src/mpi/romio/adio/common/ad_read_coll.c
@@ -422,12 +422,12 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype
 	contig_access_count = i_offset = 0;
 	j = st_index;
 	bufsize = (ADIO_Offset)buftype_size * (ADIO_Offset)bufcount;
-	frd_size = ADIOI_MIN(frd_size, bufsize);
+	frd_size = MPL_MIN(frd_size, bufsize);
 	while (i_offset < bufsize) {
 	    if (frd_size) contig_access_count++;
 	    i_offset += frd_size;
 	    j = (j + 1) % flat_file->count;
-	    frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+	    frd_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 	}
 
         /* allocate space for offset_list and len_list */
@@ -447,7 +447,7 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype
 	i_offset = k = 0;
 	j = st_index;
 	off = offset;
-	frd_size = ADIOI_MIN(old_frd_size, bufsize);
+	frd_size = MPL_MIN(old_frd_size, bufsize);
 	while (i_offset < bufsize) {
 	    if (frd_size) {
 		offset_list[k] = off;
@@ -480,7 +480,7 @@ void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype
 		}
 		off = disp + flat_file->indices[j] + 
 		     n_filetypes* (ADIO_Offset)filetype_extent;
-		frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+		frd_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 	    }
 	}
 
@@ -549,8 +549,8 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
     /* now find the real values */
     for (i=0; i < nprocs; i++)
 	for (j=0; j<others_req[i].count; j++) {
-	    st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-	    end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j]
+	    st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+	    end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j]
 					  + others_req[i].lens[j] - 1));
 	}
 
@@ -649,7 +649,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
                        minus what was satisfied in previous iteration
              req_size = size corresponding to req_off */
 
-	size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
+	size = MPL_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
 	real_off = off - for_curr_iter;
 	real_size = size + for_curr_iter;
 
@@ -686,7 +686,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
 			MPI_Address(read_buf+req_off-real_off, 
                                &(others_req[i].mem_ptrs[j]));
       ADIOI_Assert((real_off + real_size - req_off) == (int)(real_off + real_size - req_off));
-			send_size[i] += (int)(ADIOI_MIN(real_off + real_size - req_off, 
+			send_size[i] += (int)(MPL_MIN(real_off + real_size - req_off, 
                                       (ADIO_Offset)(unsigned)req_len)); 
 
 			if (real_off+real_size-req_off < (ADIO_Offset)(unsigned)req_len) {
@@ -696,7 +696,7 @@ static void ADIOI_Read_and_exch(ADIO_File fd, void *buf, MPI_Datatype
                                      real_off+real_size)) { 
 				/* this is the case illustrated in the
 				   figure above. */
-				for_next_iter = ADIOI_MAX(for_next_iter,
+				for_next_iter = MPL_MAX(for_next_iter,
 					  real_off + real_size - others_req[i].offsets[j+1]); 
 				/* max because it must cover requests 
 				   from different processes */
@@ -907,7 +907,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 #define ADIOI_BUF_INCR \
 { \
     while (buf_incr) { \
-	size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \
+	size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \
 	user_buf_idx += size_in_buf; \
 	flat_buf_sz -= size_in_buf; \
 	if (!flat_buf_sz) { \
@@ -928,7 +928,7 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 #define ADIOI_BUF_COPY \
 { \
     while (size) { \
-	size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
+	size_in_buf = MPL_MIN(size, flat_buf_sz); \
   ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \
   ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \
 	memcpy(((char *) buf) + user_buf_idx, \
@@ -1023,7 +1023,7 @@ void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 	    if (recv_buf_idx[p] < recv_size[p]) {
 		if (curr_from_proc[p]+len > done_from_proc[p]) {
 		    if (done_from_proc[p] > curr_from_proc[p]) {
-			size = ADIOI_MIN(curr_from_proc[p] + len - 
+			size = MPL_MIN(curr_from_proc[p] + len - 
 			      done_from_proc[p], recv_size[p]-recv_buf_idx[p]);
 			buf_incr = done_from_proc[p] - curr_from_proc[p];
 			ADIOI_BUF_INCR
@@ -1033,7 +1033,7 @@ void ADIOI_Fill_user_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 			ADIOI_BUF_COPY
 		    }
 		    else {
-			size = ADIOI_MIN(len,recv_size[p]-recv_buf_idx[p]);
+			size = MPL_MIN(len,recv_size[p]-recv_buf_idx[p]);
 			buf_incr = len;
       ADIOI_Assert((curr_from_proc[p] + size) == (unsigned)((ADIO_Offset)curr_from_proc[p] + size));
 			curr_from_proc[p] += (unsigned) size;
diff --git a/src/mpi/romio/adio/common/ad_read_str.c b/src/mpi/romio/adio/common/ad_read_str.c
index 9b22a44..8cd6f53 100644
--- a/src/mpi/romio/adio/common/ad_read_str.c
+++ b/src/mpi/romio/adio/common/ad_read_str.c
@@ -12,7 +12,7 @@
 { \
     if (req_off >= readbuf_off + readbuf_len) { \
 	readbuf_off = req_off; \
-	readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));\
+	readbuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));\
 	ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE, \
               ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code); \
         if (*error_code != MPI_SUCCESS) return; \
@@ -27,7 +27,7 @@
 	memcpy(readbuf, tmp_buf, partial_read); \
 	ADIOI_Free(tmp_buf); \
 	readbuf_off += readbuf_len-partial_read; \
-	readbuf_len = (unsigned) (partial_read + ADIOI_MIN(max_bufsize, \
+	readbuf_len = (unsigned) (partial_read + MPL_MIN(max_bufsize, \
 				       end_offset-readbuf_off+1)); \
 	ADIO_ReadContig(fd, readbuf+partial_read, readbuf_len-partial_read, \
              MPI_BYTE, ADIO_EXPLICIT_OFFSET, readbuf_off+partial_read, \
@@ -124,7 +124,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
 	end_offset = off + bufsize - 1;
         readbuf_off = off;
         readbuf = (char *) ADIOI_Malloc(max_bufsize);
-        readbuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));
+        readbuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));
 
 /* if atomicity is true, lock (exclusive) the region to be accessed */
         if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS))
@@ -251,7 +251,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
 	i_offset = 0;
 	j = st_index;
 	off = offset;
-	frd_size = ADIOI_MIN(st_frd_size, bufsize);
+	frd_size = MPL_MIN(st_frd_size, bufsize);
 	while (i_offset < bufsize) {
 	    i_offset += frd_size;
 	    end_offset = off + frd_size - 1;
@@ -263,7 +263,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
 		n_filetypes += (j == 0) ? 1 : 0;
 	    }
 	    off = disp + flat_file->indices[j] + n_filetypes*(ADIO_Offset)filetype_extent;
-	    frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+	    frd_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 	}
 
 /* if atomicity is true, lock (exclusive) the region to be accessed */
@@ -283,7 +283,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
 	    j = st_index;
 	    off = offset;
 	    n_filetypes = st_n_filetypes;
-	    frd_size = ADIOI_MIN(st_frd_size, bufsize);
+	    frd_size = MPL_MIN(st_frd_size, bufsize);
 	    while (i_offset < bufsize) {
                 if (frd_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -312,7 +312,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
                     }
 		    off = disp + flat_file->indices[j] + 
                                         n_filetypes*(ADIO_Offset)filetype_extent;
-		    frd_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+		    frd_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 		}
 	    }
 	}
@@ -330,7 +330,7 @@ void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,
 	    brd_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(frd_size, brd_size);
+		size = MPL_MIN(frd_size, brd_size);
 		if (size) {
 		    /* lseek(fd->fd_sys, off, SEEK_SET);
 		    err = read(fd->fd_sys, ((char *) buf) + i, size); */
diff --git a/src/mpi/romio/adio/common/ad_read_str_naive.c b/src/mpi/romio/adio/common/ad_read_str_naive.c
index 44abee7..b875804 100644
--- a/src/mpi/romio/adio/common/ad_read_str_naive.c
+++ b/src/mpi/romio/adio/common/ad_read_str_naive.c
@@ -192,7 +192,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
 	userbuf_off = 0;
 	f_index = st_index;
 	off = start_off;
-	frd_size = ADIOI_MIN(st_frd_size, bufsize);
+	frd_size = MPL_MIN(st_frd_size, bufsize);
 	while (userbuf_off < bufsize) {
 	    userbuf_off += frd_size;
 	    end_offset = off + frd_size - 1;
@@ -205,7 +205,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
 
 	    off = disp + flat_file->indices[f_index] + 
 	          n_filetypes*(ADIO_Offset)filetype_extent;
-	    frd_size = ADIOI_MIN(flat_file->blocklens[f_index], 
+	    frd_size = MPL_MIN(flat_file->blocklens[f_index], 
 	                         bufsize-(unsigned)userbuf_off);
 	}
 
@@ -233,7 +233,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
 	    f_index = st_index;
 	    off = start_off;
 	    n_filetypes = st_n_filetypes;
-	    frd_size = ADIOI_MIN(st_frd_size, bufsize);
+	    frd_size = MPL_MIN(st_frd_size, bufsize);
 
 	    /* while there is still space in the buffer, read more data */
 	    while (userbuf_off < bufsize) {
@@ -278,7 +278,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
 		    }
 		    off = disp + flat_file->indices[f_index] + 
                           n_filetypes*(ADIO_Offset)filetype_extent;
-		    frd_size = ADIOI_MIN(flat_file->blocklens[f_index], 
+		    frd_size = MPL_MIN(flat_file->blocklens[f_index], 
 		                         bufsize-(unsigned)userbuf_off);
 		}
 	    }
@@ -301,7 +301,7 @@ void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
 	    while (tmp_bufsize < bufsize) {
     		ADIO_Offset new_brd_size = brd_size, new_frd_size = frd_size;
 
-		size = ADIOI_MIN(frd_size, brd_size);
+		size = MPL_MIN(frd_size, brd_size);
 		if (size) {
 		    req_off = off;
 		    req_len = size;
diff --git a/src/mpi/romio/adio/common/ad_write_coll.c b/src/mpi/romio/adio/common/ad_write_coll.c
index ce4d620..b294efe 100644
--- a/src/mpi/romio/adio/common/ad_write_coll.c
+++ b/src/mpi/romio/adio/common/ad_write_coll.c
@@ -350,8 +350,8 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype
 
     for (i=0; i < nprocs; i++)
 	for (j=0; j < others_req[i].count; j++) {
-	    st_loc = ADIOI_MIN(st_loc, others_req[i].offsets[j]);
-	    end_loc = ADIOI_MAX(end_loc, (others_req[i].offsets[j]
+	    st_loc = MPL_MIN(st_loc, others_req[i].offsets[j]);
+	    end_loc = MPL_MAX(end_loc, (others_req[i].offsets[j]
 				       + others_req[i].lens[j] - 1));
 	}
 
@@ -441,7 +441,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype
 
 	for (i=0; i < nprocs; i++) count[i] = recv_size[i] = 0;
 
-	size = ADIOI_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
+	size = MPL_MIN((unsigned)coll_bufsize, end_loc-st_loc+1-done); 
 
 	for (i=0; i < nprocs; i++) {
 	    if (others_req[i].count) {
@@ -469,7 +469,7 @@ static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype
 			MPI_Address(write_buf+req_off-off, 
                                &(others_req[i].mem_ptrs[j]));
       ADIOI_Assert((off + size - req_off) == (int)(off + size - req_off));
-			recv_size[i] += (int)(ADIOI_MIN(off + size - req_off, 
+			recv_size[i] += (int)(MPL_MIN(off + size - req_off, 
                                       (unsigned)req_len));
 
 			if (off+size-req_off < (unsigned)req_len)
@@ -809,7 +809,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf,
 #define ADIOI_BUF_INCR \
 { \
     while (buf_incr) { \
-        size_in_buf = ADIOI_MIN(buf_incr, flat_buf_sz); \
+        size_in_buf = MPL_MIN(buf_incr, flat_buf_sz); \
         user_buf_idx += size_in_buf; \
         flat_buf_sz -= size_in_buf; \
         if (!flat_buf_sz) { \
@@ -830,7 +830,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf,
 #define ADIOI_BUF_COPY \
 { \
     while (size) { \
-        size_in_buf = ADIOI_MIN(size, flat_buf_sz); \
+        size_in_buf = MPL_MIN(size, flat_buf_sz); \
   ADIOI_Assert((((ADIO_Offset)(MPIU_Upint)buf) + user_buf_idx) == (ADIO_Offset)(MPIU_Upint)((MPIU_Upint)buf + user_buf_idx)); \
   ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \
         memcpy(&(send_buf[p][send_buf_idx[p]]), \
@@ -921,7 +921,7 @@ void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 	    if (send_buf_idx[p] < send_size[p]) {
 		if (curr_to_proc[p]+len > done_to_proc[p]) {
 		    if (done_to_proc[p] > curr_to_proc[p]) {
-			size = ADIOI_MIN(curr_to_proc[p] + len - 
+			size = MPL_MIN(curr_to_proc[p] + len - 
                                 done_to_proc[p], send_size[p]-send_buf_idx[p]);
 			buf_incr = done_to_proc[p] - curr_to_proc[p];
 			ADIOI_BUF_INCR
@@ -933,7 +933,7 @@ void ADIOI_Fill_send_buffer(ADIO_File fd, void *buf, ADIOI_Flatlist_node
 		        ADIOI_BUF_COPY
 		    }
 		    else {
-			size = ADIOI_MIN(len,send_size[p]-send_buf_idx[p]);
+			size = MPL_MIN(len,send_size[p]-send_buf_idx[p]);
 			buf_incr = len;
       ADIOI_Assert((curr_to_proc[p] + size) == (unsigned)((ADIO_Offset)curr_to_proc[p] + size));
 			curr_to_proc[p] += size;
diff --git a/src/mpi/romio/adio/common/ad_write_nolock.c b/src/mpi/romio/adio/common/ad_write_nolock.c
index e26474c..2e77a1f 100644
--- a/src/mpi/romio/adio/common/ad_write_nolock.c
+++ b/src/mpi/romio/adio/common/ad_write_nolock.c
@@ -261,7 +261,7 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
 	    i_offset = 0;
 	    j = st_index;
 	    off = offset;
-	    fwr_size = ADIOI_MIN(fwr_size, bufsize);
+	    fwr_size = MPL_MIN(fwr_size, bufsize);
 	    while (i_offset < bufsize) {
                 if (fwr_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -302,7 +302,7 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
 		    }
 		    off = disp + flat_file->indices[j] + 
                                         n_filetypes*(ADIO_Offset)filetype_extent;
-		    fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+		    fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 		}
 	    }
 	}
@@ -318,7 +318,7 @@ void ADIOI_NOLOCK_WriteStrided(ADIO_File fd, const void *buf, int count,
 	    bwr_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(fwr_size, bwr_size);
+		size = MPL_MIN(fwr_size, bwr_size);
 		if (size) {
 #ifdef IO_DEBUG
 		    printf("[%d/%d] nc mem nc file writing loc = %Ld sz = %d\n", 
diff --git a/src/mpi/romio/adio/common/ad_write_str.c b/src/mpi/romio/adio/common/ad_write_str.c
index 6c62a7c..21ca8e8 100644
--- a/src/mpi/romio/adio/common/ad_write_str.c
+++ b/src/mpi/romio/adio/common/ad_write_str.c
@@ -24,7 +24,7 @@
            } \
         } \
 	writebuf_off = req_off; \
-        writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
 	ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
                  ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
@@ -36,8 +36,8 @@
 	    goto fn_exit; \
 	} \
     } \
-    write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
-    ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\
+    write_sz = (unsigned) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    ADIOI_Assert((ADIO_Offset)write_sz == MPL_MIN(req_len, writebuf_off + writebuf_len - req_off));\
     memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\
     while (write_sz != req_len) { \
         ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
@@ -53,7 +53,7 @@
         req_len -= write_sz; \
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
-        writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
         ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
                   ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
@@ -64,7 +64,7 @@
 					       "**iowsrc", 0); \
 	    goto fn_exit; \
 	} \
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
     } \
 }
@@ -85,10 +85,10 @@
             goto fn_exit; \
         } \
 	writebuf_off = req_off; \
-        writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
     } \
-    write_sz = (unsigned) (ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
-    ADIOI_Assert((ADIO_Offset)write_sz == ADIOI_MIN(req_len, writebuf_off + writebuf_len - req_off));\
+    write_sz = (unsigned) (MPL_MIN(req_len, writebuf_off + writebuf_len - req_off)); \
+    ADIOI_Assert((ADIO_Offset)write_sz == MPL_MIN(req_len, writebuf_off + writebuf_len - req_off));\
     memcpy(writebuf+req_off-writebuf_off, (char *)buf +userbuf_off, write_sz);\
     while (write_sz != req_len) { \
         ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
@@ -103,8 +103,8 @@
         req_len -= write_sz; \
         userbuf_off += write_sz; \
         writebuf_off += writebuf_len; \
-        writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
-        write_sz = ADIOI_MIN(req_len, writebuf_len); \
+        writebuf_len = (unsigned) (MPL_MIN(max_bufsize,end_offset-writebuf_off+1));\
+        write_sz = MPL_MIN(req_len, writebuf_len); \
         memcpy(writebuf, (char *)buf + userbuf_off, write_sz);\
     } \
 }
@@ -189,7 +189,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
 	end_offset = off + bufsize - 1;
         writebuf_off = off;
         writebuf = (char *) ADIOI_Malloc(max_bufsize);
-        writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize, end_offset-writebuf_off+1));
+        writebuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset-writebuf_off+1));
 
 /* if atomicity is true, lock the region to be accessed */
 	if (fd->atomicity) 
@@ -321,7 +321,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
 	i_offset = 0;
 	j = st_index;
 	off = offset;
-	fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	fwr_size = MPL_MIN(st_fwr_size, bufsize);
 	while (i_offset < bufsize) {
 	    i_offset += fwr_size;
 	    end_offset = off + fwr_size - 1;
@@ -335,7 +335,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
 
 	    off = disp + flat_file->indices[j] + 
 		    n_filetypes*(ADIO_Offset)filetype_extent;
-	    fwr_size = ADIOI_MIN(flat_file->blocklens[j], bufsize-i_offset);
+	    fwr_size = MPL_MIN(flat_file->blocklens[j], bufsize-i_offset);
 	}
 
 /* if atomicity is true, lock the region to be accessed */
@@ -356,7 +356,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
 	    j = st_index;
 	    off = offset;
 	    n_filetypes = st_n_filetypes;
-	    fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	    fwr_size = MPL_MIN(st_fwr_size, bufsize);
 	    while (i_offset < bufsize) {
                 if (fwr_size) { 
                     /* TYPE_UB and TYPE_LB can result in 
@@ -385,7 +385,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
                     }
 		    off = disp + flat_file->indices[j] + 
                                     n_filetypes*(ADIO_Offset)filetype_extent;
-		    fwr_size = ADIOI_MIN(flat_file->blocklens[j], 
+		    fwr_size = MPL_MIN(flat_file->blocklens[j], 
 				    bufsize-i_offset);
 		}
 	    }
@@ -404,7 +404,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
 	    bwr_size = flat_buf->blocklens[0];
 
 	    while (num < bufsize) {
-		size = ADIOI_MIN(fwr_size, bwr_size);
+		size = MPL_MIN(fwr_size, bwr_size);
 		if (size) {
 		    /* lseek(fd->fd_sys, off, SEEK_SET);
 		    err = write(fd->fd_sys, ((char *) buf) + i_offset, size); */
diff --git a/src/mpi/romio/adio/common/ad_write_str_naive.c b/src/mpi/romio/adio/common/ad_write_str_naive.c
index f004cd8..06e96bd 100644
--- a/src/mpi/romio/adio/common/ad_write_str_naive.c
+++ b/src/mpi/romio/adio/common/ad_write_str_naive.c
@@ -192,7 +192,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
 	userbuf_off = 0;
 	f_index = st_index;
 	off = start_off;
-	fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	fwr_size = MPL_MIN(st_fwr_size, bufsize);
 	while (userbuf_off < bufsize) {
 	    userbuf_off += fwr_size;
 	    end_offset = off + fwr_size - 1;
@@ -205,7 +205,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
 
 	    off = disp + flat_file->indices[f_index] + 
 	          n_filetypes*(ADIO_Offset)filetype_extent;
-	    fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], 
+	    fwr_size = MPL_MIN(flat_file->blocklens[f_index], 
 	                         bufsize-(unsigned)userbuf_off);
 	}
 
@@ -233,7 +233,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
 	    f_index = st_index;
 	    off = start_off;
 	    n_filetypes = st_n_filetypes;
-	    fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
+	    fwr_size = MPL_MIN(st_fwr_size, bufsize);
 
 	    /* while there is still space in the buffer, write more data */
 	    while (userbuf_off < bufsize) {
@@ -278,7 +278,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
 		    }
 		    off = disp + flat_file->indices[f_index] + 
                           n_filetypes*(ADIO_Offset)filetype_extent;
-		    fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], 
+		    fwr_size = MPL_MIN(flat_file->blocklens[f_index], 
 		                         bufsize-(unsigned)userbuf_off);
 		}
 	    }
@@ -301,7 +301,7 @@ void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, const void *buf, int count,
 	    while (tmp_bufsize < bufsize) {
     		ADIO_Offset new_bwr_size = bwr_size, new_fwr_size = fwr_size;
 
-		size = ADIOI_MIN(fwr_size, bwr_size);
+		size = MPL_MIN(fwr_size, bwr_size);
 		if (size) {
 		    req_off = off;
 		    req_len = size;
diff --git a/src/mpi/romio/adio/common/onesided_aggregation.c b/src/mpi/romio/adio/common/onesided_aggregation.c
index 305e0f7..665659a 100644
--- a/src/mpi/romio/adio/common/onesided_aggregation.c
+++ b/src/mpi/romio/adio/common/onesided_aggregation.c
@@ -303,11 +303,11 @@ printf("ADIOI_OneSidedWriteAggregation started on rank %d\n",myrank);
 #ifdef onesidedtrace
 printf("end_offsets[%d] is %ld st_offsets[%d] is %ld\n",j,end_offsets[j],j,st_offsets[j]);
 #endif
-        lastFileOffset = ADIOI_MAX(lastFileOffset,end_offsets[j]);
+        lastFileOffset = MPL_MAX(lastFileOffset,end_offsets[j]);
         if (firstFileOffset == -1)
           firstFileOffset = st_offsets[j];
         else
-          firstFileOffset = ADIOI_MIN(firstFileOffset,st_offsets[j]);
+          firstFileOffset = MPL_MIN(firstFileOffset,st_offsets[j]);
     }
 
     int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */
@@ -1341,11 +1341,11 @@ printf("ADIOI_OneSidedReadAggregation started on rank %d\n",myrank);
 #ifdef onesidedtrace
 printf("end_offsets[%d] is %ld st_offsets[%d] is %ld\n",j,end_offsets[j],j,st_offsets[j]);
 #endif
-        lastFileOffset = ADIOI_MAX(lastFileOffset,end_offsets[j]);
+        lastFileOffset = MPL_MAX(lastFileOffset,end_offsets[j]);
         if (firstFileOffset == -1)
           firstFileOffset = st_offsets[j];
         else
-          firstFileOffset = ADIOI_MIN(firstFileOffset,st_offsets[j]);
+          firstFileOffset = MPL_MIN(firstFileOffset,st_offsets[j]);
     }
 
     int myAggRank = -1; /* if I am an aggregor this is my index into fd->hints->ranklist */
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index 409f137..b4e0d3c 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -219,8 +219,6 @@ struct ADIOI_Fns_struct {
 #define ADIOI_READ                26
 #define ADIOI_WRITE               27
 
-#define ADIOI_MIN(a, b) ((a) < (b) ? (a) : (b))
-#define ADIOI_MAX(a, b) ((a) > (b) ? (a) : (b))
 /* thanks stackoverflow:
  * http://stackoverflow.com/questions/3982348/implement-generic-swap-macro-in-c */
 #define ADIOI_SWAP(x, y, T) do { T temp##x##y = x; x = y; y = temp##x##y; } while (0);
diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c
index 08100fc..99c82dd 100644
--- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c
+++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c
@@ -66,14 +66,6 @@ char MPID_nem_hostname[MAX_HOSTNAME_LEN] = "UNKNOWN";
 static int get_local_procs(MPIDI_PG_t *pg, int our_pg_rank, int *num_local_p,
                            int **local_procs_p, int *local_rank_p);
 
-#ifndef MIN
-#define MIN( a , b ) ((a) >  (b)) ? (b) : (a)
-#endif /* MIN */
-
-#ifndef MAX
-#define MAX( a , b ) ((a) >= (b)) ? (a) : (b)
-#endif /* MAX */
-
 char *MPID_nem_asymm_base_addr = 0;
 
 /* used by mpid_nem_inline.h and mpid_nem_finalize.c */
@@ -246,7 +238,7 @@ MPID_nem_init(int pg_rank, MPIDI_PG_t *pg_p, int has_parent ATTRIBUTE((unused)))
 #endif  /*FORCE_ASYM */
 
     /* Request fastboxes region */
-    mpi_errno = MPIDI_CH3I_Seg_alloc(MAX((num_local*((num_local-1)*sizeof(MPID_nem_fastbox_t))), MPID_NEM_ASYMM_NULL_VAL),
+    mpi_errno = MPIDI_CH3I_Seg_alloc(MPL_MAX((num_local*((num_local-1)*sizeof(MPID_nem_fastbox_t))), MPID_NEM_ASYMM_NULL_VAL),
                                      (void **)&fastboxes_p);
     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     
diff --git a/src/mpid/ch3/include/mpid_rma_issue.h b/src/mpid/ch3/include/mpid_rma_issue.h
index 5fa65dd..82ddee4 100644
--- a/src/mpid/ch3/include/mpid_rma_issue.h
+++ b/src/mpid/ch3/include/mpid_rma_issue.h
@@ -571,7 +571,7 @@ static int issue_acc_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
         }
 
         stream_offset = j * stream_elem_count * predefined_dtp_size;
-        stream_size = MPIR_MIN(stream_elem_count * predefined_dtp_size, rest_len);
+        stream_size = MPL_MIN(stream_elem_count * predefined_dtp_size, rest_len);
         rest_len -= stream_size;
 
         /* Set extended packet header if needed. */
@@ -791,7 +791,7 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
         get_accum_pkt->request_handle = resp_req->handle;
 
         stream_offset = j * stream_elem_count * predefined_dtp_size;
-        stream_size = MPIR_MIN(stream_elem_count * predefined_dtp_size, rest_len);
+        stream_size = MPL_MIN(stream_elem_count * predefined_dtp_size, rest_len);
         rest_len -= stream_size;
 
         /* Set extended packet header if needed. */
diff --git a/src/mpid/ch3/include/mpid_rma_shm.h b/src/mpid/ch3/include/mpid_rma_shm.h
index 1e82d3e..dcee36c 100644
--- a/src/mpid/ch3/include/mpid_rma_shm.h
+++ b/src/mpid/ch3/include/mpid_rma_shm.h
@@ -367,7 +367,7 @@ static inline int MPIDI_CH3I_Shm_acc_op(const void *origin_addr, int origin_coun
         MPI_Aint stream_offset, stream_size, stream_count;
 
         stream_offset = i * stream_elem_count * predefined_dtp_size;
-        stream_size = MPIR_MIN(stream_elem_count * predefined_dtp_size, rest_len);
+        stream_size = MPL_MIN(stream_elem_count * predefined_dtp_size, rest_len);
         stream_count = stream_size / predefined_dtp_size;
         rest_len -= stream_size;
 
@@ -514,7 +514,7 @@ static inline int MPIDI_CH3I_Shm_get_acc_op(const void *origin_addr, int origin_
         MPI_Aint stream_offset, stream_size, stream_count;
 
         stream_offset = i * stream_elem_count * predefined_dtp_size;
-        stream_size = MPIR_MIN(stream_elem_count * predefined_dtp_size, rest_len);
+        stream_size = MPL_MIN(stream_elem_count * predefined_dtp_size, rest_len);
         stream_count = stream_size / predefined_dtp_size;
         rest_len -= stream_size;
 
diff --git a/src/mpid/ch3/include/mpidrma.h b/src/mpid/ch3/include/mpidrma.h
index 1b1f64f..97d738d 100644
--- a/src/mpid/ch3/include/mpidrma.h
+++ b/src/mpid/ch3/include/mpidrma.h
@@ -387,7 +387,7 @@ static inline int enqueue_lock_origin(MPID_Win * win_ptr, MPIDI_VC_t * vc,
             if (op != MPI_NO_OP) {
                 stream_elem_count = MPIDI_CH3U_SRBuf_size / type_extent;
                 total_len = type_size * target_count;
-                recv_data_sz = MPIR_MIN(total_len, type_size * stream_elem_count);
+                recv_data_sz = MPL_MIN(total_len, type_size * stream_elem_count);
                 buf_size = type_extent * (recv_data_sz / type_size);
             }
         }
diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c
index 9973d89..4ef265e 100644
--- a/src/mpid/ch3/src/ch3u_handle_recv_req.c
+++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c
@@ -297,7 +297,7 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq
     total_len = type_size * rreq->dev.user_count;
     MPID_Datatype_get_size_macro(basic_type, predef_dtp_size);
     MPID_Datatype_get_extent_macro(basic_type, extent);
-    stream_data_len = MPIR_MIN(total_len - (stream_offset / extent) * predef_dtp_size,
+    stream_data_len = MPL_MIN(total_len - (stream_offset / extent) * predef_dtp_size,
                                (MPIDI_CH3U_SRBuf_size / extent) * predef_dtp_size);
 
     predef_count = stream_data_len / predef_dtp_size;
@@ -692,7 +692,7 @@ int MPIDI_CH3_ReqHandler_AccumMetadataRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((un
     rest_len = total_len - stream_offset;
     stream_elem_count = MPIDI_CH3U_SRBuf_size / basic_type_extent;
 
-    rreq->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * basic_type_size);
+    rreq->dev.recv_data_sz = MPL_MIN(rest_len, stream_elem_count * basic_type_size);
 
     rreq->dev.segment_ptr = MPID_Segment_alloc();
     MPIR_ERR_CHKANDJUMP1((rreq->dev.segment_ptr == NULL), mpi_errno, MPI_ERR_OTHER, "**nomem",
@@ -822,7 +822,7 @@ int MPIDI_CH3_ReqHandler_GaccumMetadataRecvComplete(MPIDI_VC_t * vc,
         rest_len = total_len - stream_offset;
         stream_elem_count = MPIDI_CH3U_SRBuf_size / basic_type_extent;
 
-        rreq->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * basic_type_size);
+        rreq->dev.recv_data_sz = MPL_MIN(rest_len, stream_elem_count * basic_type_size);
 
         rreq->dev.segment_ptr = MPID_Segment_alloc();
         MPIR_ERR_CHKANDJUMP1((rreq->dev.segment_ptr == NULL), mpi_errno, MPI_ERR_OTHER, "**nomem",
@@ -1322,7 +1322,7 @@ static inline int perform_acc_in_lock_queue(MPID_Win * win_ptr,
         MPID_Datatype_get_extent_macro(acc_pkt->datatype, type_extent);
 
         total_len = type_size * acc_pkt->count;
-        recv_count = MPIR_MIN((total_len / type_size), (MPIDI_CH3U_SRBuf_size / type_extent));
+        recv_count = MPL_MIN((total_len / type_size), (MPIDI_CH3U_SRBuf_size / type_extent));
         MPIU_Assert(recv_count > 0);
 
         /* Note: here stream_offset is 0 because when piggybacking LOCK, we must use
@@ -1460,7 +1460,7 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win * win_ptr,
     MPID_Datatype_get_extent_macro(get_accum_pkt->datatype, type_extent);
 
     total_len = type_size * get_accum_pkt->count;
-    recv_count = MPIR_MIN((total_len / type_size), (MPIDI_CH3U_SRBuf_size / type_extent));
+    recv_count = MPL_MIN((total_len / type_size), (MPIDI_CH3U_SRBuf_size / type_extent));
     MPIU_Assert(recv_count > 0);
 
     sreq->dev.user_buf = (void *) MPIU_Malloc(recv_count * type_size);
diff --git a/src/mpid/ch3/src/ch3u_rma_pkthandler.c b/src/mpid/ch3/src/ch3u_rma_pkthandler.c
index 395ddae..c6821b4 100644
--- a/src/mpid/ch3/src/ch3u_rma_pkthandler.c
+++ b/src/mpid/ch3/src/ch3u_rma_pkthandler.c
@@ -771,7 +771,7 @@ int MPIDI_CH3_PktHandler_Accumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
                 total_len = type_size * accum_pkt->count;
                 stream_elem_count = MPIDI_CH3U_SRBuf_size / extent;
 
-                req->dev.recv_data_sz = MPIR_MIN(total_len, stream_elem_count * type_size);
+                req->dev.recv_data_sz = MPL_MIN(total_len, stream_elem_count * type_size);
                 MPIU_Assert(req->dev.recv_data_sz > 0);
 
                 mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len, &complete);
@@ -1057,7 +1057,7 @@ int MPIDI_CH3_PktHandler_GetAccumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
                     total_len = type_size * get_accum_pkt->count;
                     stream_elem_count = MPIDI_CH3U_SRBuf_size / extent;
 
-                    req->dev.recv_data_sz = MPIR_MIN(total_len, stream_elem_count * type_size);
+                    req->dev.recv_data_sz = MPL_MIN(total_len, stream_elem_count * type_size);
                     MPIU_Assert(req->dev.recv_data_sz > 0);
 
                     mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len, &complete);
@@ -1682,7 +1682,7 @@ int MPIDI_CH3_PktHandler_Get_AccumResp(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
         rest_len = total_len - contig_stream_offset;
         stream_elem_count = MPIDI_CH3U_SRBuf_size / basic_type_extent;
 
-        req->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * basic_type_size);
+        req->dev.recv_data_sz = MPL_MIN(rest_len, stream_elem_count * basic_type_size);
         real_stream_offset = (contig_stream_offset / basic_type_size) * basic_type_extent;
 
         if (MPIR_DATATYPE_IS_PREDEFINED(req->dev.datatype)) {
diff --git a/src/mpid/ch3/src/mpid_rma.c b/src/mpid/ch3/src/mpid_rma.c
index 6c570d4..872d514 100644
--- a/src/mpid/ch3/src/mpid_rma.c
+++ b/src/mpid/ch3/src/mpid_rma.c
@@ -332,7 +332,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
     }
 
     win_target_pool_size =
-        MPIR_MIN(MPIR_CVAR_CH3_RMA_TARGET_WIN_POOL_SIZE, MPIR_Comm_size(win_comm_ptr));
+        MPL_MIN(MPIR_CVAR_CH3_RMA_TARGET_WIN_POOL_SIZE, MPIR_Comm_size(win_comm_ptr));
     MPIU_CHKPMEM_MALLOC((*win_ptr)->target_pool_start, MPIDI_RMA_Target_t *,
                         sizeof(MPIDI_RMA_Target_t) * win_target_pool_size, mpi_errno,
                         "RMA target pool");
@@ -342,7 +342,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
         MPL_DL_APPEND((*win_ptr)->target_pool_head, &((*win_ptr)->target_pool_start[i]));
     }
 
-    (*win_ptr)->num_slots = MPIR_MIN(MPIR_CVAR_CH3_RMA_SLOTS_SIZE, MPIR_Comm_size(win_comm_ptr));
+    (*win_ptr)->num_slots = MPL_MIN(MPIR_CVAR_CH3_RMA_SLOTS_SIZE, MPIR_Comm_size(win_comm_ptr));
     MPIU_CHKPMEM_MALLOC((*win_ptr)->slots, MPIDI_RMA_Slot_t *,
                         sizeof(MPIDI_RMA_Slot_t) * (*win_ptr)->num_slots, mpi_errno, "RMA slots");
     for (i = 0; i < (*win_ptr)->num_slots; i++) {
diff --git a/src/mpid/common/datatype/mpid_type_create_pairtype.c b/src/mpid/common/datatype/mpid_type_create_pairtype.c
index 3c6fad8..e0de9ce 100644
--- a/src/mpid/common/datatype/mpid_type_create_pairtype.c
+++ b/src/mpid/common/datatype/mpid_type_create_pairtype.c
@@ -23,7 +23,7 @@
 	true_ub_ = (MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char *) &foo.b -     \
                                                   (char *) &foo.a)) +   \
                   (MPI_Aint) sizeof(foo.b);                             \
-	alignsize_ = MPIR_MAX(MPID_Datatype_get_basic_size(mt1_),	\
+	alignsize_ = MPL_MAX(MPID_Datatype_get_basic_size(mt1_),	\
                              MPID_Datatype_get_basic_size(mt2_));	\
     }
 
@@ -142,31 +142,31 @@ int MPID_Type_create_pairtype(MPI_Datatype type,
 	case MPI_SHORT_INT:
 	case MPI_LONG_INT:
 #ifdef HAVE_MAX_INTEGER_ALIGNMENT
-	    new_dtp->alignsize       = MPIR_MIN(new_dtp->alignsize,
+	    new_dtp->alignsize       = MPL_MIN(new_dtp->alignsize,
 						HAVE_MAX_INTEGER_ALIGNMENT);
 #endif
 	    break;
 	case MPI_FLOAT_INT:
 #ifdef HAVE_MAX_FP_ALIGNMENT
-	    new_dtp->alignsize       = MPIR_MIN(new_dtp->alignsize,
+	    new_dtp->alignsize       = MPL_MIN(new_dtp->alignsize,
 						HAVE_MAX_FP_ALIGNMENT);
 #endif
 	    break;
 	case MPI_DOUBLE_INT:
 #ifdef HAVE_MAX_DOUBLE_FP_ALIGNMENT
-	    new_dtp->alignsize       = MPIR_MIN(new_dtp->alignsize,
+	    new_dtp->alignsize       = MPL_MIN(new_dtp->alignsize,
 						HAVE_MAX_DOUBLE_FP_ALIGNMENT);
 #elif defined(HAVE_MAX_FP_ALIGNMENT)
-	    new_dtp->alignsize       = MPIR_MIN(new_dtp->alignsize,
+	    new_dtp->alignsize       = MPL_MIN(new_dtp->alignsize,
 						HAVE_MAX_FP_ALIGNMENT);
 #endif
 	    break;
 	case MPI_LONG_DOUBLE_INT:
 #ifdef HAVE_MAX_LONG_DOUBLE_FP_ALIGNMENT
-	    new_dtp->alignsize       = MPIR_MIN(new_dtp->alignsize,
+	    new_dtp->alignsize       = MPL_MIN(new_dtp->alignsize,
 					HAVE_MAX_LONG_DOUBLE_FP_ALIGNMENT);
 #elif defined(HAVE_MAX_FP_ALIGNMENT)
-	    new_dtp->alignsize       = MPIR_MIN(new_dtp->alignsize,
+	    new_dtp->alignsize       = MPL_MIN(new_dtp->alignsize,
 						HAVE_MAX_FP_ALIGNMENT);
 #endif
 	    break;
diff --git a/src/mpid/pamid/src/pamix/pamix.c b/src/mpid/pamid/src/pamix/pamix.c
index a24b59f..4077318 100644
--- a/src/mpid/pamid/src/pamix/pamix.c
+++ b/src/mpid/pamid/src/pamix/pamix.c
@@ -33,10 +33,6 @@
 #define PAMIX_assert(x)        assert(x)
 #endif
 
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif
-
 #ifdef __BGQ__
 #define __BG__
 #include <spi/include/kernel/location.h>
@@ -218,9 +214,9 @@ PAMIX_Dispatch_set(pami_context_t                  context[],
 
     size_t size;
     size = PAMIX_Dispatch_query(context[i], dispatch, PAMI_DISPATCH_SEND_IMMEDIATE_MAX).value.intval;
-    last_immediate_max = MIN(size, last_immediate_max);
+    last_immediate_max = MPL_MIN(size, last_immediate_max);
     size = PAMIX_Dispatch_query(context[i], dispatch, PAMI_DISPATCH_RECV_IMMEDIATE_MAX).value.intval;
-    last_immediate_max = MIN(size, last_immediate_max);
+    last_immediate_max = MPL_MIN(size, last_immediate_max);
   }
 
   if (immediate_max != NULL)
diff --git a/src/mpl/include/mpl.h b/src/mpl/include/mpl.h
index 0ceb887..66f603a 100644
--- a/src/mpl/include/mpl.h
+++ b/src/mpl/include/mpl.h
@@ -85,6 +85,9 @@
 #define MPL_QUOTE(A) MPL_QUOTE2(A)
 #define MPL_QUOTE2(A) #A
 
+#define MPL_MAX(a,b)    (((a) > (b)) ? (a) : (b))
+#define MPL_MIN(a,b)    (((a) < (b)) ? (a) : (b))
+
 /* This macro is used to silence warnings from the Mac OS X linker when
  * an object file "has no symbols".  The unused attribute prevents a
  * warning about the unused dummy variable while the used attribute
diff --git a/src/pmi/pmi2/poe/poe2pmi.c b/src/pmi/pmi2/poe/poe2pmi.c
index 7b01091..47bd865 100644
--- a/src/pmi/pmi2/poe/poe2pmi.c
+++ b/src/pmi/pmi2/poe/poe2pmi.c
@@ -357,7 +357,7 @@ int getchildren(int iam, double alpha,int gsize, int *children,
 
    while( p > 1 ) {
 
-     pbig = MAX(1,MIN((int) (alpha*(double)p), p-1));
+     pbig = MPL_MAX(1,MPL_MIN((int) (alpha*(double)p), p-1));
 
      if ( fakeme == 0 ) {
 
diff --git a/src/util/type/mpiu_type_defs.h b/src/util/type/mpiu_type_defs.h
index 5c3bc01..74a42c7 100644
--- a/src/util/type/mpiu_type_defs.h
+++ b/src/util/type/mpiu_type_defs.h
@@ -51,9 +51,6 @@
 #define MPIU_UNREFERENCED_ARG(a)
 #endif
 
-#define MPIU_MAX(a,b)    (((a) > (b)) ? (a) : (b))
-#define MPIU_MIN(a,b)    (((a) < (b)) ? (a) : (b))
-
 #include "mpl.h"
 
 typedef MPIU_SIZE_T MPIU_Size_t;

http://git.mpich.org/mpich.git/commitdiff/88ca8ae7ac344c9b216f80da87bb10c8ffb916a2

commit 88ca8ae7ac344c9b216f80da87bb10c8ffb916a2
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Mon Dec 21 09:23:06 2015 -0600

    use MPL_snprintf everywhere
    
    Removes component specific namespacing and duplicate implementations
    from various parts of the code.
      - HYDU_Snprintf  -> MPL_snprintf
      - PMI2U_Snprintf -> MPL_snprintf
      - ADIOI_Snprintf -> MPL_snprintf
    
    Signed-off-by: Yanfei Guo <yguo at anl.gov>

diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_hints.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_hints.c
index 7af0a0c..fd6cdbc 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_hints.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_hints.c
@@ -108,7 +108,7 @@ void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	/* number of processes that perform I/O in collective I/O */
 	MPI_Comm_size(fd->comm, &nprocs);
 	nprocs_is_valid = 1;
-	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
+	MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
 	ADIOI_Info_set(info, "cb_nodes", value);
 	fd->hints->cb_nodes = -1;
 
diff --git a/src/mpi/romio/adio/ad_gridftp/ad_gridftp_resize.c b/src/mpi/romio/adio/ad_gridftp/ad_gridftp_resize.c
index 96c0460..2f3b9ce 100644
--- a/src/mpi/romio/adio/ad_gridftp/ad_gridftp_resize.c
+++ b/src/mpi/romio/adio/ad_gridftp/ad_gridftp_resize.c
@@ -150,7 +150,7 @@ void ADIOI_GRIDFTP_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
 
 	    urllen=strlen(fd->filename);
 	    urlold=(char *)ADIOI_Malloc(urllen+5);
-	    ADIOI_Snprintf(urlold,urllen+5,"%s.old",fd->filename);
+	    MPL_snprintf(urlold,urllen+5,"%s.old",fd->filename);
 	    resize_done=GLOBUS_FALSE;
 	    resize_success=GLOBUS_FALSE;
 	    if ( (result=globus_ftp_client_move(&(gridftp_fh[fd->fd_sys]),
diff --git a/src/mpi/romio/adio/ad_panfs/ad_panfs_open.c b/src/mpi/romio/adio/ad_panfs/ad_panfs_open.c
index d5374eb..4a8fafc 100644
--- a/src/mpi/romio/adio/ad_panfs/ad_panfs_open.c
+++ b/src/mpi/romio/adio/ad_panfs/ad_panfs_open.c
@@ -295,36 +295,36 @@ void ADIOI_PANFS_Open(ADIO_File fd, int *error_code)
         }
         else 
         {
-            ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.agg_type);
+            MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.agg_type);
             ADIOI_Info_set(fd->info, "panfs_layout_type", temp_buffer);
             if (file_query_args.layout.layout_is_valid == 1)
             {
                 switch (file_query_args.layout.agg_type)
                 {
                     case PAN_FS_CLIENT_LAYOUT_TYPE__RAID0:
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.stripe_unit);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.stripe_unit);
                         ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.total_num_comps);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid0.total_num_comps);
                         ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
                         break;
                     case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE:
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit);
                         ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_width);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_width);
                         ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.parity_stripe_depth);
                         ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.total_num_comps);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.total_num_comps);
                         ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.layout_visit_policy);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid1_5_parity_stripe.layout_visit_policy);
                         ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer);
                         break;
                     case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10:
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.stripe_unit);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.stripe_unit);
                         ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.total_num_comps);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.total_num_comps);
                         ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
-                        ADIOI_Snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.layout_visit_policy);
+                        MPL_snprintf(temp_buffer,TEMP_BUFFER_SIZE,"%u",file_query_args.layout.u.raid10.layout_visit_policy);
                         ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer);
                         break;
                     case PAN_FS_CLIENT_LAYOUT_TYPE__INVALID:
diff --git a/src/mpi/romio/adio/ad_panfs/ad_panfs_open6.c b/src/mpi/romio/adio/ad_panfs/ad_panfs_open6.c
index 6906ff0..9876878 100644
--- a/src/mpi/romio/adio/ad_panfs/ad_panfs_open6.c
+++ b/src/mpi/romio/adio/ad_panfs/ad_panfs_open6.c
@@ -361,60 +361,60 @@ void ADIOI_PANFS_Open6(ADIO_File fd, int *error_code)
             ADIOI_Info_set(fd->info, "panfs_layout_type", "PAN_FS_CLIENT_LAYOUT_TYPE__INVALID");
         }
         else {
-            ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", file_query_args.layout.agg_type);
+            MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u", file_query_args.layout.agg_type);
             ADIOI_Info_set(fd->info, "panfs_layout_type", temp_buffer);
             if (file_query_args.layout.layout_is_valid == 1) {
                 switch (file_query_args.layout.agg_type) {
                 case PAN_FS_CLIENT_LAYOUT_TYPE__RAIDN_PARITY_STRIPE:
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raidn_parity_stripe.stripe_unit);
                     ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raidn_parity_stripe.
                                    parity_stripe_width);
                     ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raidn_parity_stripe.
                                    parity_stripe_depth);
                     ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raidn_parity_stripe.total_num_comps);
                     ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raidn_parity_stripe.max_faults);
                     ADIOI_Info_set(fd->info, "panfs_layout_max_faults", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raidn_parity_stripe.encoding);
                     ADIOI_Info_set(fd->info, "panfs_layout_encoding", temp_buffer);
                     break;
                 case PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE:
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid1_5_parity_stripe.stripe_unit);
                     ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid1_5_parity_stripe.
                                    parity_stripe_width);
                     ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid1_5_parity_stripe.
                                    parity_stripe_depth);
                     ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid1_5_parity_stripe.total_num_comps);
                     ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid1_5_parity_stripe.
                                    layout_visit_policy);
                     ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer);
                     break;
                 case PAN_FS_CLIENT_LAYOUT_TYPE__RAID10:
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid10.stripe_unit);
                     ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid10.total_num_comps);
                     ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", temp_buffer);
-                    ADIOI_Snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
+                    MPL_snprintf(temp_buffer, TEMP_BUFFER_SIZE, "%u",
                                    file_query_args.layout.u.raid10.layout_visit_policy);
                     ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", temp_buffer);
                     break;
diff --git a/src/mpi/romio/adio/ad_pfs/ad_pfs_open.c b/src/mpi/romio/adio/ad_pfs/ad_pfs_open.c
index f814b7c..eccf672 100644
--- a/src/mpi/romio/adio/ad_pfs/ad_pfs_open.c
+++ b/src/mpi/romio/adio/ad_pfs/ad_pfs_open.c
@@ -60,13 +60,13 @@ void ADIOI_PFS_Open(ADIO_File fd, int *error_code)
 	err = fcntl(fd->fd_sys, F_GETSATTR, &attr);
 
 	if (!err) {
-	    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sunitsize);
+	    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sunitsize);
 	    ADIOI_Info_set(fd->info, "striping_unit", value);
 
-	    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sfactor);
+	    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_sfactor);
 	    ADIOI_Info_set(fd->info, "striping_factor", value);
 
-	    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_start_sdir);
+	    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", attr.s_start_sdir);
 	    ADIOI_Info_set(fd->info, "start_iodevice", value);
 	}
 	ADIOI_Free(value);
diff --git a/src/mpi/romio/adio/ad_piofs/ad_piofs_open.c b/src/mpi/romio/adio/ad_piofs/ad_piofs_open.c
index e02e90c..4b60daa 100644
--- a/src/mpi/romio/adio/ad_piofs/ad_piofs_open.c
+++ b/src/mpi/romio/adio/ad_piofs/ad_piofs_open.c
@@ -48,13 +48,13 @@ void ADIOI_PIOFS_Open(ADIO_File fd, int *error_code)
 	err = piofsioctl(fd->fd_sys, PIOFS_FSTAT, &piofs_fstat);
 
 	if (!err) {
-	    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_bsu);
+	    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_bsu);
 	    ADIOI_Info_set(fd->info, "striping_unit", value);
 
-	    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_cells);
+	    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_cells);
 	    ADIOI_Info_set(fd->info, "striping_factor", value);
 
-	    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_base_node);
+	    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", piofs_fstat.st_base_node);
 	    ADIOI_Info_set(fd->info, "start_iodevice", value);
 	}
 	ADIOI_Free(value);
diff --git a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_open.c b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_open.c
index c4fa288..6773a27 100644
--- a/src/mpi/romio/adio/ad_pvfs/ad_pvfs_open.c
+++ b/src/mpi/romio/adio/ad_pvfs/ad_pvfs_open.c
@@ -70,11 +70,11 @@ void ADIOI_PVFS_Open(ADIO_File fd, int *error_code)
 
     if (fd->fd_sys != -1) {
 	pvfs_ioctl(fd->fd_sys, GETMETA, &pstat);
-	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.pcount);
+	MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.pcount);
 	ADIOI_Info_set(fd->info, "striping_factor", value);
-	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.ssize);
+	MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.ssize);
 	ADIOI_Info_set(fd->info, "striping_unit", value);
-	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.base);
+	MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", pstat.base);
 	ADIOI_Info_set(fd->info, "start_iodevice", value);
     }
 
diff --git a/src/mpi/romio/adio/common/ad_hints.c b/src/mpi/romio/adio/common/ad_hints.c
index 1bc74f1..869db03 100644
--- a/src/mpi/romio/adio/common/ad_hints.c
+++ b/src/mpi/romio/adio/common/ad_hints.c
@@ -72,7 +72,7 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	fd->hints->cb_config_list = NULL;
 
 	/* number of processes that perform I/O in collective I/O */
-	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
+	MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
 	ADIOI_Info_set(info, "cb_nodes", value);
 	fd->hints->cb_nodes = nprocs;
 
@@ -215,7 +215,7 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 		/* can't ask for more aggregators than mpi processes, though it
 		 * might be interesting to think what such oversubscription
 		 * might mean... someday */
-		ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
+		MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
 		ADIOI_Info_set(info, "cb_nodes", value);
 		fd->hints->cb_nodes = nprocs;
 	    }
diff --git a/src/mpi/romio/adio/common/ad_open.c b/src/mpi/romio/adio/common/ad_open.c
index 04468de..75f8e0a 100644
--- a/src/mpi/romio/adio/common/ad_open.c
+++ b/src/mpi/romio/adio/common/ad_open.c
@@ -298,7 +298,7 @@ static int build_cb_config_list(ADIO_File fd,
 	fd->hints->cb_nodes = rank_ct;
 	/* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR FS-INDEP. */
 	value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
-	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", rank_ct);
+	MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", rank_ct);
 	ADIOI_Info_set(fd->info, "cb_nodes", value);
 	ADIOI_Free(value);
     }
diff --git a/src/mpi/romio/adio/common/cb_config_list.c b/src/mpi/romio/adio/common/cb_config_list.c
index 626709f..1c1fef7 100644
--- a/src/mpi/romio/adio/common/cb_config_list.c
+++ b/src/mpi/romio/adio/common/cb_config_list.c
@@ -92,7 +92,7 @@ int ADIOI_cb_bcast_rank_map(ADIO_File fd)
     /* TEMPORARY -- REMOVE WHEN NO LONGER UPDATING INFO FOR
      * FS-INDEP. */
     value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
-    ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", fd->hints->cb_nodes);
+    MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", fd->hints->cb_nodes);
     ADIOI_Info_set(fd->info, "cb_nodes", value);
     p = value;
     /* the (by MPI rank) list of aggregators can be larger than
@@ -101,7 +101,7 @@ int ADIOI_cb_bcast_rank_map(ADIO_File fd)
      * end in the truncate case */
     for (i=0; i< fd->hints->cb_nodes; i++) {
         int incr, remain = (MPI_MAX_INFO_VAL) - (p-value);
-        incr = ADIOI_Snprintf(p, remain, "%d ", fd->hints->ranklist[i]);
+        incr = MPL_snprintf(p, remain, "%d ", fd->hints->ranklist[i]);
     if (incr >= remain) break;
         p += incr;
     }
diff --git a/src/mpi/romio/adio/common/shfp_fname.c b/src/mpi/romio/adio/common/shfp_fname.c
index dfa5baf..849f678 100644
--- a/src/mpi/romio/adio/common/shfp_fname.c
+++ b/src/mpi/romio/adio/common/shfp_fname.c
@@ -87,7 +87,7 @@ void ADIOI_Shfp_fname(ADIO_File fd, int rank, int *error_code)
 	    }
 	}
 	    
-	ADIOI_Snprintf(tmp, 128, ".shfp.%d.%d", pid, i);
+	MPL_snprintf(tmp, 128, ".shfp.%d.%d", pid, i);
 	/* ADIOI_Strnapp will return non-zero if truncated.  That's ok */
 	ADIOI_Strnapp(fd->shared_fp_fname, tmp, PATH_MAX);
 	
diff --git a/src/mpi/romio/adio/common/strfns.c b/src/mpi/romio/adio/common/strfns.c
index 65e5ac2..b44210a 100644
--- a/src/mpi/romio/adio/common/strfns.c
+++ b/src/mpi/romio/adio/common/strfns.c
@@ -7,8 +7,6 @@
 
 #include "adio.h"
 
-/* style: allow:sprintf:3 sig:0 */
-
 /* 
  * Below are the "safe" versions of the various string and printf
  * operations. They are directly taken from MPICH, with MPIU replaced by ADIOI.
@@ -157,159 +155,3 @@ char *ADIOI_Strdup( const char *str )
     }
     return save_p;
 }
-
-
-/* 
- * We need an snprintf replacement for systems without one
- */
-#ifndef HAVE_SNPRINTF
-#include <ctype.h>
-/* FIXME: Really need a check for varargs.h vs stdarg.h */
-#include <stdarg.h>
-/* 
- * This is an approximate form which is suitable for most uses within
- * the MPICH code
- */
-int ADIOI_Snprintf( char *str, size_t size, const char *format, ... )
-{
-    int n;
-    const char *p;
-    char *out_str = str;
-    va_list list;
-
-    va_start(list, format);
-
-    p = format;
-    while (*p && size > 0) {
-	char *nf;
-
-	nf = strchr(p, '%');
-	if (!nf) {
-	    /* No more format characters */
-	    while (size-- > 0 && *p) {
-		*out_str++ = *p++;
-	    }
-	}
-	else {
-	    int nc;
-	    int width = -1;
-
-	    /* Copy until nf */
-	    while (p < nf && size-- > 0) {
-		*out_str++ = *p++;
-	    }
-	    /* p now points at nf */
-	    /* Handle the format character */
-	    nc = nf[1];
-	    if (isdigit(nc)) {
-		/* Get the field width */
-		/* FIXME : Assumes ASCII */
-		width = nc - '0';
-		p = nf + 2;
-		while (*p && isdigit(*p)) {
-		    width = 10 * width + (*p++ - '0');
-		}
-		/* When there is no longer a digit, get the format 
-		   character */
-		nc = *p++;
-	    }
-	    else {
-		/* Skip over the format string */
-		p += 2;
-	    }
-
-	    switch (nc) {
-	    case '%':
-		*out_str++ = '%';
-		size--;
-		break;
-
-	    case 'd':
-	    {
-		int val;
-		char tmp[20];
-		char *t = tmp;
-		/* Get the argument, of integer type */
-		val = va_arg( list, int );
-		sprintf( tmp, "%d", val );
-		if (width > 0) {
-		    int tmplen = strlen(tmp);
-		    /* If a width was specified, pad with spaces on the
-		       left (on the right if %-3d given; not implemented yet */
-		    while (size-- > 0 && width-- > tmplen) 
-			*out_str++ = ' ';
-		}
-		while (size-- > 0 && *t) {
-		    *out_str++ = *t++;
-		}
-	    }
-	    break;
-
-	    case 'x':
-	    {
-		int val;
-		char tmp[20];
-		char *t = tmp;
-		/* Get the argument, of integer type */
-		val = va_arg( list, int );
-		sprintf( tmp, "%x", val );
-		if (width > 0) {
-		    int tmplen = strlen(tmp);
-		    /* If a width was specified, pad with spaces on the
-		       left (on the right if %-3d given; not implemented yet */
-		    while (size-- > 0 && width-- > tmplen) 
-			*out_str++ = ' ';
-		}
-		while (size-- > 0 && *t) {
-		    *out_str++ = *t++;
-		}
-	    }
-	    break;
-
-	    case 'p':
-	    {
-		void *val;
-		char tmp[20];
-		char *t = tmp;
-		val = va_arg( list, void * );
-		sprintf( tmp, "%p", val );
-		if (width > 0) {
-		    int tmplen = strlen(tmp);
-		    /* If a width was specified, pad with spaces on the
-		       left (on the right if %-3d given; not implemented yet */
-		    while (size-- > 0 && width-- > tmplen) 
-			*out_str++ = ' ';
-		}
-		while (size-- > 0 && *t) {
-		    *out_str++ = *t++;
-		}
-	    }
-	    break;
-
-	    case 's':
-	    {
-		char *s_arg;
-		/* Get the argument, of pointer to char type */
-		s_arg = va_arg( list, char * );
-		while (size-- > 0 && s_arg && *s_arg) {
-		    *out_str++ = *s_arg++;
-		}
-	    }
-	    break;
-
-	    default:
-		/* Error, unknown case */
-		return -1;
-		break;
-	    }
-	}
-    }
-
-    va_end(list);
-
-    if (size-- > 0) *out_str++ = '\0';
-
-    n = (int)(out_str - str);
-    return n;
-}
-#endif
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index b38c25c..409f137 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -942,7 +942,6 @@ char *ADIOI_Strdup( const char * );
     MPI_Info_delete((info_),((char*)key_str_))
 
 
-/* Provide a fallback snprintf for systems that do not have one */
 /* Define attribute as empty if it has no definition */
 #ifndef ATTRIBUTE
 #ifdef HAVE_GCC_ATTRIBUTE
@@ -952,19 +951,6 @@ char *ADIOI_Strdup( const char * );
 #endif
 #endif
 
-/* style: allow:snprintf:1 sig:0 */
-
-#ifdef HAVE_SNPRINTF
-#define ADIOI_Snprintf snprintf
-/* Sometimes systems don't provide prototypes for snprintf */
-#ifdef NEEDS_SNPRINTF_DECL
-extern int snprintf( char *, size_t, const char *, ... ) ATTRIBUTE((format(printf,3,4)));
-#endif
-#else
-int ADIOI_Snprintf( char *str, size_t size, const char *format, ... ) 
-     ATTRIBUTE((format(printf,3,4)));
-#endif /* HAVE_SNPRINTF */
-
 #define FPRINTF fprintf
 
 #ifndef HAVE_STRERROR
diff --git a/src/mpi/romio/configure.ac b/src/mpi/romio/configure.ac
index 5cd27bd..278ad75 100644
--- a/src/mpi/romio/configure.ac
+++ b/src/mpi/romio/configure.ac
@@ -1592,11 +1592,6 @@ if test "$ac_cv_func_strdup" = "yes" ; then
     # Do we need to declare strdup?
     PAC_FUNC_NEEDS_DECL([#include <string.h>],strdup)
 fi
-AC_CHECK_FUNCS(snprintf)
-if test "$ac_cv_func_snprintf" = "yes" ; then
-    # Do we need to declare snprintf?
-    PAC_FUNC_NEEDS_DECL([#include <stdio.h>],snprintf)
-fi
 AC_CHECK_FUNCS(lstat)
 if test "$ac_cv_func_lstat" = "yes" ; then
     # Do we need to declare lstat?
diff --git a/src/mpi/romio/mpi-io/glue/default/mpio_err.c b/src/mpi/romio/mpi-io/glue/default/mpio_err.c
index fbfc8a2..648b0e0 100644
--- a/src/mpi/romio/mpi-io/glue/default/mpio_err.c
+++ b/src/mpi/romio/mpi-io/glue/default/mpio_err.c
@@ -26,9 +26,9 @@ int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[],
 
     buf = (char *) ADIOI_Malloc(1024);
     if (buf != NULL) {
-	idx += ADIOI_Snprintf(buf, 1023, "%s (line %d): ", fcname, line);
+	idx += MPL_snprintf(buf, 1023, "%s (line %d): ", fcname, line);
 	if (specific_msg == NULL) {
-	    ADIOI_Snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg);
+	    MPL_snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg);
 	}
 	else {
 	    va_start(Argp, specific_msg);
diff --git a/src/mpi/romio/mpi-io/glue/mpich/mpio_err.c b/src/mpi/romio/mpi-io/glue/mpich/mpio_err.c
index 520ba1a..77e6b1d 100644
--- a/src/mpi/romio/mpi-io/glue/mpich/mpio_err.c
+++ b/src/mpi/romio/mpi-io/glue/mpich/mpio_err.c
@@ -92,7 +92,7 @@ int MPIO_Err_return_file(MPI_File mpi_fh, int error_code)
     /* --BEGIN ERROR HANDLING-- */
     if (MPIR_Err_is_fatal(error_code) || kind == 0) 
     {
-	ADIOI_Snprintf(error_msg, 4096, "I/O error: ");
+	MPL_snprintf(error_msg, 4096, "I/O error: ");
 	len = (int)strlen(error_msg);
 	MPIR_Err_get_string(error_code, &error_msg[len], 4096-len, NULL);
 	MPID_Abort(NULL, MPI_SUCCESS, error_code, error_msg);
diff --git a/src/mpi/romio/mpi-io/glue/openmpi/mpio_err.c b/src/mpi/romio/mpi-io/glue/openmpi/mpio_err.c
index 2dddaee..dd5f023 100644
--- a/src/mpi/romio/mpi-io/glue/openmpi/mpio_err.c
+++ b/src/mpi/romio/mpi-io/glue/openmpi/mpio_err.c
@@ -26,9 +26,9 @@ int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[],
 
     buf = (char *) ADIOI_Malloc(1024);
     if (buf != NULL) {
-        idx += ADIOI_Snprintf(buf, 1023, "%s (line %d): ", fcname, line);
+        idx += MPL_snprintf(buf, 1023, "%s (line %d): ", fcname, line);
         if (specific_msg == NULL) {
-            ADIOI_Snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg);
+            MPL_snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg);
         }
         else {
             va_start(Argp, specific_msg);
diff --git a/src/pm/hydra/include/hydra.h b/src/pm/hydra/include/hydra.h
index 393c1de..c4bdfaf 100644
--- a/src/pm/hydra/include/hydra.h
+++ b/src/pm/hydra/include/hydra.h
@@ -640,8 +640,6 @@ HYD_status HYDU_sock_cloexec(int fd);
 
 #endif /* USE_MEMORY_TRACING */
 
-#define HYDU_snprintf MPL_snprintf
-
 #define HYDU_MALLOC(p, type, size, status)                              \
     {                                                                   \
         (p) = NULL; /* initialize p in case assert fails */             \
diff --git a/src/pm/hydra/pm/pmiserv/common.c b/src/pm/hydra/pm/pmiserv/common.c
index f80d28b..2664024 100644
--- a/src/pm/hydra/pm/pmiserv/common.c
+++ b/src/pm/hydra/pm/pmiserv/common.c
@@ -125,7 +125,7 @@ HYD_status HYD_pmcd_pmi_allocate_kvs(struct HYD_pmcd_pmi_kvs ** kvs, int pgid)
     HYDU_FUNC_ENTER();
 
     HYDU_MALLOC(*kvs, struct HYD_pmcd_pmi_kvs *, sizeof(struct HYD_pmcd_pmi_kvs), status);
-    HYDU_snprintf((*kvs)->kvsname, PMI_MAXKVSLEN, "kvs_%d_%d", (int) getpid(), pgid);
+    MPL_snprintf((*kvs)->kvsname, PMI_MAXKVSLEN, "kvs_%d_%d", (int) getpid(), pgid);
     (*kvs)->key_pair = NULL;
 
   fn_exit:
@@ -162,8 +162,8 @@ HYD_status HYD_pmcd_pmi_add_kvs(const char *key, char *val, struct HYD_pmcd_pmi_
 
     HYDU_MALLOC(key_pair, struct HYD_pmcd_pmi_kvs_pair *, sizeof(struct HYD_pmcd_pmi_kvs_pair),
                 status);
-    HYDU_snprintf(key_pair->key, PMI_MAXKEYLEN, "%s", key);
-    HYDU_snprintf(key_pair->val, PMI_MAXVALLEN, "%s", val);
+    MPL_snprintf(key_pair->key, PMI_MAXKEYLEN, "%s", key);
+    MPL_snprintf(key_pair->val, PMI_MAXVALLEN, "%s", val);
     key_pair->next = NULL;
 
     *ret = 0;
diff --git a/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c b/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c
index 7a1723b..31b96fb 100644
--- a/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c
+++ b/src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c
@@ -73,7 +73,7 @@ static HYD_status send_cmd_downstream(int fd, const char *cmd)
 
     HYDU_FUNC_ENTER();
 
-    HYDU_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
+    MPL_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
     status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
     HYDU_ERR_POP(status, "error writing PMI line\n");
     /* FIXME: We cannot abort when we are not able to send data
diff --git a/src/pm/hydra/pm/pmiserv/pmip_utils.c b/src/pm/hydra/pm/pmiserv/pmip_utils.c
index e1fa33a..58ae0d7 100644
--- a/src/pm/hydra/pm/pmiserv/pmip_utils.c
+++ b/src/pm/hydra/pm/pmiserv/pmip_utils.c
@@ -173,7 +173,7 @@ static HYD_status retries_fn(char *arg, char ***argv)
 
 static HYD_status pmi_kvsname_fn(char *arg, char ***argv)
 {
-    HYDU_snprintf(HYD_pmcd_pmip.local.kvs->kvsname, PMI_MAXKVSLEN, "%s", **argv);
+    MPL_snprintf(HYD_pmcd_pmip.local.kvs->kvsname, PMI_MAXKVSLEN, "%s", **argv);
     (*argv)++;
 
     return HYD_SUCCESS;
@@ -185,7 +185,7 @@ static HYD_status pmi_spawner_kvsname_fn(char *arg, char ***argv)
 
     HYDU_MALLOC(HYD_pmcd_pmip.local.spawner_kvsname, char *, PMI_MAXKVSLEN, status);
 
-    HYDU_snprintf(HYD_pmcd_pmip.local.spawner_kvsname, PMI_MAXKVSLEN, "%s", **argv);
+    MPL_snprintf(HYD_pmcd_pmip.local.spawner_kvsname, PMI_MAXKVSLEN, "%s", **argv);
     (*argv)++;
 
   fn_exit:
@@ -732,7 +732,7 @@ HYD_status HYD_pmcd_pmip_get_params(char **t_argv)
         HYD_pmcd_pmip.local.retries = 0;
 
     HYDU_dbg_finalize();
-    HYDU_snprintf(dbg_prefix, 2 * MAX_HOSTNAME_LEN, "proxy:%d:%d",
+    MPL_snprintf(dbg_prefix, 2 * MAX_HOSTNAME_LEN, "proxy:%d:%d",
                   HYD_pmcd_pmip.local.pgid, HYD_pmcd_pmip.local.id);
     status = HYDU_dbg_init((const char *) dbg_prefix);
     HYDU_ERR_POP(status, "unable to initialization debugging\n");
diff --git a/src/pm/hydra/pm/pmiserv/pmiserv_cb.c b/src/pm/hydra/pm/pmiserv/pmiserv_cb.c
index f5dbec2..e24804c 100644
--- a/src/pm/hydra/pm/pmiserv/pmiserv_cb.c
+++ b/src/pm/hydra/pm/pmiserv/pmiserv_cb.c
@@ -332,7 +332,7 @@ static HYD_status control_cb(int fd, HYD_event_t events, void *userp)
                 /* This is the first dead process */
                 HYDU_FREE(pg_scratch->dead_processes);
                 HYDU_MALLOC(pg_scratch->dead_processes, char *, PMI_MAXVALLEN, status);
-                HYDU_snprintf(pg_scratch->dead_processes, PMI_MAXVALLEN, "%d", hdr.pid);
+                MPL_snprintf(pg_scratch->dead_processes, PMI_MAXVALLEN, "%d", hdr.pid);
             }
             else {
                 /* FIXME: If the list of dead processes does not fit
@@ -367,7 +367,7 @@ static HYD_status control_cb(int fd, HYD_event_t events, void *userp)
                 if (!included) {
                     HYDU_MALLOC(str, char *, PMI_MAXVALLEN, status);
 
-                    HYDU_snprintf(str, PMI_MAXVALLEN, "%s,%d", pg_scratch->dead_processes, hdr.pid);
+                    MPL_snprintf(str, PMI_MAXVALLEN, "%s,%d", pg_scratch->dead_processes, hdr.pid);
                 } else {
                     str = current_list;
                 }
diff --git a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
index 41885e0..bfb8048 100644
--- a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
+++ b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
@@ -435,14 +435,14 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
         for (i = 0; i < info_num; i++) {
             char *info_key, *info_val;
 
-            HYDU_snprintf(key, PMI_MAXKEYLEN, "info_key_%d", i);
+            MPL_snprintf(key, PMI_MAXKEYLEN, "info_key_%d", i);
             val = HYD_pmcd_pmi_find_token_keyval(&tokens[segment_list[j].start_idx],
                                                  segment_list[j].token_count, key);
             HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
                                 "unable to find token: %s\n", key);
             info_key = val;
 
-            HYDU_snprintf(key, PMI_MAXKEYLEN, "info_val_%d", i);
+            MPL_snprintf(key, PMI_MAXKEYLEN, "info_val_%d", i);
             val = HYD_pmcd_pmi_find_token_keyval(&tokens[segment_list[j].start_idx],
                                                  segment_list[j].token_count, key);
             HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
@@ -495,7 +495,7 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
         i = 0;
         exec->exec[i++] = execname;
         for (k = 0; k < argcnt; k++) {
-            HYDU_snprintf(key, PMI_MAXKEYLEN, "arg%d", k + 1);
+            MPL_snprintf(key, PMI_MAXKEYLEN, "arg%d", k + 1);
             val = HYD_pmcd_pmi_find_token_keyval(&tokens[segment_list[j].start_idx],
                                                  segment_list[j].token_count, key);
             HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
@@ -535,13 +535,13 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
     for (i = 0; i < preput_num; i++) {
         char *preput_key, *preput_val;
 
-        HYDU_snprintf(key, PMI_MAXKEYLEN, "preput_key_%d", i);
+        MPL_snprintf(key, PMI_MAXKEYLEN, "preput_key_%d", i);
         val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, key);
         HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
                             "unable to find token: %s\n", key);
         preput_key = val;
 
-        HYDU_snprintf(key, PMI_MAXKEYLEN, "preput_val_%d", i);
+        MPL_snprintf(key, PMI_MAXKEYLEN, "preput_val_%d", i);
         val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, key);
         HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
                             "unable to find token: %s\n", key);
diff --git a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
index 2dc7d09..2c385a6 100644
--- a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
+++ b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
@@ -37,7 +37,7 @@ static HYD_status cmd_response(int fd, int pid, char *cmd)
     HYDU_ERR_POP(status, "unable to send PMI_RESPONSE header to proxy\n");
     HYDU_ASSERT(!closed, status);
 
-    HYDU_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
+    MPL_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
     status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
     HYDU_ERR_POP(status, "error writing PMI line\n");
     HYDU_ASSERT(!closed, status);
@@ -551,14 +551,14 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
         for (i = 0; i < infokeycount; i++) {
             char *info_key, *info_val;
 
-            HYDU_snprintf(key, PMI_MAXKEYLEN, "infokey%d", i);
+            MPL_snprintf(key, PMI_MAXKEYLEN, "infokey%d", i);
             val = HYD_pmcd_pmi_find_token_keyval(&tokens[segment_list[j].start_idx],
                                                  segment_list[j].token_count, key);
             HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
                                 "unable to find token: %s\n", key);
             info_key = val;
 
-            HYDU_snprintf(key, PMI_MAXKEYLEN, "infoval%d", i);
+            MPL_snprintf(key, PMI_MAXKEYLEN, "infoval%d", i);
             val = HYD_pmcd_pmi_find_token_keyval(&tokens[segment_list[j].start_idx],
                                                  segment_list[j].token_count, key);
             HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
@@ -611,7 +611,7 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
         i = 0;
         exec->exec[i++] = execname;
         for (k = 0; k < argcnt; k++) {
-            HYDU_snprintf(key, PMI_MAXKEYLEN, "argv%d", k);
+            MPL_snprintf(key, PMI_MAXKEYLEN, "argv%d", k);
             val = HYD_pmcd_pmi_find_token_keyval(&tokens[segment_list[j].start_idx],
                                                  segment_list[j].token_count, key);
             HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
@@ -650,13 +650,13 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
     for (i = 0; i < preputcount; i++) {
         char *preput_key, *preput_val;
 
-        HYDU_snprintf(key, PMI_MAXKEYLEN, "ppkey%d", i);
+        MPL_snprintf(key, PMI_MAXKEYLEN, "ppkey%d", i);
         val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, key);
         HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
                             "unable to find token: %s\n", key);
         preput_key = val;
 
-        HYDU_snprintf(key, PMI_MAXKEYLEN, "ppval%d", i);
+        MPL_snprintf(key, PMI_MAXKEYLEN, "ppval%d", i);
         val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, key);
         HYDU_ERR_CHKANDJUMP(status, val == NULL, HYD_INTERNAL_ERROR,
                             "unable to find token: %s\n", key);
diff --git a/src/pm/hydra/tools/bootstrap/external/external_common_launch.c b/src/pm/hydra/tools/bootstrap/external/external_common_launch.c
index 9534d46..0bfd5f7 100644
--- a/src/pm/hydra/tools/bootstrap/external/external_common_launch.c
+++ b/src/pm/hydra/tools/bootstrap/external/external_common_launch.c
@@ -183,7 +183,7 @@ HYD_status HYDT_bscd_common_launch_procs(char **args, struct HYD_proxy *proxy_li
     /* Create a quoted version of the exec string, which is only used
      * when the executable is not launched directly, but through an
      * actual launcher */
-    HYDU_snprintf(quoted_exec_string, HYD_TMP_STRLEN, "\"%s\"", targs[exec_idx]);
+    MPL_snprintf(quoted_exec_string, HYD_TMP_STRLEN, "\"%s\"", targs[exec_idx]);
 
     /* pid_list might already have some PIDs */
     num_hosts = 0;
diff --git a/src/pm/hydra/tools/bootstrap/external/ll_launch.c b/src/pm/hydra/tools/bootstrap/external/ll_launch.c
index 04ed4b3..c14cdea 100644
--- a/src/pm/hydra/tools/bootstrap/external/ll_launch.c
+++ b/src/pm/hydra/tools/bootstrap/external/ll_launch.c
@@ -72,7 +72,7 @@ HYD_status HYDT_bscd_ll_launch_procs(char **args, struct HYD_proxy *proxy_list,
     /* Create a quoted version of the exec string, which is only used
      * when the executable is not launched directly, but through an
      * actual launcher */
-    HYDU_snprintf(quoted_exec_string, HYD_TMP_STRLEN, "\"%s\"", targs[exec_idx]);
+    MPL_snprintf(quoted_exec_string, HYD_TMP_STRLEN, "\"%s\"", targs[exec_idx]);
     HYDU_FREE(targs[exec_idx]);
     targs[exec_idx] = quoted_exec_string;
 
diff --git a/src/pm/hydra/ui/mpich/utils.c b/src/pm/hydra/ui/mpich/utils.c
index d72172f..2aa949f 100644
--- a/src/pm/hydra/ui/mpich/utils.c
+++ b/src/pm/hydra/ui/mpich/utils.c
@@ -250,7 +250,7 @@ static HYD_status genvlist_fn(char *arg, char ***argv)
 
     len = strlen("list:") + strlen(**argv) + 1;
     HYDU_MALLOC(HYD_server_info.user_global.global_env.prop, char *, len, status);
-    HYDU_snprintf(HYD_server_info.user_global.global_env.prop, len, "list:%s", **argv);
+    MPL_snprintf(HYD_server_info.user_global.global_env.prop, len, "list:%s", **argv);
 
   fn_exit:
     (*argv)++;
@@ -696,7 +696,7 @@ static HYD_status envlist_fn(char *arg, char ***argv)
 
     len = strlen("list:") + strlen(**argv) + 1;
     HYDU_MALLOC(exec->env_prop, char *, len, status);
-    HYDU_snprintf(exec->env_prop, len, "list:%s", **argv);
+    MPL_snprintf(exec->env_prop, len, "list:%s", **argv);
     (*argv)++;
 
   fn_exit:
diff --git a/src/pm/hydra/utils/dbg/dbg.c b/src/pm/hydra/utils/dbg/dbg.c
index 5fada6d..e7f129a 100644
--- a/src/pm/hydra/utils/dbg/dbg.c
+++ b/src/pm/hydra/utils/dbg/dbg.c
@@ -19,7 +19,7 @@ HYD_status HYDU_dbg_init(const char *str)
         HYDU_ERR_SETANDJUMP(status, HYD_SOCK_ERROR, "unable to get local host name\n");
 
     HYDU_MALLOC(HYD_dbg_prefix, char *, strlen(hostname) + 1 + strlen(str) + 1, status);
-    HYDU_snprintf(HYD_dbg_prefix, strlen(hostname) + 1 + strlen(str) + 1, "%s@%s", str, hostname);
+    MPL_snprintf(HYD_dbg_prefix, strlen(hostname) + 1 + strlen(str) + 1, "%s@%s", str, hostname);
 
   fn_exit:
     HYDU_FUNC_EXIT();
diff --git a/src/pm/hydra/utils/sock/sock.c b/src/pm/hydra/utils/sock/sock.c
index 1a282cb..86b2507 100644
--- a/src/pm/hydra/utils/sock/sock.c
+++ b/src/pm/hydra/utils/sock/sock.c
@@ -668,7 +668,7 @@ HYDU_sock_create_and_listen_portstr(char *iface, char *hostname, char *port_rang
 
     sport = HYDU_int_to_str(port);
     HYDU_MALLOC(*port_str, char *, strlen(ip) + 1 + strlen(sport) + 1, status);
-    HYDU_snprintf(*port_str, strlen(ip) + 1 + strlen(sport) + 1, "%s:%s", ip, sport);
+    MPL_snprintf(*port_str, strlen(ip) + 1 + strlen(sport) + 1, "%s:%s", ip, sport);
     HYDU_FREE(sport);
 
   fn_exit:
diff --git a/src/pm/hydra/utils/string/string.c b/src/pm/hydra/utils/string/string.c
index 841177c..243cf1d 100644
--- a/src/pm/hydra/utils/string/string.c
+++ b/src/pm/hydra/utils/string/string.c
@@ -68,7 +68,7 @@ HYD_status HYDU_str_alloc_and_join(char **strlist, char **strjoin)
     (*strjoin)[0] = 0;
 
     for (i = 0; strlist[i] != NULL; i++) {
-        HYDU_snprintf(*strjoin + count, len - count + 1, "%s", strlist[i]);
+        MPL_snprintf(*strjoin + count, len - count + 1, "%s", strlist[i]);
         count += strlen(strlist[i]);
     }
 
@@ -154,7 +154,7 @@ char *HYDU_size_t_to_str(size_t x)
     for (i = 0; i < len; i++)
         str[i] = '0';
 
-    HYDU_snprintf(str, len, "%llu", (unsigned long long) x);
+    MPL_snprintf(str, len, "%llu", (unsigned long long) x);
 
   fn_exit:
     HYDU_FUNC_EXIT();
@@ -203,7 +203,7 @@ char *HYDU_int_to_str_pad(int x, int maxlen)
     for (i = 0; i < actual_len; i++)
         str[i] = '0';
 
-    HYDU_snprintf(str + actual_len - len - 1, len + 1, "%d", x);
+    MPL_snprintf(str + actual_len - len - 1, len + 1, "%d", x);
 
   fn_exit:
     HYDU_FUNC_EXIT();
diff --git a/src/pmi/pmi2/simple/pmi2compat.h b/src/pmi/pmi2/simple/pmi2compat.h
index 6a71393..a459fd2 100644
--- a/src/pmi/pmi2/simple/pmi2compat.h
+++ b/src/pmi/pmi2/simple/pmi2compat.h
@@ -9,7 +9,6 @@
 #define PMI2U_Malloc MPIU_Malloc
 #define PMI2U_Free MPIU_Free
 #define PMI2U_Strdup MPIU_Strdup
-#define PMI2U_Snprintf MPL_snprintf
 #define PMI2U_Strncpy MPIU_Strncpy
 #define PMI2U_Strnapp MPIU_Strnapp
 #define PMI2U_Assert MPIU_Assert
diff --git a/src/pmi/pmi2/simple/simple2pmi.c b/src/pmi/pmi2/simple/simple2pmi.c
index 7ef3615..b5320a3 100644
--- a/src/pmi/pmi2/simple/simple2pmi.c
+++ b/src/pmi/pmi2/simple/simple2pmi.c
@@ -90,7 +90,7 @@ static void init_kv_strdup_int(PMI2_Keyvalpair *kv, const char key[], int val)
     char tmpbuf[32] = {0};
     int rc = PMI2_SUCCESS;
 
-    rc = PMI2U_Snprintf(tmpbuf, sizeof(tmpbuf), "%d", val);
+    rc = MPL_snprintf(tmpbuf, sizeof(tmpbuf), "%d", val);
     PMI2U_Assert(rc >= 0);
     init_kv_strdup(kv, key, tmpbuf);
 }
@@ -102,7 +102,7 @@ static void init_kv_strdup_intsuffix(PMI2_Keyvalpair *kv, const char key_prefix[
     char tmpbuf[256/*XXX HACK*/] = {0};
     int rc = PMI2_SUCCESS;
 
-    rc = PMI2U_Snprintf(tmpbuf, sizeof(tmpbuf), "%s%d", key_prefix, suffix);
+    rc = MPL_snprintf(tmpbuf, sizeof(tmpbuf), "%s%d", key_prefix, suffix);
     PMI2U_Assert(rc >= 0);
     init_kv_strdup(kv, tmpbuf, val);
 }
@@ -230,7 +230,7 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
     }
 
     /* do initial PMI1 init */
-    ret = PMI2U_Snprintf( buf, PMI2U_MAXLINE, "cmd=init pmi_version=%d pmi_subversion=%d\n", PMI_VERSION, PMI_SUBVERSION );
+    ret = MPL_snprintf( buf, PMI2U_MAXLINE, "cmd=init pmi_version=%d pmi_subversion=%d\n", PMI_VERSION, PMI_SUBVERSION );
     PMI2U_ERR_CHKANDJUMP1(ret < 0, pmi2_errno, PMI2_ERR_OTHER, "**intern", "**intern %s", "failed to generate init line");
 
     ret = PMI2U_writeline(PMI2_fd, buf);
@@ -682,7 +682,7 @@ int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value
     char src_pmi_id_str[256];
     const char *errmsg;
 
-    PMI2U_Snprintf(src_pmi_id_str, sizeof(src_pmi_id_str), "%d", src_pmi_id);
+    MPL_snprintf(src_pmi_id_str, sizeof(src_pmi_id_str), "%d", src_pmi_id);
 
     pmi2_errno = PMIi_InitIfSingleton();
     if (pmi2_errno) PMI2U_ERR_POP(pmi2_errno);
@@ -1436,7 +1436,7 @@ int PMIi_WriteSimpleCommand( int fd, PMI2_Command *resp, const char cmd[], PMI2_
 
     PMI2U_ERR_CHKANDJUMP(strlen(cmd) > PMI2_MAX_VALLEN, pmi2_errno, PMI2_ERR_OTHER, "**cmd_too_long");
 
-    ret = PMI2U_Snprintf(c, remaining_len, "cmd=%s;", cmd);
+    ret = MPL_snprintf(c, remaining_len, "cmd=%s;", cmd);
     PMI2U_ERR_CHKANDJUMP1(ret >= remaining_len, pmi2_errno, PMI2_ERR_OTHER, "**intern", "**intern %s", "Ran out of room for command");
     c += ret;
     remaining_len -= ret;
@@ -1444,7 +1444,7 @@ int PMIi_WriteSimpleCommand( int fd, PMI2_Command *resp, const char cmd[], PMI2_
 #ifdef MPICH_IS_THREADED
     MPIU_THREAD_CHECK_BEGIN;
     if (resp) {
-        ret = PMI2U_Snprintf(c, remaining_len, "thrid=%p;", resp);
+        ret = MPL_snprintf(c, remaining_len, "thrid=%p;", resp);
         PMI2U_ERR_CHKANDJUMP1(ret >= remaining_len, pmi2_errno, PMI2_ERR_OTHER, "**intern", "**intern %s", "Ran out of room for command");
         c += ret;
         remaining_len -= ret;
@@ -1455,7 +1455,7 @@ int PMIi_WriteSimpleCommand( int fd, PMI2_Command *resp, const char cmd[], PMI2_
     for (pair_index = 0; pair_index < npairs; ++pair_index) {
         /* write key= */
         PMI2U_ERR_CHKANDJUMP(strlen(pairs[pair_index]->key) > PMI2_MAX_KEYLEN, pmi2_errno, PMI2_ERR_OTHER, "**key_too_long");
-        ret = PMI2U_Snprintf(c, remaining_len, "%s=", pairs[pair_index]->key);
+        ret = MPL_snprintf(c, remaining_len, "%s=", pairs[pair_index]->key);
         PMI2U_ERR_CHKANDJUMP1(ret >= remaining_len, pmi2_errno, PMI2_ERR_OTHER, "**intern", "**intern %s", "Ran out of room for command");
         c += ret;
         remaining_len -= ret;
@@ -1481,7 +1481,7 @@ int PMIi_WriteSimpleCommand( int fd, PMI2_Command *resp, const char cmd[], PMI2_
 
     /* prepend the buffer length stripping off the trailing '\0' */
     cmdlen = PMII_MAX_COMMAND_LEN - remaining_len;
-    ret = PMI2U_Snprintf(cmdlenbuf, sizeof(cmdlenbuf), "%d", cmdlen);
+    ret = MPL_snprintf(cmdlenbuf, sizeof(cmdlenbuf), "%d", cmdlen);
     PMI2U_ERR_CHKANDJUMP1(ret >= PMII_COMMANDLEN_SIZE, pmi2_errno, PMI2_ERR_OTHER, "**intern", "**intern %s", "Command length won't fit in length buffer");
 
     PMI2U_Memcpy(cmdbuf, cmdlenbuf, ret);
diff --git a/src/pmi/pmi2/simple/simple_pmiutil.c b/src/pmi/pmi2/simple/simple_pmiutil.c
index 65ca889..c602574 100644
--- a/src/pmi/pmi2/simple/simple_pmiutil.c
+++ b/src/pmi/pmi2/simple/simple_pmiutil.c
@@ -50,7 +50,7 @@ static char PMI2U_print_id[PMI2U_IDSIZE] = "unset";
 
 void PMI2U_Set_rank( int PMI_rank )
 {
-    PMI2U_Snprintf( PMI2U_print_id, PMI2U_IDSIZE, "cli_%d", PMI_rank );
+    MPL_snprintf( PMI2U_print_id, PMI2U_IDSIZE, "cli_%d", PMI_rank );
 }
 void PMI2U_SetServer( void )
 {
@@ -77,7 +77,7 @@ void PMI2U_printf( int print_flag, const char *fmt, ... )
 	    char filename[1024];
 	    p = getenv("PMI_ID");
 	    if (p) {
-		PMI2U_Snprintf( filename, sizeof(filename),
+		MPL_snprintf( filename, sizeof(filename),
 			       "testclient-%s.out", p );
 		logfile = fopen( filename, "w" );
 	    }
diff --git a/src/pmi/simple/simple_pmi.c b/src/pmi/simple/simple_pmi.c
index 0172ae0..72f2c25 100644
--- a/src/pmi/simple/simple_pmi.c
+++ b/src/pmi/simple/simple_pmi.c
@@ -46,8 +46,7 @@
 #endif
 
 #include "mpl.h"            /* Get ATTRIBUTE, some base functions */
-/* mpimem includes the definitions for MPL_snprintf, MPIU_Malloc, and 
-   MPIU_Free */
+/* mpimem includes the definitions for MPIU_Malloc and MPIU_Free */
 #include "mpimem.h"
 
 /* Temporary debug definitions */

http://git.mpich.org/mpich.git/commitdiff/06c7c4dbcd15544d812ec871ba3a869c8f6c0b9e

commit 06c7c4dbcd15544d812ec871ba3a869c8f6c0b9e
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Fri Dec 18 11:06:04 2015 -0600

    integrate MPL with ROMIO
    
    First steps towards eliminating duplicate code maintenance in ROMIO.
    For many utils, there exist MPL versions that can be used.
    
    Signed-off-by: Yanfei Guo <yguo at anl.gov>

diff --git a/.gitignore b/.gitignore
index 9f0e903..0bd7ad3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,6 +118,8 @@ apply-xfail.sh
 /src/pm/hydra/confdb
 /src/pm/hydra/mpl
 /src/pm/hydra/mpl/confdb
+/src/mpi/romio/mpl
+/src/mpi/romio/mpl/confdb
 /src/mpi/romio/version.m4
 /src/pm/hydra/version.m4
 /test/mpi/version.m4
diff --git a/Makefile.am b/Makefile.am
index bde9873..d4e7636 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,7 +51,7 @@ external_subdirs = @mplsrcdir@ @opasrcdir@
 external_ldflags = @mpllibdir@ @opalibdir@
 external_libs = @WRAPPER_LIBS@
 mpi_convenience_libs =
-pmpi_convenience_libs = @mpllib@ @opalib@
+pmpi_convenience_libs = @opalib@ @mpllib@
 
 # NOTE on our semi-unconventional usage of DIST_SUBDIRS:
 # The automake manual recommends thinking of DIST_SUBDIRS as the list of all
diff --git a/autogen.sh b/autogen.sh
index e263181..408084e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -88,6 +88,7 @@ sync_external () {
 
 confdb_dirs=
 confdb_dirs="${confdb_dirs} src/mpi/romio/confdb"
+confdb_dirs="${confdb_dirs} src/mpi/romio/mpl/confdb"
 confdb_dirs="${confdb_dirs} src/mpl/confdb"
 confdb_dirs="${confdb_dirs} src/pm/hydra/confdb"
 confdb_dirs="${confdb_dirs} src/pm/hydra/mpl/confdb"
@@ -96,6 +97,9 @@ confdb_dirs="${confdb_dirs} test/mpi/confdb"
 # hydra's copy of mpl
 sync_external src/mpl src/pm/hydra/mpl
 
+# ROMIO's copy of mpl
+sync_external src/mpl src/mpi/romio/mpl
+
 # all the confdb directories, by various names
 for destdir in $confdb_dirs ; do
     sync_external confdb "$destdir"
diff --git a/src/mpi/romio/Makefile.am b/src/mpi/romio/Makefile.am
index b9d4e25..b2748df 100644
--- a/src/mpi/romio/Makefile.am
+++ b/src/mpi/romio/Makefile.am
@@ -22,6 +22,12 @@ EXTRA_DIST =
 SUFFIXES = 
 doc1_src_txt =
 
+external_subdirs = @mpl_srcdir@
+external_dist_subdirs = @mpl_dist_srcdir@
+external_includes = @mpl_includedir@
+external_ldflags = @mpl_libdir@
+external_libs = -l$(MPLLIBNAME)
+
 # ------------------------------------------------------------------------
 # variables to be populated by the included Makefile.mk fragments:
 
@@ -44,14 +50,14 @@ AM_CPPFLAGS += $(MPI_H_INCLUDE)
 
 # ------------------------------------------------------------------------
 # handle the "include" directory here
-AM_CPPFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/include $(external_includes)
 # nodist_ b/c these are created by config.status and should not be distributed
 nodist_include_HEADERS += include/mpio.h include/mpiof.h
 
 # ------------------------------------------------------------------------
 
-SUBDIRS =
-DIST_SUBDIRS = test test-internal
+SUBDIRS = $(external_subdirs)
+DIST_SUBDIRS = test test-internal $(external_dist_subdirs)
 
 # for the sake of parallel make and avoiding an excessive number of convenience
 # libs, we use a subdir automake fragment strategy
@@ -83,7 +89,12 @@ if BUILD_PROFILING_LIB
 noinst_LTLIBRARIES += libpromio.la
 libpromio_la_SOURCES = $(romio_mpi_sources)
 libpromio_la_CPPFLAGS = $(AM_CPPFLAGS) -DMPIO_BUILD_PROFILING 
-endif BUILD_PROFILING_LIB
+libpromio_la_LDFLAGS = $(external_ldflags)
+libpromio_la_LIBADD = $(external_libs)
+else !BUILD_PROFILING_LIB
+libromio_la_LDFLAGS = $(external_ldflags)
+libromio_la_LIBADD = $(external_libs)
+endif !BUILD_PROFILING_LIB
 
 else !BUILD_ROMIO_EMBEDDED
 lib_LTLIBRARIES = libromio.la
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index 0cc219e..b38c25c 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -1087,4 +1087,6 @@ ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
 
 #endif
 
+#include "mpl.h"
+
 #endif  /* ADIOI_INCLUDE */
diff --git a/src/mpi/romio/autogen.sh b/src/mpi/romio/autogen.sh
index dcc84c7..9d01f53 100755
--- a/src/mpi/romio/autogen.sh
+++ b/src/mpi/romio/autogen.sh
@@ -1,3 +1,6 @@
 #!/bin/sh
 
 ${AUTORECONF:-autoreconf} ${autoreconf_args:-"-vif"} -I confdb
+
+echo "=== running autoreconf in 'mpl' ==="
+(cd mpl && ${AUTORECONF:-autoreconf} ${autoreconf_args:-"-vif"}) || exit 1
diff --git a/src/mpi/romio/configure.ac b/src/mpi/romio/configure.ac
index bb9c25a..5cd27bd 100644
--- a/src/mpi/romio/configure.ac
+++ b/src/mpi/romio/configure.ac
@@ -84,6 +84,44 @@ DEBUG=no
 MIPS=0
 BITS=0
 
+# MPL
+AC_ARG_VAR([MPLLIBNAME],[can be used to override the name of the MPL library (default: "mpl")])
+MPLLIBNAME=${MPLLIBNAME:-"mpl"}
+export MPLLIBNAME
+AC_SUBST(MPLLIBNAME)
+AC_ARG_WITH([mpl-prefix],
+            [AS_HELP_STRING([[--with-mpl-prefix[=DIR]]],
+                            [use the MPL library installed in DIR. Pass
+                             "embedded" to force usage of the MPL source
+                             distributed with Hydra.])],
+            [],dnl action-if-given
+            [with_mpl_prefix=embedded]) dnl action-if-not-given
+mpl_srcdir=""
+AC_SUBST([mpl_srcdir])
+# Controls whether we recurse into the MPL dir when running "dist" rules like
+# "make distclean".  Technically we are cheating whenever DIST_SUBDIRS is not a
+# superset of SUBDIRS, but we don't want to double-distclean and similar.
+mpl_dist_srcdir=""
+AC_SUBST(mpl_dist_srcdir)
+mpl_includedir=""
+AC_SUBST([mpl_includedir])
+mpl_libdir=""
+AC_SUBST([mpl_libdir])
+if test "$with_mpl_prefix" = "embedded" ; then
+    mpl_srcdir="mpl"
+    mpl_dist_srcdir="mpl"
+    mpl_subdir_args="--disable-versioning --enable-embedded"
+    PAC_CONFIG_SUBDIR_ARGS([mpl],[$mpl_subdir_args],[],[AC_MSG_ERROR(MPL configure failed)])
+    mpl_includedir='-I$(top_builddir)/mpl/include -I$(top_srcdir)/mpl/include'
+else
+    # The user specified an already-installed MPL; just sanity check, don't
+    # subconfigure it
+    AS_IF([test -s "${with_mpl_prefix}/include/mplconfig.h"],
+          [:],[AC_MSG_ERROR([the MPL installation in "${with_mpl_prefix}" appears broken])])
+    mpl_includedir="-I${with_mpl_prefix}/include"
+    mpl_libdir="-L${with_mpl_prefix}/lib"
+fi
+
 AC_ARG_VAR([FROM_MPICH],[set to "yes" if building ROMIO inside of MPICH])
 FROM_MPICH=${FROM_MPICH:-no}
 

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    2 +
 Makefile.am                                        |    2 +-
 autogen.sh                                         |    4 +
 src/include/mpiimpl.h                              |    8 -
 src/mpi/coll/allgather.c                           |    4 +-
 src/mpi/coll/allgatherv.c                          |    8 +-
 src/mpi/coll/allred_group.c                        |    4 +-
 src/mpi/coll/allreduce.c                           |    8 +-
 src/mpi/coll/alltoall.c                            |    4 +-
 src/mpi/coll/alltoallv.c                           |    2 +-
 src/mpi/coll/alltoallw.c                           |    2 +-
 src/mpi/coll/bcast.c                               |    8 +-
 src/mpi/coll/exscan.c                              |    4 +-
 src/mpi/coll/gather.c                              |    4 +-
 src/mpi/coll/iallgather.c                          |    4 +-
 src/mpi/coll/iallgatherv.c                         |    8 +-
 src/mpi/coll/iallreduce.c                          |    8 +-
 src/mpi/coll/ialltoall.c                           |    4 +-
 src/mpi/coll/ialltoallv.c                          |    4 +-
 src/mpi/coll/ialltoallw.c                          |    4 +-
 src/mpi/coll/ibcast.c                              |   10 +-
 src/mpi/coll/iexscan.c                             |    4 +-
 src/mpi/coll/igather.c                             |    4 +-
 src/mpi/coll/ired_scat.c                           |   16 +-
 src/mpi/coll/ired_scat_block.c                     |   22 ++--
 src/mpi/coll/ireduce.c                             |   20 ++--
 src/mpi/coll/iscan.c                               |   14 +-
 src/mpi/coll/iscatter.c                            |    2 +-
 src/mpi/coll/opmax.c                               |    2 +-
 src/mpi/coll/opmaxloc.c                            |    4 +-
 src/mpi/coll/opmin.c                               |    2 +-
 src/mpi/coll/opminloc.c                            |    4 +-
 src/mpi/coll/red_scat.c                            |   14 +-
 src/mpi/coll/red_scat_block.c                      |   14 +-
 src/mpi/coll/reduce.c                              |   20 ++--
 src/mpi/coll/scan.c                                |   14 +-
 src/mpi/coll/scatter.c                             |    2 +-
 src/mpi/datatype/get_elements_x.c                  |    2 +-
 src/mpi/datatype/type_create_darray.c              |    4 +-
 src/mpi/errhan/errutil.c                           |    2 +-
 src/mpi/pt2pt/bsendutil.c                          |    2 +-
 src/mpi/romio/Makefile.am                          |   19 ++-
 src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c         |    4 +-
 src/mpi/romio/adio/ad_gpfs/ad_gpfs_hints.c         |    2 +-
 src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c        |   18 +-
 src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c        |   24 ++--
 src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.c         |    2 +-
 src/mpi/romio/adio/ad_gpfs/bg/ad_bg_pset.h         |    3 -
 src/mpi/romio/adio/ad_gridftp/ad_gridftp_read.c    |    2 +-
 src/mpi/romio/adio/ad_gridftp/ad_gridftp_resize.c  |    2 +-
 src/mpi/romio/adio/ad_gridftp/ad_gridftp_write.c   |    2 +-
 src/mpi/romio/adio/ad_lustre/ad_lustre_aggregate.c |    2 +-
 src/mpi/romio/adio/ad_lustre/ad_lustre_fcntl.c     |    6 +-
 src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c  |    2 +-
 src/mpi/romio/adio/ad_lustre/ad_lustre_wrcoll.c    |   18 +-
 src/mpi/romio/adio/ad_lustre/ad_lustre_wrstr.c     |   36 +++---
 src/mpi/romio/adio/ad_nfs/ad_nfs_read.c            |   22 ++--
 src/mpi/romio/adio/ad_nfs/ad_nfs_write.c           |   46 +++---
 src/mpi/romio/adio/ad_panfs/ad_panfs_open.c        |   22 ++--
 src/mpi/romio/adio/ad_panfs/ad_panfs_open6.c       |   30 ++--
 src/mpi/romio/adio/ad_pfs/ad_pfs_open.c            |    6 +-
 src/mpi/romio/adio/ad_piofs/ad_piofs_hints.c       |    2 +-
 src/mpi/romio/adio/ad_piofs/ad_piofs_open.c        |    6 +-
 src/mpi/romio/adio/ad_piofs/ad_piofs_write.c       |    6 +-
 src/mpi/romio/adio/ad_pvfs/ad_pvfs_open.c          |    6 +-
 src/mpi/romio/adio/ad_pvfs/ad_pvfs_read.c          |    2 +-
 src/mpi/romio/adio/ad_pvfs/ad_pvfs_write.c         |    8 +-
 .../adio/ad_pvfs2/ad_pvfs2_read_list_classic.c     |    4 +-
 .../adio/ad_pvfs2/ad_pvfs2_write_list_classic.c    |    4 +-
 src/mpi/romio/adio/ad_xfs/ad_xfs_read.c            |    2 +-
 src/mpi/romio/adio/ad_xfs/ad_xfs_write.c           |    2 +-
 src/mpi/romio/adio/ad_zoidfs/ad_zoidfs_read_list.c |    4 +-
 .../romio/adio/ad_zoidfs/ad_zoidfs_write_list.c    |    4 +-
 src/mpi/romio/adio/common/ad_aggregate.c           |    4 +-
 src/mpi/romio/adio/common/ad_aggregate_new.c       |    2 +-
 src/mpi/romio/adio/common/ad_coll_exch_new.c       |    2 +-
 src/mpi/romio/adio/common/ad_darray.c              |    4 +-
 src/mpi/romio/adio/common/ad_hints.c               |    4 +-
 src/mpi/romio/adio/common/ad_io_coll.c             |    4 +-
 src/mpi/romio/adio/common/ad_iread_coll.c          |   10 +-
 src/mpi/romio/adio/common/ad_iwrite_coll.c         |    8 +-
 src/mpi/romio/adio/common/ad_open.c                |    2 +-
 src/mpi/romio/adio/common/ad_prealloc.c            |    6 +-
 src/mpi/romio/adio/common/ad_read_coll.c           |   26 ++--
 src/mpi/romio/adio/common/ad_read_str.c            |   16 +-
 src/mpi/romio/adio/common/ad_read_str_naive.c      |   10 +-
 src/mpi/romio/adio/common/ad_write_coll.c          |   16 +-
 src/mpi/romio/adio/common/ad_write_nolock.c        |    6 +-
 src/mpi/romio/adio/common/ad_write_str.c           |   32 ++--
 src/mpi/romio/adio/common/ad_write_str_naive.c     |   10 +-
 src/mpi/romio/adio/common/cb_config_list.c         |    4 +-
 src/mpi/romio/adio/common/onesided_aggregation.c   |    8 +-
 src/mpi/romio/adio/common/shfp_fname.c             |    2 +-
 src/mpi/romio/adio/common/strfns.c                 |  158 --------------------
 src/mpi/romio/adio/include/adioi.h                 |   18 +--
 src/mpi/romio/autogen.sh                           |    3 +
 src/mpi/romio/configure.ac                         |   43 +++++-
 src/mpi/romio/mpi-io/glue/default/mpio_err.c       |    4 +-
 src/mpi/romio/mpi-io/glue/mpich/mpio_err.c         |    2 +-
 src/mpi/romio/mpi-io/glue/openmpi/mpio_err.c       |    4 +-
 src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c  |   10 +-
 src/mpid/ch3/include/mpid_rma_issue.h              |    4 +-
 src/mpid/ch3/include/mpid_rma_shm.h                |    4 +-
 src/mpid/ch3/include/mpidrma.h                     |    2 +-
 src/mpid/ch3/src/ch3u_handle_recv_req.c            |   10 +-
 src/mpid/ch3/src/ch3u_rma_pkthandler.c             |    6 +-
 src/mpid/ch3/src/mpid_rma.c                        |    4 +-
 .../common/datatype/mpid_type_create_pairtype.c    |   14 +-
 src/mpid/pamid/src/pamix/pamix.c                   |    8 +-
 src/mpl/include/mpl.h                              |    3 +
 src/pm/hydra/include/hydra.h                       |    2 -
 src/pm/hydra/pm/pmiserv/common.c                   |    6 +-
 src/pm/hydra/pm/pmiserv/pmip_pmi_v2.c              |    2 +-
 src/pm/hydra/pm/pmiserv/pmip_utils.c               |    6 +-
 src/pm/hydra/pm/pmiserv/pmiserv_cb.c               |    4 +-
 src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c           |   10 +-
 src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c           |   12 +-
 .../bootstrap/external/external_common_launch.c    |    2 +-
 src/pm/hydra/tools/bootstrap/external/ll_launch.c  |    2 +-
 src/pm/hydra/ui/mpich/utils.c                      |    4 +-
 src/pm/hydra/utils/dbg/dbg.c                       |    2 +-
 src/pm/hydra/utils/sock/sock.c                     |    2 +-
 src/pm/hydra/utils/string/string.c                 |    6 +-
 src/pmi/pmi2/poe/poe2pmi.c                         |    2 +-
 src/pmi/pmi2/simple/pmi2compat.h                   |    1 -
 src/pmi/pmi2/simple/simple2pmi.c                   |   16 +-
 src/pmi/pmi2/simple/simple_pmiutil.c               |    4 +-
 src/pmi/simple/simple_pmi.c                        |    3 +-
 src/util/type/mpiu_type_defs.h                     |    3 -
 129 files changed, 504 insertions(+), 650 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list