Skip to content

Feature request: CPUDistributingLocalScheduler with separate processes per hyperparam. run #79

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

Open
Flunzmas opened this issue Aug 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Flunzmas
Copy link
Collaborator

Disclaimer: requires a feature only available from python>=3.11.

What: Initialize the concurrent.futures.ProcessPoolExecutor used in CPUDistributingLocalScheduler with the new parameter max_tasks_per_child to control the amount of tasks (~hyperparameter runs) per process:

with concurrent.futures.ProcessPoolExecutor(
            max_workers=num_parallel,
            max_tasks_per_child=1 if self.one_process_per_run else None
        ) as pool:
...

If max_tasks_per_child is None, the scheduler behaves as usual. If provided a number, each child process will terminate after the specified amount of runs. If this number is 1, each hyperparam. run will run in its own process.

Why: This feature is useful for programs that you'd like to distribute over CPUs, but need to be in separate processes each (i.e. you can't reuse processes for running multiple runs sequentially).

How: Add a yaml config bool attribute one_process_per_run that, when using scheduler: "cpu_distribute", is passed to the CPUDistributingLocalScheduler and handed on to the concurrent.futures.ProcessPoolExecutor as indicated above (link to location in code).

@Flunzmas Flunzmas added the enhancement New feature or request label Aug 30, 2023
@Flunzmas Flunzmas changed the title Feature request: CPUDistributingLocalScheduler with separate processes per hyperparam. run Feature request: CPUDistributingLocalScheduler with separate processes per hyperparam. run Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant