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

Implement ChainEvaluator #110

Merged
merged 15 commits into from
Oct 10, 2023
Merged

Implement ChainEvaluator #110

merged 15 commits into from
Oct 10, 2023

Conversation

AngelFP
Copy link
Member

@AngelFP AngelFP commented Aug 4, 2023

This PR implements a new ChainEvaluator that enables the workflow described in #87 . That is, it allows for evaluations consisting of several steps, where each step is carried out by a different TemplateEvaluator.

A use case for this are evaluations that require a series of simulations with different codes (e.g., FBPIC for generating a beam in an LPA, beam transport with ASTRA, and then beam interaction with a target in Geant4). Each simulation ( TemplateEvaluator) can request a different number or resources (number of processes and GPUs).

Here is an example illustrating how this evaluator would be used.

# Create one evaluator per simulation code
ev_fbpic = TemplateEvaluator(
    sim_template='template_simulation_fbpic.py',
    analysis_func=analyze_simulation_fbpic,
    n_gpus=2
)
ev_g4 = TemplateEvaluator(
    sim_template='template_simulation_geant4.txt',
    analysis_func=analyze_simulation_g4,
    executable='geant4',
    n_procs=40
)

# Group them in a chain evaluator in the order in which they should be executed.
ev = ChainEvaluator([ev_fbpic, ev_g4])

# Create exploration.
exp = Exploration(
    generator=gen,
    evaluator=ev,
    max_evals=100,
    sim_workers=4
)

@AngelFP AngelFP mentioned this pull request Aug 4, 2023
@AngelFP AngelFP added the enhancement New feature or request label Sep 27, 2023
@AngelFP AngelFP merged commit 94042f8 into main Oct 10, 2023
9 of 10 checks passed
@AngelFP AngelFP deleted the chain_evaluator branch October 10, 2023 09:05
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

Successfully merging this pull request may close these issues.

2 participants