Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit randomization for subprocesses #392

Closed
kosmitive opened this issue Aug 5, 2023 · 1 comment · Fixed by #396
Closed

Explicit randomization for subprocesses #392

kosmitive opened this issue Aug 5, 2023 · 1 comment · Fixed by #396
Assignees
Labels
design-problem Problems with internal architecture
Milestone

Comments

@kosmitive
Copy link
Contributor

kosmitive commented Aug 5, 2023

As sub-processes fork the random generator from their parent process, it might happen that different sub processes obtain the same sequence of random numbers in different processes. Depending on the backend it might be an issue. In general it would be advantageous to make it explicit, e.g.

def set_time_pid_seed():
    t = int(os.getpid() + time.time())
    np.random.seed(t)
    random.seed(t)

or even better, to pass different seeds from the parent process to the forked child processes. The latter would give us reproducability, see also (https://joblib.readthedocs.io/en/latest/auto_examples/parallel_random_state.html)

@AnesBenmerzoug
Copy link
Collaborator

This should be related to #242

@mdbenito mdbenito added the design-problem Problems with internal architecture label Aug 7, 2023
@mdbenito mdbenito added this to the v0.8.0 milestone Aug 7, 2023
@kosmitive kosmitive self-assigned this Aug 7, 2023
@kosmitive kosmitive linked a pull request Aug 8, 2023 that will close this issue
@AnesBenmerzoug AnesBenmerzoug modified the milestones: v0.8.0, v0.7.0 Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-problem Problems with internal architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants