Skip to content

Add -seed to the Dragonfly/SlimFly UEC binaries and use a separate RNG seed for each switch - #20

Merged
tommasobo merged 1 commit into
spcl:mainfrom
salimsuhet:df-sf-seed
Oct 5, 2026
Merged

tommasobo merged 1 commit into
spcl:mainfrom
salimsuhet:df-sf-seed

Conversation

@salimsuhet

@salimsuhet salimsuhet commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

htsim_uec_df and htsim_uec_sf can't be run with different seeds, so repeated runs are not independent samples:

  • Fixed global seed. Both binaries hardcode seed = 13 and, unlike htsim_uec, have no -seed option.
  • Same switch RNG seed everywhere. Every DragonflySwitch and SlimFlySwitch seeds its std::mt19937 with the same value, 33. As a result, all switches draw the same random sequence. Under VALIANT/UGAL_L this means every switch picks the same intermediates in lockstep, which correlates path choices across the network.

Change (42 lines)

  • New -seed N option in main_uec_df.cpp and main_uec_sf.cpp. It reseeds srand/srandom with N, which also affects the UEC entropy (EV) choices.
  • Per-switch seeding. When -seed is given, each switch seeds its generator with std::seed_seq{N, switch_id}.
  • Default unchanged. Without -seed, the binaries behave exactly as before (seed 13, and 33 for every switch).

Validation

Workload: 1024-host random permutation, 2 MB per flow, VALIANT routing (Dragonfly p4a8h4, SlimFly p7q9). The per-flow FCTs were compared across runs:

Test Result
Patched binary without -seed vs. current main identical (bit-for-bit)
-seed 1 vs. -seed 1 identical (still deterministic)
-seed 1 vs. -seed 2 different

Effect of per-switch seeding on the same workload:

Config Mean FCT Max FCT Retransmissions
Dragonfly VALIANT, main (all switches seeded with 33) 91.6 µs 136.9 µs 6,482
Dragonfly VALIANT, -seed 1 90.1 µs 135.0 µs 3,901
Dragonfly VALIANT, -seed 2 89.9 µs 133.8 µs 4,003
SlimFly VALIANT, main 90.3 µs 126.6 µs 1,045
SlimFly VALIANT, -seed 1 90.5 µs 127.6 µs 1,000

FCT changes by only about 2%. On Dragonfly, however, retransmissions drop by about 40%. This is consistent with the shared seed concentrating VALIANT detours on the same intermediate groups. On SlimFly, the effect is negligible.

Both binaries hardcoded seed 13 and had no -seed option, and every
DragonflySwitch / SlimFlySwitch seeded its std::mt19937 with the same
constant (33), so all switches draw identical random sequences (e.g. the
same VALIANT intermediates).

-seed N now reseeds srand/srandom and seeds each switch generator with
std::seed_seq{N, switch id}. Without -seed the behaviour is unchanged.
@tommasobo

Copy link
Copy Markdown
Collaborator

Thanks! I think this makes a lot of sense :)

@tommasobo
tommasobo merged commit ac1aea6 into spcl:main Oct 5, 2026
1 check passed
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.

2 participants