NVIDIA / stdexec

`std::execution`, the proposed C++ framework for asynchronous and parallel programming.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

repeat_n CPU implementation requested

weilewei opened this issue · comments

Dear stdexec developers,

I wonder if stdexec can implement a cpu version for repeat_n algorithms? This will help unify our cpu and gpu code where both use iteration concepts. For gpu code, I can use repeat_n without any issue; however, for cpu counterpart, I have to maintain a different version using for loop and sync_wait. Previously, I can use for-loop and sync_wait for both cpu and gpu applications within the same source code, but I cannot get the benefit of asynchronously composing senders.

With repeat_n cpu implementation, It would be very elegant for the portability story. Thanks.

Note that we have exec::repeat_effect_until which takes a generic predicate for it's stop condition. It's unit test also show how to define your own repeat n algorithm. It also avoids stack exhaustion by using a trampoline scheduler internally.

Dupe of #725