Skip to content

mpi/c: Force wtick/wtime to use gettimeofday #3184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 19, 2017

Conversation

jjhursey
Copy link
Member

Workaround for Issue #3003

  • Some relatively minor changes to the timer/linux component
  • Force wtick/wtime to use gettimeofday instead of the high precision timers until we figure out a portable way to calibrate them.

jsquyres and others added 3 commits March 15, 2017 21:03
This variable is only used in one file, so make it static.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Several component-specific functions were named with a prefix of
"opal_timer_base", which was quite confusing.  Rename them to have a
prefix "opal_timer_linux" to make it clear that they are here in this
component (and different than *actual* opal_timer_base symbols).

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
 * 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>
@jsquyres
Copy link
Member

@hppritcha @bosilca @hjelmn Please comment / review.

There are 2 trivial cleanup commits for the Linux timer component; the 3rd commit does the temporary fix of nailing WTICK/WTIME down to always use gettimeofday(3), per #3003.

@jsquyres
Copy link
Member

I think the main question here is: (@bosilca @bwbarrett @hjelmn) How much do we want the clock_gettime() preference to gettimeofday()? If so, this PR needs to be amended -- likely including an additional configure check (probably involving AC_RUN_IFELSE) for clock_gettime on OS X.

@jsquyres jsquyres requested review from bosilca and hjelmn March 16, 2017 14:43
#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;
#endif
#else
/* Fall back to gettimeofday() if we have nothing else */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjelmn + me suggest putting something like:

#if _LINUX_ && OPAL_HAVE_CLOCK_GETTIME
// ... use clock_gettime(..) ...
#else
// ... use gettimeofday(..) ...
#endif

That way, we don't need a new configure test -- we only use clock_gettime if a) we're on Linux, and b) our existing configure test says that we have clock_gettime (i.e., we sidestep the whole OS X problem).

@jsquyres jsquyres merged commit 48d13aa into open-mpi:master Mar 19, 2017
@jjhursey jjhursey deleted the topic/timer-gettimeofday branch March 20, 2017 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants