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

Support for adjoint simulations with no monitors (zero gradients) #2059

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

yaugenst-flex
Copy link
Contributor

@yaugenst-flex yaugenst-flex commented Nov 6, 2024

Idea is to allow functions like min() and max() in an objective function where some simulations (for example in an adjoint batch) might not get adjoint sources.

Approach:

  • Generally allow make_adjoint_sim to return None instead of erroring.
  • Handle whether or not we error if there are no adjoint sources in run and run_async, where by default we error in run and only warn in run_async:
    • In run, the user is probably running only a single simulation. If that gets no adjoint sources, then there is a problem with the setup. However, it is possible that a user might be running multiple simulations serially, in which case we do offer the option to allow "empty" adjoint sims.
    • In run_async, the user is expected to run a batch of multiple simulations, so it should generally be fine if some of those do not receive adjoint sources. We should probably error though if all simulations in a batch have no adjoint sources.

@yaugenst-flex yaugenst-flex self-assigned this Nov 6, 2024
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.

1 participant