Add Python support for seeded random sqsgenerator runs#93
Add Python support for seeded random sqsgenerator runs#93fkiwit wants to merge 1 commit intodgehringer:mainfrom
Conversation
|
Hi @fkiwit! Many thanks for your contribution. Furthermore, thanks a lot for the careful implementation of your "seed" parameter. I do agree that this might be helpful for debugging purposes. However, there are two things which should be addressed before: The central point is this line here sqsgenerator/include/sqsgen/sqs.h Line 320 in 2ff5bb3
You said:
Sadly this is not true. The The problem is that a "seed" is global state or at least global state per thread. Hence to make it deterministic you we would have to add a synchronisation (a lock) around the routine that computes a new permutation (not around the random number computation). That sacrifices performance, since you add a lock in a "hot-loop". Furthermore, the |
Thanks for maintaining this amazing package, I have been using it recently and it is very helpful! 😊
For reproducibility during debugging I have forked the repo and exposed the random seed to the Python API. Before I used a workaround by hashing the generated structures afterward to check whether repeated runs were effectively deterministic. Exposing the seed directly through the Python binding is more elegant and I am wondering if this could be a useful feature for the project.
Here a summary of the changes:
Changes
seed: Optional[uint64]to the core configurationseedfrom dict/JSON config inputseedin JSON serializationseedin the Python bindingsNotes
iteration_mode="random"Verification
seedparses successfully