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

Enzyme and structures and Oceananigans #7

Open
swilliamson7 opened this issue Dec 1, 2022 · 1 comment
Open

Enzyme and structures and Oceananigans #7

swilliamson7 opened this issue Dec 1, 2022 · 1 comment

Comments

@swilliamson7
Copy link
Collaborator

A potentially vague question/issue regarding how Enzyme works. In order to run the Oceananigans barotropic gyre model, we need to initialize this structure

model = HydrostaticFreeSurfaceModel(; grid, closure,
                                   free_surface = ExplicitFreeSurface(),
                                    momentum_advection = VectorInvariant(),
                                    coriolis = HydrostaticSphericalCoriolis(),
                                    boundary_conditions = (u=u_bcs, v=v_bcs),
                                    tracers = nothing,
                                    buoyancy = nothing)

which contains all the needed information about the model that we're running, and so needs to be given to time_step! to update the velocity fields and so on. The function that I call autodiff on currently takes this as input, and so we need to wrap it in Duplicated, but the vast majority of the entries in model are not something we want to take the derivative with respect to. Is there a way to tell Enzyme to take this into account?

Another weird thing is that the choices (such as ExplicitFreeSurface()) will impact the derivative, so we do still want Enzyme to go through those functions, meaning they shouldn't be ignored in their entirety (if any of that makes sense). I guess I'm a little lost about how best to set this up to try and make the MWE of Enzyme and Oceananigans not getting along, but I think understanding how to deal with this structure is at least a start.

@swilliamson7
Copy link
Collaborator Author

Maybe @vchuravy or @wsmoses could help a bit?

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

No branches or pull requests

1 participant