-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1152 from willtebbutt/wct/mooncake-inside-problems
Mooncake Inside Problems
- Loading branch information
Showing
10 changed files
with
181 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "SciMLSensitivity" | ||
uuid = "1ed8b502-d754-442c-8d5d-10ac956f44a1" | ||
authors = ["Christopher Rackauckas <[email protected]>", "Yingbo Ma <[email protected]>"] | ||
version = "7.71.2" | ||
version = "7.72.0" | ||
|
||
[deps] | ||
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
|
@@ -42,6 +42,12 @@ SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5" | |
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" | ||
|
||
[weakdeps] | ||
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" | ||
|
||
[extensions] | ||
SciMLSensitivityMooncakeExt = "Mooncake" | ||
|
||
[compat] | ||
ADTypes = "1.9" | ||
Accessors = "0.1.36" | ||
|
@@ -71,6 +77,7 @@ LinearSolve = "2" | |
Lux = "1" | ||
Markdown = "1.10" | ||
ModelingToolkit = "9.42" | ||
Mooncake = "0.4.52" | ||
NLsolve = "4.5.1" | ||
NonlinearSolve = "3.0.1" | ||
Optimization = "4" | ||
|
@@ -110,6 +117,7 @@ DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb" | |
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||
Lux = "b2108857-7c20-44ae-9111-449ecde12c47" | ||
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" | ||
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" | ||
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" | ||
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" | ||
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba" | ||
|
@@ -123,4 +131,4 @@ StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" | |
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["AlgebraicMultigrid", "Aqua", "Calculus", "ComponentArrays", "DelayDiffEq", "Distributed", "Lux", "ModelingToolkit", "NLsolve", "NonlinearSolve", "Optimization", "OptimizationOptimisers", "OrdinaryDiffEq", "Pkg", "SafeTestsets", "SparseArrays", "SteadyStateDiffEq", "StochasticDiffEq", "Test"] | ||
test = ["AlgebraicMultigrid", "Aqua", "Calculus", "ComponentArrays", "DelayDiffEq", "Distributed", "Lux", "ModelingToolkit", "Mooncake", "NLsolve", "NonlinearSolve", "Optimization", "OptimizationOptimisers", "OrdinaryDiffEq", "Pkg", "SafeTestsets", "SparseArrays", "SteadyStateDiffEq", "StochasticDiffEq", "Test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module SciMLSensitivityMooncakeExt | ||
|
||
using SciMLSensitivity, Mooncake | ||
import SciMLSensitivity: get_paramjac_config, mooncake_run_ad, MooncakeVJP, MooncakeLoaded | ||
|
||
function get_paramjac_config(::MooncakeLoaded, ::MooncakeVJP, pf, p, f, y, _t) | ||
dy_mem = zero(y) | ||
λ_mem = zero(y) | ||
cache = Mooncake.prepare_pullback_cache(pf, dy_mem, y, p, _t) | ||
return cache, pf, λ_mem, dy_mem | ||
end | ||
|
||
function mooncake_run_ad(paramjac_config::Tuple, y, p, t, λ) | ||
cache, pf, λ_mem, dy_mem = paramjac_config | ||
λ_mem .= λ | ||
dy, _ = Mooncake.value_and_pullback!!(cache, λ_mem, pf, dy_mem, y, p, t) | ||
y_grad = cache.tangents[3] | ||
p_grad = cache.tangents[4] | ||
return dy, y_grad, p_grad | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using SciMLSensitivity, SafeTestsets | ||
using Test, Pkg | ||
import Mooncake | ||
|
||
const GROUP = get(ENV, "GROUP", "All") | ||
|
||
|
78bcac6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChrisRackauckas should this be registered, or are you waiting on something else before releasing?