NVIDIA / NVIDIA/stdexec

How to achieve execution agent local variable?

Open
#1,259 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.4k
Forks
270
Avg merge
3d 6h
Merged PRs (30d)
39

Description

Sometimes we need some variables to be execution agent local. Taking a use-case of parallel random number generation. If I want random number generator to be non-blocking for multiple threads, then each thread should have a separate copy of random generator.

For example, in case of a thread pool scheduler a thread_local random generator can be used. But that's not a generic solution.

I don't know how to handle the same with P2300. Is there some way to handle this kind of use-case?

I feel the use-case can be solved if I have 2 queries:

  • Maximum number of tasks that can be executed concurrently at any moment of time. (can be unbounded too)
  • Let's say the above query returns n. Then a query like current_execution_id that returns [0, n) representing on which execution agent task is currently at.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing P2300's execution-agent model and how stdexec represents scheduler or execution context. Compare the proposed concurrency-count and current-execution-id queries with the per-thread random-generator use case. Done would require a maintainer decision or documented supported design; this remains an unanswered design question.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.