Repository navigation
Add -seed to the Dragonfly/SlimFly UEC binaries and use a separate RNG seed for each switch - #20
Merged
Merged
Conversation
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.
Collaborator
|
Thanks! I think this makes a lot of sense :) |
tommasobo
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
htsim_uec_dfandhtsim_uec_sfcan't be run with different seeds, so repeated runs are not independent samples:seed = 13and, unlikehtsim_uec, have no-seedoption.DragonflySwitchandSlimFlySwitchseeds itsstd::mt19937with 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)
-seed Noption inmain_uec_df.cppandmain_uec_sf.cpp. It reseedssrand/srandomwithN, which also affects the UEC entropy (EV) choices.-seedis given, each switch seeds its generator withstd::seed_seq{N, switch_id}.-seed, the binaries behave exactly as before (seed 13, and33for every switch).Validation
Workload: 1024-host random permutation, 2 MB per flow, VALIANT routing (Dragonfly
p4a8h4, SlimFlyp7q9). The per-flow FCTs were compared across runs:-seedvs. currentmain-seed 1vs.-seed 1-seed 1vs.-seed 2Effect of per-switch seeding on the same workload:
main(all switches seeded with 33)-seed 1-seed 2main-seed 1FCT 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.