cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
20 stars 3 forks source link

scheduler query for whether nested parallelism is supported/efficient #84

Open ericniebler opened 11 months ago

ericniebler commented 11 months ago

Issue by ericniebler Thursday Feb 03, 2022 at 18:20 GMT Originally opened as https://github.com/NVIDIA/stdexec/issues/451


None

ericniebler commented 11 months ago

Comment by LeeHowes Thursday Feb 03, 2022 at 18:26 GMT


What does this mean? Is the question whether it is ok to do blocking parallelism within parallel tasks?

Presumably it would only apply to launching a synchronous parallel operation on the same scheduler as the parent?

ericniebler commented 11 months ago

Comment by ericniebler Thursday Feb 03, 2022 at 19:14 GMT


I'm going to let @rarutyun and @senior-zero answer because I will probably fail to capture their intent accurately.

ericniebler commented 11 months ago

Comment by rarutyun Monday Feb 28, 2022 at 09:26 GMT


What does this mean? Is the question whether it is ok to do blocking parallelism within parallel tasks?

Yes (if we are on the same page from terminology perspective)

Presumably it would only apply to launching a synchronous parallel operation on the same scheduler as the parent?

That is the good question. I tend to say yes unless I realize other use-cases. But currently it's hard to imagine "nested parallelism" on different schedulers, so let's assume that we talk about the same one for now

ericniebler commented 11 months ago

Comment by vossmjp Monday Feb 28, 2022 at 14:50 GMT


I think it's a common case to have nested parallelism that uses different threading models. For example, you might have a library implemented using OpenMP that is called from a TBB parallel for. So we have to be careful to define what "efficient nested parallelism" means exactly. My guess is the query has to be about whether it's ok to create more parallelism using the same scheduler that created the outer parallelism, because otherwise I think its generally impossible to answer the question. So the cases of two schedulers exist, but that can't be what the query is about.

ericniebler commented 11 months ago

Comment by LeeHowes Monday Feb 28, 2022 at 17:31 GMT


Is it specifically related to blocking though or to the more general idea of enqueuing tasks recursively. The latter should presumably always be possible if the dependencies are safe, but might not be wise. The former would usually be impossible except in narrow cases, and require a lot of backchannelling of state to make it work at all, and I question the value of trying to specify it at all.