Skip to content

benchmark: add a task-overhead suite (tasks) - #788

Open
AnnaLena77 wants to merge 4 commits into
JuliaParallel:masterfrom
AnnaLena77:pr/a0d-tasks-benchmark
Open

AnnaLena77 wants to merge 4 commits into
JuliaParallel:masterfrom
AnnaLena77:pr/a0d-tasks-benchmark

Conversation

@AnnaLena77

Copy link
Copy Markdown

This adds a benchmark suite that measures the runtime's own per-task cost, which the existing array, linalg, sparse and stencil suites do not isolate. It only touches benchmark/; no source file changes.

The suite tasks times microsecond task bodies with explicit ExactScope placement: round-robin and single-owner pinned spawns, unscoped spawns, a cross-owner dependent chain (hop latency), a pairwise fan-in tree and a multi-phase exchange step. Variants whose bodies may throw are included, since most real task bodies look like that and they take a different path under MPI than a provably non-throwing no-op. A rank-local variant is included for communicators of size one.

wait() does not rethrow a failed task, so a benchmark whose tasks all fail would finish in microseconds. Every benchmark is therefore checked once at a tiny size with fetch() when the suite is built, and skipped with a warning if it does not produce the expected value.

The suite is opt-in (BENCHMARK=tasks:dagger) and is not added to the default set. I would like to have it upstream because the scheduler pull requests that follow quote their numbers from it.

AI disclosure: I prepared this change with the help of Claude (Anthropic) and reviewed it myself.
🤖 Generated with Claude Code

The array/linalg/sparse/stencil suites measure tile compute and data
movement. None isolates the runtime's own per-task cost, which is what
limits latency-bound programs (many small tasks, short dependent phases)
and, under MPI, what every rank pays for tasks it never runs.

The new "tasks" suite times, with microsecond task bodies and explicit
ExactScope placement: round-robin and single-owner pinned spawns,
unscoped spawns, a cross-owner dependent chain (hop latency), a pairwise
fan-in tree, and a multi-phase exchange step (local stages, one small array
per owner pair, a final local stage). A rank-local variant is included when
MPI processors refuse DistributedAcceleration tasks.

wait() does not rethrow a failed task, so a benchmark whose tasks all fail
would 'run' in microseconds. Every benchmark is therefore checked once at a
tiny size with fetch() when the suite is built, and skipped with a warning
when it does not produce the expected value. Opt-in via BENCHMARK=tasks:dagger
(not added to the default set).
… tasks that may throw

The single-owner benchmark runs on the first owner, i.e. on the process that
records the timing, so it measures the owner. Add a variant pinned to the last
owner, where the recording process only has to plan the tasks, and variants
whose bodies cannot be proven not to throw (concrete return type, may error),
which is what most real task bodies look like and which take a different path
under MPI than the provably non-throwing noop.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant