Skip to content
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

Replaced nanosleep and sched_yield with STL routines #3825

Merged
merged 2 commits into from
Mar 11, 2021

Conversation

jrmadsen
Copy link
Contributor

@jrmadsen jrmadsen commented Mar 4, 2021

Benchmarked (via QuickBench:

      auto start = std::chrono::high_resolution_clock::now();
      std::this_thread::yield();
      std::this_thread::sleep_until(start + std::chrono::nanoseconds(c * 1000));

vs.

      std::this_thread::yield();
      std::this_thread::sleep_for(std::chrono::microseconds(c));

and found the latter to be more efficient.

@crtrott Can you take a look at HostBarrier::impl_backoff_wait_until_equal as a whole? There is a weird #if !defined(_WIN32) and the #else for Windows doesn't seem to implement the same algorithm at all.

- nanosleep and sched_yield are specific to UNIX
@jrmadsen jrmadsen requested a review from crtrott March 4, 2021 05:19
Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

LGTM regardless of whether we resolve the #if defined(_WIN32)

@crtrott
Copy link
Member

crtrott commented Mar 4, 2021

THe else doesn't implement the same algorithm due to the use of unix stuff in the other. Essentially it should be doing the same as Linux now if we can use non-unix specific stuff for it.

@crtrott
Copy link
Member

crtrott commented Mar 8, 2021

Jonathan do you want to address the windows stuff? I think its partly just removing a the alternative code path or?

@jrmadsen jrmadsen linked an issue Mar 9, 2021 that may be closed by this pull request
@dalg24 dalg24 merged commit 0f2bd41 into kokkos:develop Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error when compiled using gcc-aarch64-none-elf
3 participants