Skip to content

Conversation

jsquyres
Copy link
Member

@jsquyres jsquyres commented Jan 1, 2022

This is an RFC for simple portable wrappers around clock_gettime(3) and clock_getres(3) (and falling back to gettimeofday(3) if clock_gettime is not available).

This PR came out of the discussion here and here (which have additional links to other and older conversations).

If this RFC is accepted, #8057 should be updated to use opal_clock_gettime() and opal_clock_getres().

@jsquyres
Copy link
Member Author

jsquyres commented Jan 1, 2022

bot:ompi:retest

1 similar comment
@jsquyres
Copy link
Member Author

jsquyres commented Jan 2, 2022

bot:ompi:retest

Copy link
Member

@bwbarrett bwbarrett left a comment

Choose a reason for hiding this comment

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

Looks good to me.

As of Dec 2021, it turns out that CLOCK_MONOTONIC can actually go
backwards on macOS (!).  Add two simple portable wrappers that use
CLOCK_MONOTONIC_RAW on Darwin (which doesn't go backwards) and
CLOCK_MONOTONIC everywhere else.

Additionally, if the underlying OS does not have clock_gettime(), use
gettimeofday() instead.

Signed-off-by: Jeff Squyres <[email protected]>
Update MPI_Wtick and MPI_Wtime to use the portable wrappers
opal_clock_gettime() and opal_clock_getres().

Signed-off-by: Jeff Squyres <[email protected]>
@jsquyres jsquyres force-pushed the pr/opal-clock-gettime branch from 1aace96 to e72b4e6 Compare January 2, 2022 15:12
@jsquyres
Copy link
Member Author

jsquyres commented Jan 2, 2022

@bwbarrett I changed the first commit:

  • It struck me that if we do not have clock_gettime(), we might not have struct timespec as well. So I added configury for that, and made that portable.
  • There was a bug in opal_clock_getres() in using gettimeofday to set usec precsion. Fixed.

@jsquyres jsquyres marked this pull request as ready for review January 2, 2022 18:50
@jsquyres
Copy link
Member Author

jsquyres commented Jan 4, 2022

I talked this PR through with @bosilca verbally today, and he's ok with it. Merging.

@jsquyres jsquyres merged commit cb3e03d into open-mpi:master Jan 4, 2022
@jsquyres jsquyres deleted the pr/opal-clock-gettime branch January 4, 2022 23:08
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