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

Static GPU compilation of Jacobian #129

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ steps:
agents:
queue: "juliagpu"
cuda: "*"
timeout_in_minutes: 30
timeout_in_minutes: 120
# Don't run Buildkite if the commit message includes the text [skip tests]
if: build.message !~ /\[skip tests\]/

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SimpleNonlinearSolve"
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
authors = ["SciML"]
version = "1.4.2"
version = "1.4.3"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
17 changes: 14 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,28 @@ function __pick_forwarddiff_chunk(x::StaticArray)
end
end

function __get_jacobian_config(ad::AutoForwardDiff{CS}, f, x) where {CS}
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f::F, x) where {F, CS}
ck = (CS === nothing || CS ≤ 0) ? __pick_forwarddiff_chunk(x) : ForwardDiff.Chunk{CS}()
tag = __standard_tag(ad.tag, x)
return ForwardDiff.JacobianConfig(f, x, ck, tag)
return __forwarddiff_jacobian_config(f, x, ck, tag)
end
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f!, y, x) where {CS}
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f!::F, y, x) where {F, CS}
ck = (CS === nothing || CS ≤ 0) ? __pick_forwarddiff_chunk(x) : ForwardDiff.Chunk{CS}()
tag = __standard_tag(ad.tag, x)
return ForwardDiff.JacobianConfig(f!, y, x, ck, tag)
end

function __forwarddiff_jacobian_config(f::F, x, ck::ForwardDiff.Chunk, tag) where {F}
return ForwardDiff.JacobianConfig(f, x, ck, tag)
end
function __forwarddiff_jacobian_config(
f::F, x::SArray, ck::ForwardDiff.Chunk{N}, tag) where {F, N}
seeds = ForwardDiff.construct_seeds(ForwardDiff.Partials{N, eltype(x)})
duals = ForwardDiff.Dual{typeof(tag), eltype(x), N}.(x)
return ForwardDiff.JacobianConfig{typeof(tag), eltype(x), N, typeof(duals)}(seeds,
duals)
end

function __get_jacobian_config(ad::AutoPolyesterForwardDiff{CS}, args...) where {CS}
x = last(args)
return (CS === nothing || CS ≤ 0) ? __pick_forwarddiff_chunk(x) :
Expand Down
Loading