Jean-Loup,

> I am currently looking for a data structure that basically behaves like
> TBB's `concurrent_queue<T>`, except for the `pop()` operation which would
> return a `hpx::future<T>`, and would never fail. This way, `get()`-ting
> the result would suspend the thread until the `pop()` has succeeded
> (possibly never if the queue remains empty). Such a queue would be very
> useful to manage tasks awaiting computing resources such as preallocated
> memory buffers or CUDA streams.
> 
> hpx::lcos::local::channel is exactly what you need.

Well, channel is actually more than a concurrent queue. It currently allows for 
out-of-order insertion/extraction of elements (it's essentially a concurrent 
map with an asynchronous interface). But Thomas  is right, conceptually, 
channel exposes exactly the interface you're looking for and it should be 
possible to create a variation on the channel-theme based on a 'real' queue. 
This might give you better performance than the generic channel we have today.

For the current channel implementation, please see [1], for an example see [2].

HTH
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu

[1] https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/lcos/local/channel.hpp
[2] 
https://github.com/STEllAR-GROUP/hpx/blob/master/examples/quickstart/local_channel.cpp

> 
> 
> In my specific use case, the queue would only need to be local, and should
> not be accessed from another locality (same NUMA domain should be okay,
> though). Moreover, I will only need T = unsigned int.
> 
> I can certainly roll-out my own version of such a concurrent queue if
> needed, but I would prefer to avoid reinventing the square wheel if
> something similar already exists :-)
> 
> Is any of you aware of such a data structure or of a similar one ? Thanks
> in advance for your suggestions.
> 
> Best regards,
> Jean-Loup Tastet
> 
> _______________________________________________
> hpx-users mailing list
> [email protected]
> https://mail.cct.lsu.edu/mailman/listinfo/hpx-users


_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to