[mpich2-commits] r7523 - in mpich2/trunk: . src/include src/mpi/timer
gropp at mcs.anl.gov
gropp at mcs.anl.gov
Mon Nov 29 14:52:20 CST 2010
Author: gropp
Date: 2010-11-29 14:52:20 -0600 (Mon, 29 Nov 2010)
New Revision: 7523
Modified:
mpich2/trunk/configure.in
mpich2/trunk/src/include/mpichtimer.h.in
mpich2/trunk/src/mpi/timer/mpidtime.c
Log:
Add OSX mach_absolute_time as known timer type and clean up incomplete deletion of linuxalpha timer
Modified: mpich2/trunk/configure.in
===================================================================
--- mpich2/trunk/configure.in 2010-11-29 19:23:58 UTC (rev 7522)
+++ mpich2/trunk/configure.in 2010-11-29 20:52:20 UTC (rev 7523)
@@ -5184,23 +5184,26 @@
AC_ARG_ENABLE(timer-type,
[ --enable-timer-type=name - Select the timer to use for MPI_Wtime and
internal timestamps.
- gethrtime - Solaris timer (Solaris systems only)
- clock_gettime - Posix timer (where available)
- gettimeofday - Most Unix systems
- linux86_cycle - Linux x86; returns cycle counts, not time in seconds*
- linuxalpha_cycle - Like linux86_cycle, but for Linux Alpha*
- gcc_ia64_cycle - IPF ar.itc timer*
+ gethrtime - Solaris timer (Solaris systems only)
+ clock_gettime - Posix timer (where available)
+ gettimeofday - Most Unix systems
+ linux86_cycle - Linux x86; returns cycle counts, not time in seconds*
+ gcc_ia64_cycle - IPF ar.itc timer*
+ mach_absolute_time - Mach absolute time (alternative to clock_gettime
+ for OSX)
device - The timer is provided by the device
*Note that the cycle timers are intended to be used by MPICH2
developers for internal low-level timing. Normal users should
not use these as they are not guaranteed to be accurate in
- certain situations
+ certain situations.
+
+ linuxalpha_cycle is no longer supported.
],timer_type=$enable_timer_type)
if test -z "$timer_type" ; then
# Try to pick a timer based on what is available
- AC_CHECK_FUNCS(clock_gettime clock_getres gethrtime gettimeofday)
+ AC_CHECK_FUNCS(clock_gettime clock_getres gethrtime mach_absolute_time gettimeofday)
if test "$ac_cv_func_gethrtime" = "yes" ; then
# Sigh. The Solaris include files do not define hrtime_t
# Before we accept this choice, make sure that we can
@@ -5224,6 +5227,8 @@
# Test on both because some systems (e.g., cygwin) provide
# clock_gettime but not clock_getres
timer_type=clock_gettime
+ elif test "$ac_cv_func_mach_absolute_time" = "yes" ; then
+ timer_type=mach_absolute_time
elif test "$ac_cv_func_gettimeofday" = "yes" ; then
timer_type=gettimeofday
fi
@@ -5428,18 +5433,15 @@
;;
linuxalpha_cycle)
- # See the code in mpidtime.c. This is a trivial test for now.
- AC_CACHE_CHECK([that linux alpha cycle counter is available],
-pac_cv_linuxalpha_cycle,[
- AC_TRY_COMPILE(,[
-#error "LinuxAlpha cycle counter not supported"
-],pac_cv_linuxalpha_cycle=yes,pac_cv_linuxalpha_cycle=no)])
- if test "$pac_cv_linuxalpha_cycle" != "yes" ; then
- AC_MSG_ERROR([LinuxAlpha cycle counter is not available on this system and/or with the $CC compiler])
- fi
- MPID_TIMER_TYPE="long"
+ AC_MSG_ERROR([linuxalpha_cycle is no longer supported])
;;
+ mach_absolute_time)
+ AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])])
+ AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])])
+ MPID_TIMER_TYPE="uint64_t"
+ ;;
+
device)
# The device selected should export the datatype for the timer
# in MPID_DEVICE_TIMER_TYPE if something other than long is needed
Modified: mpich2/trunk/src/include/mpichtimer.h.in
===================================================================
--- mpich2/trunk/src/include/mpichtimer.h.in 2010-11-29 19:23:58 UTC (rev 7522)
+++ mpich2/trunk/src/include/mpichtimer.h.in 2010-11-29 20:52:20 UTC (rev 7523)
@@ -25,6 +25,7 @@
/* The value "USE_DEVICE" means that the ADI device provides the timer */
#define USE_DEVICE 9
#define USE_WIN64_CYCLE 10
+#define USE_MACH_ABSOLUTE_TIME 11
#define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
#if MPICH_TIMER_KIND == USE_GETHRTIME
@@ -45,6 +46,8 @@
#elif MPICH_TIMER_KIND == USE_QUERYPERFORMANCECOUNTER
#include <winsock2.h>
#include <windows.h>
+#elif MPICH_TIMER_KIND == USE_MACH_ABSOLUTE_TIME
+#include <mach/mach_time.h>
#elif MPICH_TIMER_KIND == USE_WIN86_CYCLE
#include <winsock2.h>
#include <windows.h>
Modified: mpich2/trunk/src/mpi/timer/mpidtime.c
===================================================================
--- mpich2/trunk/src/mpi/timer/mpidtime.c 2010-11-29 19:23:58 UTC (rev 7522)
+++ mpich2/trunk/src/mpi/timer/mpidtime.c 2010-11-29 20:52:20 UTC (rev 7523)
@@ -44,7 +44,6 @@
return 1.0e-9;
}
-
#elif MPICH_TIMER_KIND == USE_CLOCK_GETTIME
void MPID_Wtime( MPID_Time_t *timeval )
{
@@ -219,7 +218,8 @@
}
#elif MPICH_TIMER_KIND == USE_LINUXALPHA_CYCLE
-
+/* FIXME: This should have been fixed in the configure, rather than as a
+ make-time error message */
#error "LinuxAlpha cycle counter not supported"
#elif (MPICH_TIMER_KIND == USE_WIN86_CYCLE) || (MPICH_TIMER_KIND == USE_WIN64_CYCLE)
@@ -335,7 +335,45 @@
}
+#elif MPICH_TIMER_KIND == USE_MACH_ABSOLUTE_TIME
+static double MPIR_Wtime_mult;
+int MPID_Wtime_init(void)
+{
+ mach_timebase_info_data_t info;
+ mach_timebase_info(&info);
+ MPIR_Wtime_mult = 1.0e-9 * ((double)info.numer / (double)info.denom);
+ return MPI_SUCCESS;
+}
+void MPID_Wtime( MPID_Time_t *timeval )
+{
+ *timeval = mach_absolute_time();
+}
+void MPID_Wtime_diff( MPID_Time_t *t1, MPID_Time_t *t2, double *diff )
+{
+ *diff = (*t2 - *t1) * MPIR_Wtime_mult;
+}
+void MPID_Wtime_todouble( MPID_Time_t *t, double *val )
+{
+ *val = *t * MPIR_Wtime_mult;
+}
+void MPID_Wtime_acc( MPID_Time_t *t1, MPID_Time_t *t2, MPID_Time_t *t3 )
+{
+ *t3 = *t1 + *t2;
+}
+
+/* FIXME: We need to cleanup the use of the MPID_Generic_wtick prototype */
+double MPID_Generic_wtick(void);
+
+double MPID_Wtick( void )
+{
+ return MPID_Generic_wtick();
+}
+#define MPICH_NEEDS_GENERIC_WTICK
+/* Rename the function so that we can access it */
+#define MPID_Wtick MPID_Generic_wtick
+
+
#endif
#ifdef MPICH_NEEDS_GENERIC_WTICK
More information about the mpich2-commits
mailing list