Skip to content

Commit

Permalink
mpi/c: Force wtick/wtime to use gettimeofday
Browse files Browse the repository at this point in the history
 * See open-mpi#3003 for a discussion about
   this patch. Once we get a better version in place we can revert this
   change.

Signed-off-by: Joshua Hursey <jhursey@us.ibm.com>
  • Loading branch information
jjhursey authored and sjeaugey committed May 4, 2017
1 parent c58875d commit 18ef203
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ompi/mpi/c/wtick.c
Expand Up @@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -40,6 +41,12 @@ double MPI_Wtick(void)
{
OPAL_CR_NOOP_PROGRESS();

/*
* See https://github.com/open-mpi/ompi/issues/3003
* For now we are forcing the use of gettimeofday() until we find a
* more portable solution.
*/
#if 0
#if OPAL_TIMER_USEC_NATIVE
/* We may or may not have native usec precision on Windows, so put
this #if before the #ifdef checking for Windows. */
Expand All @@ -49,6 +56,7 @@ double MPI_Wtick(void)
opal_output( 0, "No timer frequency\n" );
}
return (double)opal_timer_base_get_freq();
#endif
#else
/* Otherwise, we already return usec precision. */
return 0.000001;
Expand Down
8 changes: 8 additions & 0 deletions ompi/mpi/c/wtime.c
Expand Up @@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -40,13 +41,20 @@ double MPI_Wtime(void)
{
double wtime;

/*
* See https://github.com/open-mpi/ompi/issues/3003
* For now we are forcing the use of gettimeofday() until we find a
* more portable solution.
*/
#if 0
#if OPAL_TIMER_USEC_NATIVE
/* We may or may not have native usec precision on Windows, so put
this #if before the #ifdef checking for Windows. */
wtime = ((double) opal_timer_base_get_usec()) / 1000000.0;
#elif defined(__WINDOWS__)
wtime = ((double) opal_timer_base_get_cycles()) /
((double) opal_timer_base_get_freq());
#endif
#else
/* Fall back to gettimeofday() if we have nothing else */
struct timeval tv;
Expand Down

0 comments on commit 18ef203

Please sign in to comment.