Skip to content

MPI: drop a plain task's ref-id counter when the task is done - #793

Open
AnnaLena77 wants to merge 1 commit into
JuliaParallel:masterfrom
AnnaLena77:pr/a8c-refid-leak
Open

AnnaLena77 wants to merge 1 commit into
JuliaParallel:masterfrom
AnnaLena77:pr/a8c-refid-leak

Conversation

@AnnaLena77

Copy link
Copy Markdown

_MPIREF_TID holds one sub-counter per task id for the ref ids a task takes while it is moved and executed. It was reclaimed only at the end of a Datadeps region, so a program that only uses @spawn grew it by one entry per task for the whole session. A task that is not part of a Datadeps region (no tag option) takes ids only during its own move and execute!, never during planning, so its counter is dead once execute! returns; it is deleted there. Tagged (Datadeps) tasks keep the later cleanup, since their planning shares the key with their execution and reclaiming in between would collide on sub-ids.

Test in test/mpi/spawn.jl: 300 plain tasks (unscoped, pinned, and with a body that may throw) must leave the table within 20 entries, and task ids stay uniform afterwards. At 2 ranks x 2 threads the test fails on current master (the table grows) and passes with this change.

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

_MPIREF_TID holds one sub-counter per task id for the ref ids a task takes
while it is moved and executed. It was reclaimed only at the end of a Datadeps
region, so a program that only uses @Spawn grew it by one entry per task for
the whole session. A task that is not part of a Datadeps region (no tag
option) takes ids only during its own move and execute!, never during
planning, so its counter is dead once execute! returns: delete it there.
Tagged (Datadeps) tasks keep the later cleanup, since their planning shares
the key with their execution and reclaiming in between would collide on
sub-ids.

Test (test/mpi/spawn.jl): 300 plain tasks (unscoped, pinned, and with a body
that may throw) must leave the table within 20 entries, and task ids stay
uniform afterwards. At 2 ranks x 2 threads (MPICH) the test fails on upstream
master (the table grows) and passes with this change.

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