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

Add a SequentialExecutor based on ProcessPoolExecutor #232

Merged
merged 3 commits into from
Jul 18, 2024

Conversation

basnijholt
Copy link
Owner

No description provided.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
.
@basnijholt basnijholt merged commit d01fc84 into main Jul 18, 2024
8 of 9 checks passed
@basnijholt basnijholt deleted the sequential-executor-async branch July 18, 2024 19:18
@basnijholt
Copy link
Owner Author

test with e.g.,


class SequentialExecutor(ProcessPoolExecutor):
    """A asynchronous executor that runs tasks sequentially."""

    def __init__(self) -> None:
        super().__init__(max_workers=1)

def burn():
    import numpy as np
    np.linalg.eigvals(np.random.rand(1000, 1000))

def f(x):
    with ProcessPoolExecutor() as executor:
        future = executor.submit(burn)
        future.result()
    return x**2


learner = adaptive.Learner1D(f, bounds=(-1, 1))
runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.1, executor=SequentialExecutor())
runner.live_info()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant