Episode 145: 🇸🇮 SRT23 - Parallel std::unique #36
Replies: 3 comments 2 replies
-
I'm not sure how adjacent_difference is implemented in parallel in the first place but I imagine a similar approach could be used to deduplicate. In response to Connor's note that if you run a parallel deduplicate that you'd have to run it again on the joined set, in reality you'd only need to do this on the very edge elements. So if there's some way to overlap the chunks that you're parallelizing over it seems like this could be done in a single pass |
Beta Was this translation helpful? Give feedback.
-
This pattern is so familiar with Stencil programming. If you chunk the array, each chunk needs to get last element from previous chunk. Scientifically called "ghost" region. And it should be possible in 1 pass. Here's the alternate problem, select an element if it's not seen in window of last |
Beta Was this translation helpful? Give feedback.
-
I don't get how you can do Assuming you are writing to a new structure, you have the same problem. As such, you always have a second loop over the result (assuming no duplicates, this would be all data) or does this not count as a second pass? A quick implementation of how I would approach this problem can be found here: https://compiler-explorer.com/z/boPcr1451 PS: I still have to listen to 147 |
Beta Was this translation helpful? Give feedback.
-
Episode Link: https://adspthepodcast.com/2023/09/01/Episode-145.html
Feel free to write comments or ask questions 🙂
Beta Was this translation helpful? Give feedback.
All reactions