You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might be possible to teach bulk_invoke() and friends how to introspect the types of shared parameter objects to create automatically by inspecting a lambda's parameter types. This would avoid needing to use share<T>().
The text was updated successfully, but these errors were encountered:
This syntax shares the shared_integer parameters automatically, at the innermost levels of the execution hierarchy. Another convention would be to create a single shared_integer parameter at the outermost level. One reason to prefer the innermost level is that it's already possible to share something among all the agents by capturing a variable by reference, as this example does with the std::mutex variable.
We could also come up with some additional syntax to explicitly specify the level at which to share individual parameters. Something like this may be possible:
One drawback to this approach is that there's not really a way to initialize the values of the shared parameters besides simply calling their default constructor.
It might be worth investigating a way to call some other special constructor. For example, it would be convenient to be able to automatically create a container whose size is initialized to the number of execution agents sharing the vector. The problem is that the variable's lifetime begins before the execution agents -- so we can't just pass self to the variable's constructor. Even if we could, it's not clear that would be helpful -- which execution agent would we choose? And how would we guarantee that the object has been constructed before all agents call the user's function?
It might be possible to teach
bulk_invoke()
and friends how to introspect the types of shared parameter objects to create automatically by inspecting a lambda's parameter types. This would avoid needing to useshare<T>()
.The text was updated successfully, but these errors were encountered: