You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simulating turns on deterministic cuDNN for the rest of the session, even without a seed #2159
simulate_for_sbi calls seed_all_backends(seed) on every call, also with seed=None. Besides seeding the random states, seed_all_backends sets torch.backends.cudnn.deterministic = True and torch.backends.cudnn.benchmark = False. So after any simulate_for_sbi call, cuDNN uses deterministic algorithms for the rest of the session, which can slow down later GPU training with convolutional embedding nets. Nobody expects a simulation helper to change a global PyTorch setting.
This was in main before PR #1738 already. The same happens in ABC's simulate_in_batches, and with a seed in simulate_from_theta, which reseeds before every simulator call.
I think seeding the random states and choosing deterministic algorithms should be separate: the simulation code seeds only the random states, and users who want deterministic GPU training set the cuDNN flags themselves, e.g. through an option of seed_all_backends. simulate_for_sbi with seed=None then reseeds from PyTorch's random state as before, so torch.manual_seed still reproduces it, but leaves cuDNN alone.
Activity
perf: seed only the CPU random states before each simulator call
BHARATH0153 commentedon Nov 25, 2026
fixed in #2177
fix: simulating no longer turns on deterministic cuDNN
fix: simulating no longer turns on deterministic cuDNN
fix: simulating no longer turns on deterministic cuDNN
fix: simulating no longer turns on deterministic cuDNN