steve-downey / sender-examples

Example code for C++Now talk
Apache License 2.0
2 stars 2 forks source link

factorial example without any_sender_of #1

Open weilewei opened 1 year ago

weilewei commented 1 year ago

Hi Steve,

This is Weile! We met at CppNow 2023 and I attended your talk.

I am studying your factorial sender example and I would like to know if we don't have any_sender_of, how should we implement the factorial example? My understanding is that having return type of any_sender_of on fac() function can take two different return types just and just<let_value < then> >.

The reason is I would like to run it on nvexec, a gpu scheduler provided by nvidia stdexec library, but nvexec does not support any_sender_of yet. So I wonder if there is any workaround?

I don't have your contact, so I just drop a ticket here. Thanks!

steve-downey commented 1 year ago

The any_sender_of not only handles the two different return types, it erases the recursion in the type system, since the type of the return from then refers to itself. You need something any that to handle factorial, or other recursion schemes, unfortunately. At least when I've tried. The compiler tries valiantly until it runs out of memory.

I haven't looked at making these work with nvc++ yet.

Does stdexec's any_sender_of not support nvc++, or is it one shipped with the compiler?

On Tue, Jul 11, 2023 at 1:03 PM wei @.***> wrote:

Hi Steve,

This is Weile! We met at CppNow 2023 and I attended your talk.

I am studying your factorial sender example and I would like to know if we don't have any_sender_of, how should we implement the factorial example? My understanding is that having return type of any_sender_of on fac() function can take two different return types just and just<let_value < then> >.

The reason is I would like to run it on nvexec, a gpu scheduler provided by nvidia stdexec https://github.com/NVIDIA/stdexec/tree/main library, but nvexec does not support any_sender_of yet. So I wonder if there is any workaround?

I don't have your contact, so I just drop a ticket here. Thanks!

— Reply to this email directly, view it on GitHub https://github.com/steve-downey/sender-examples/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVNZ5WSDOOJPI27A2LKPZLXPWBNPANCNFSM6AAAAAA2GJSCNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

weilewei commented 1 year ago

Hi Steve,

Thanks so much for the quick response!

I think any_sender_of is not shipped by the nvc++ compiler, and only supported through the stdexec library. I wanted to run factorial style algorithm on GPU. I also just open a ticket for it on stdexec library: https://github.com/NVIDIA/stdexec/issues/995.

I also tried compile stdexec with coda enabled through gcc + cuda, but not much luck. Too many compilation errors.