1
1

Reenable the integration of OPAL level timers with

MPI_Wtime and MPI_Wtick.
Merge branch 'topic/accurate_timers'
Этот коммит содержится в:
George Bosilca 2014-11-24 00:50:14 -05:00
родитель 2e00e335b9 d4edd097c0
Коммит 7f191f1196
9 изменённых файлов: 28 добавлений и 42 удалений

Просмотреть файл

@ -40,7 +40,9 @@ double MPI_Wtick(void)
{ {
OPAL_CR_NOOP_PROGRESS(); OPAL_CR_NOOP_PROGRESS();
#if OPAL_TIMER_USEC_NATIVE #if OPAL_TIMER_CYCLE_NATIVE
return opal_timer_base_get_freq();
#elif OPAL_TIMER_USEC_NATIVE
return 0.000001; return 0.000001;
#else #else
/* Otherwise, we already return usec precision. */ /* Otherwise, we already return usec precision. */

Просмотреть файл

@ -40,7 +40,9 @@ double MPI_Wtime(void)
{ {
double wtime; double wtime;
#if OPAL_TIMER_USEC_NATIVE #if OPAL_TIMER_CYCLE_NATIVE
wtime = ((double) opal_timer_base_get_cycles()) / opal_timer_base_get_freq();
#elif OPAL_TIMER_USEC_NATIVE
wtime = ((double) opal_timer_base_get_usec()) / 1000000.0; wtime = ((double) opal_timer_base_get_usec()) / 1000000.0;
#else #else
/* Fall back to gettimeofday() if we have nothing else */ /* Fall back to gettimeofday() if we have nothing else */

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -25,19 +25,6 @@ typedef uint64_t opal_timer_t;
#if OPAL_GCC_INLINE_ASSEMBLY #if OPAL_GCC_INLINE_ASSEMBLY
#if 0
static inline opal_timer_t
opal_sys_timer_get_cycles(void)
{
opal_timer_t ret;
__asm__ __volatile__("rdtsc" : "=A"(ret));
return ret;
}
#else
static inline opal_timer_t static inline opal_timer_t
opal_sys_timer_get_cycles(void) opal_sys_timer_get_cycles(void)
{ {
@ -46,8 +33,6 @@ opal_sys_timer_get_cycles(void)
return ((opal_timer_t)a) | (((opal_timer_t)d) << 32); return ((opal_timer_t)a) | (((opal_timer_t)d) << 32);
} }
#endif
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1 #define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
#else #else

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -21,20 +21,24 @@
#include "opal_config.h" #include "opal_config.h"
#include <mach/mach_time.h> #include <mach/mach_time.h>
#include <CoreServices/CoreServices.h>
typedef uint64_t opal_timer_t; typedef uint64_t opal_timer_t;
/* frequency in mhz */ /* frequency in mhz */
OPAL_DECLSPEC extern opal_timer_t opal_timer_darwin_freq; OPAL_DECLSPEC extern opal_timer_t opal_timer_darwin_freq;
OPAL_DECLSPEC extern mach_timebase_info_data_t opal_timer_darwin_info;
static inline opal_timer_t static inline opal_timer_t
opal_timer_base_get_cycles(void) opal_timer_base_get_cycles(void)
{ {
if( opal_timer_darwin_info.denom == 0 ) {
(void) mach_timebase_info(&opal_timer_darwin_info);
}
/* this is basically a wrapper around the "right" assembly to get /* this is basically a wrapper around the "right" assembly to get
the tick counter off the PowerPC Time Base. I believe it's the tick counter off the PowerPC Time Base. I believe it's
something similar on x86 */ something similar on x86 */
return mach_absolute_time(); return mach_absolute_time() * opal_timer_darwin_info.numer / opal_timer_darwin_info.denom / 1000;
} }
@ -53,9 +57,9 @@ opal_timer_base_get_freq(void)
} }
#define OPAL_TIMER_CYCLE_NATIVE 1 #define OPAL_TIMER_CYCLE_NATIVE 0
#define OPAL_TIMER_CYCLE_SUPPORTED 1 #define OPAL_TIMER_CYCLE_SUPPORTED 1
#define OPAL_TIMER_USEC_NATIVE 0 #define OPAL_TIMER_USEC_NATIVE 1
#define OPAL_TIMER_USEC_SUPPORTED 1 #define OPAL_TIMER_USEC_SUPPORTED 1
#endif #endif

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -20,17 +20,15 @@
#include "opal_config.h" #include "opal_config.h"
#include <mach/mach_time.h>
#include "opal/mca/timer/timer.h" #include "opal/mca/timer/timer.h"
#include "opal/mca/timer/darwin/timer_darwin.h" #include "opal/mca/timer/darwin/timer_darwin.h"
#include "opal/constants.h" #include "opal/constants.h"
opal_timer_t opal_timer_darwin_freq; opal_timer_t opal_timer_darwin_freq;
mach_timebase_info_data_t opal_timer_darwin_info;
static int opal_timer_darwin_open(void); static int opal_timer_darwin_open(void);
const opal_timer_base_component_2_0_0_t mca_timer_darwin_component = { const opal_timer_base_component_2_0_0_t mca_timer_darwin_component = {
/* First, the mca_component_t struct containing meta information /* First, the mca_component_t struct containing meta information
about the component itself */ about the component itself */
@ -95,11 +93,6 @@ int opal_timer_darwin_open(void)
nanoseconds, taking the reverse of that and multipling by nanoseconds, taking the reverse of that and multipling by
1000000000 will give you a frequency in cycles / second if you 1000000000 will give you a frequency in cycles / second if you
think of mach_absolute_time() always returning a cycle count. think of mach_absolute_time() always returning a cycle count.
By the way, it's interesting to note that because these are
library functions and because of how rosetta works, a PPC
binary running under rosetta on an Intel Mac will behave
exactly like an Intel binary running on an Intel Mac.
*/ */
opal_timer_darwin_freq = sTBI.denom * (1000000000 / sTBI.numer); opal_timer_darwin_freq = sTBI.denom * (1000000000 / sTBI.numer);

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -56,7 +56,7 @@ opal_timer_base_get_freq(void)
#define OPAL_TIMER_CYCLE_NATIVE OPAL_HAVE_SYS_TIMER_GET_CYCLES #define OPAL_TIMER_CYCLE_NATIVE OPAL_HAVE_SYS_TIMER_GET_CYCLES
#define OPAL_TIMER_CYCLE_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES #define OPAL_TIMER_CYCLE_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES
#define OPAL_TIMER_USEC_NATIVE 0 #define OPAL_TIMER_USEC_NATIVE OPAL_HAVE_SYS_TIMER_GET_CYCLES
#define OPAL_TIMER_USEC_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES #define OPAL_TIMER_USEC_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES
#endif #endif

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University * Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,