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

Add option to use OneTBB for multithreading #67

Open
jdumas opened this issue Mar 1, 2023 · 2 comments
Open

Add option to use OneTBB for multithreading #67

jdumas opened this issue Mar 1, 2023 · 2 comments
Milestone

Comments

@jdumas
Copy link
Contributor

jdumas commented Mar 1, 2023

It'd be great to be able to use OneTBB as the multithreading backend. Using the same scheduler in a larger app really helps avoiding oversubscription in general. When I was at nTopology I did some work in this direction in our geogram fork at the time (using an older TBB version). Maybe this can provide some inspiration. One important change is that TBB's spinlock cannot be initialized with an assignment constructor (foo = x syntax), so this requires a few extra changes in the rest of Geogram.

@BrunoLevy
Copy link
Owner

I have in mind two things:

  • for spinlocks, replace them with std::atomic. Do you have an experience with it ? I don't know whether it is efficiently implemented in the compilers (I'll take a look at the generated asm when I have time)
  • geogram's thread manager is abstracted, so it would be easy to have a OneTBB implementation

@jdumas
Copy link
Contributor Author

jdumas commented Mar 2, 2023

I think std::atomic should be generally faster than any mutex implementation, but it really depends on the usage, so one would need to profile to be sure. TBB has its own spin_mutex implementation, among many other flavors. They have a page that explains the different flavors and how they scale wrt to each others. I am not familiar enough with them to know which one would be more suited for Geogram.

@BrunoLevy BrunoLevy added this to the Contexts milestone Mar 3, 2023
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

No branches or pull requests

2 participants