Different Execution Orders and Deterministic Results

Concurrent tasks may finish in another order than they were started. A deterministic result uses documented ordering or a combination rule that makes completion order irrelevant.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a result list
  2. Check where order changes meaning
  3. Preserve a deterministic reduction despite reordered completion
  4. Check which effects cannot be reordered safely

Trace a result list

Jobs one, two, and three may finish as two, three, one. Storing results by original ID can still present them as one, two, three. Stable identities support that selection.

Check where order changes meaning

Concatenating results on arrival yields different text when completion order changes. Order-sensitive reduction explains which transformations preserve order.[1]

Preserve a deterministic reduction despite reordered completion

Three independent tasks produce rows for IDs seven, nine and eleven. Completion order can vary. Writing each output into its assigned position or sorting by a fixed key can produce the same public order. See parallel mapping positions.

Run A completes 7,9,11
Run B completes 11,7,9
Desired result in both: 7,9,11
Store per-task outputs before stable assembly

Check which effects cannot be reordered safely

Shared updates, external calls or floating-point operations can make execution order observable. Separate independent computation from publishing effects. Test with deliberate changes in completion schedule.

References

  1. OpenMP Architecture Review Board, OpenMP API Specifications ↩