Timeline for Implement a “split” synchronization barrier for C++ with OpenMP
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 23 at 18:54 | history | edited | G. Sliepen | CC BY-SA 4.0 |
added 2 characters in body
|
| May 23 at 9:29 | comment | added | user2233709 |
Oh, stupid me, I missed the std::optional when I read your example code !
|
|
| May 23 at 9:12 | comment | added | G. Sliepen |
The emplace() method comes from std::optional. As for the undefined behaviour, I think it's fine this way (std::barrier has exactly the same issue), I just wanted to point it out.
|
|
| May 23 at 7:59 | vote | accept | user2233709 | ||
| May 23 at 7:59 | comment | added | user2233709 |
About the unnecessary waiting, I was also aware of that. In your 5-parts example, I would have used 2 distinct split_barrier objects. In my use-case, I have only 4 parts with a hard barrier between parts 3 and 4 and the whole section is enclosed in a while loop. Hence, I needed my barrier object to be re-usable, but I did not find a way to to allow some threads to enter the barrier in iteration n+1 while others have not left it in iteration n. I also did not care since the hard barrier ensures it cannot happen anyway.
|
|
| May 23 at 7:58 | comment | added | user2233709 | As for the deadlock if the object in not correctly initialized before it is used, I was aware of that, but considered such a misuse should be considered (or, better, be documented as) undefined behaviour. | |
| May 23 at 7:46 | comment | added | user2233709 |
Thanks a lot for pointing me to the std::barrier C++-20 standard class, although the doc does not mention the emplace() method… That’s exactly what I was looking for on StackOverflow. If you have an account there, please consider writing an answer so I can accept it!
|
|
| May 22 at 18:50 | history | edited | G. Sliepen | CC BY-SA 4.0 |
added 18 characters in body
|
| May 22 at 18:25 | history | answered | G. Sliepen | CC BY-SA 4.0 |