[mpich2-commits] r7779 - mpich2/trunk/src/mpi/coll
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Thu Jan 20 16:08:41 CST 2011
Author: goodell
Date: 2011-01-20 16:08:41 -0600 (Thu, 20 Jan 2011)
New Revision: 7779
Added:
mpich2/trunk/src/mpi/coll/collutil.h
Modified:
mpich2/trunk/src/mpi/coll/bcast.c
Log:
refactor MPIU_is_pof2 to a new collutil.h header
Reviewed by balaji at .
Modified: mpich2/trunk/src/mpi/coll/bcast.c
===================================================================
--- mpich2/trunk/src/mpi/coll/bcast.c 2011-01-20 22:08:39 UTC (rev 7778)
+++ mpich2/trunk/src/mpi/coll/bcast.c 2011-01-20 22:08:41 UTC (rev 7779)
@@ -6,6 +6,7 @@
*/
#include "mpiimpl.h"
+#include "collutil.h"
/* -- Begin Profiling Symbol Block for routine MPI_Bcast */
#if defined(HAVE_PRAGMA_WEAK)
@@ -23,26 +24,6 @@
#undef MPI_Bcast
#define MPI_Bcast PMPI_Bcast
-/* FIXME move to somewhere else */
-/* Returns non-zero if val is a power of two. If ceil_pof2 is non-NULL, it sets
- *ceil_pof2 to the power of two that is just larger than or equal to val.
- That is, it rounds up to the nearest power of two. */
-static inline int MPIU_is_pof2(int val, int *ceil_pof2)
-{
- int pof2 = 1;
-
- while (pof2 < val)
- pof2 *= 2;
- if (ceil_pof2)
- *ceil_pof2 = pof2;
-
- if (pof2 == val)
- return 1;
- else
- return 0;
-}
-
-
/* A binomial tree broadcast algorithm. Good for short messages,
Cost = lgp.alpha + n.lgp.beta */
#undef FUNCNAME
Added: mpich2/trunk/src/mpi/coll/collutil.h
===================================================================
--- mpich2/trunk/src/mpi/coll/collutil.h (rev 0)
+++ mpich2/trunk/src/mpi/coll/collutil.h 2011-01-20 22:08:41 UTC (rev 7779)
@@ -0,0 +1,28 @@
+/* -*- Mode: c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ * (C) 2011 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+
+#ifndef COLLUTIL_H_INCLUDED
+#define COLLUTIL_H_INCLUDED
+
+/* Returns non-zero if val is a power of two. If ceil_pof2 is non-NULL, it sets
+ *ceil_pof2 to the power of two that is just larger than or equal to val.
+ That is, it rounds up to the nearest power of two. */
+static inline int MPIU_is_pof2(int val, int *ceil_pof2)
+{
+ int pof2 = 1;
+
+ while (pof2 < val)
+ pof2 *= 2;
+ if (ceil_pof2)
+ *ceil_pof2 = pof2;
+
+ if (pof2 == val)
+ return 1;
+ else
+ return 0;
+}
+
+#endif /* !defined(COLLUTIL_H_INCLUDED) */
More information about the mpich2-commits
mailing list