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

More memory-efficient multi-start optimization #1499

Open
dweindl opened this issue Oct 24, 2024 · 0 comments
Open

More memory-efficient multi-start optimization #1499

dweindl opened this issue Oct 24, 2024 · 0 comments
Labels
optimization Related to optimization process performance

Comments

@dweindl
Copy link
Member

dweindl commented Oct 24, 2024

The current multi-start optimization scheme in pypesto.optimize.optimize.minimize relies on creating copies for all N starts upfront. For larger number of starts and large problems, this can become very memory-intensive. It would be great if the problem copies would be created (and destroyed) dynamically when a previous task finished.

Relevant code:

tasks = []
for startpoint, id in zip(startpoints, ids):
task = OptimizerTask(
optimizer=optimizer,
problem=problem,
x0=startpoint,
id=id,
history_options=history_options,
optimize_options=options,
)
tasks.append(task)
# perform multistart optimization
ret = engine.execute(tasks, progress_bar=progress_bar)

CC @stephanmg

EDIT: I think the actual copies are only created by the MultiProcessEngine:

pickled_tasks = [pickle.dumps(task) for task in tasks]

Changing the up-front pickling and Pool.imap to ProcessPoolExecutor.submit with on-demand pickling should already give a good improvement.

@dweindl dweindl added performance optimization Related to optimization process labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Related to optimization process performance
Projects
None yet
Development

No branches or pull requests

1 participant