Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 8995a23

Browse files
Merge pull request #129 from SciML/ap/static_jacobian
Static GPU compilation of Jacobian
2 parents 4ed9e45 + f2149a9 commit 8995a23

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ steps:
1313
agents:
1414
queue: "juliagpu"
1515
cuda: "*"
16-
timeout_in_minutes: 30
16+
timeout_in_minutes: 120
1717
# Don't run Buildkite if the commit message includes the text [skip tests]
1818
if: build.message !~ /\[skip tests\]/
1919

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SimpleNonlinearSolve"
22
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
33
authors = ["SciML"]
4-
version = "1.4.2"
4+
version = "1.4.3"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/utils.jl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,28 @@ function __pick_forwarddiff_chunk(x::StaticArray)
4040
end
4141
end
4242

43-
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f, x) where {CS}
43+
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f::F, x) where {F, CS}
4444
ck = (CS === nothing || CS 0) ? __pick_forwarddiff_chunk(x) : ForwardDiff.Chunk{CS}()
4545
tag = __standard_tag(ad.tag, x)
46-
return ForwardDiff.JacobianConfig(f, x, ck, tag)
46+
return __forwarddiff_jacobian_config(f, x, ck, tag)
4747
end
48-
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f!, y, x) where {CS}
48+
function __get_jacobian_config(ad::AutoForwardDiff{CS}, f!::F, y, x) where {F, CS}
4949
ck = (CS === nothing || CS 0) ? __pick_forwarddiff_chunk(x) : ForwardDiff.Chunk{CS}()
5050
tag = __standard_tag(ad.tag, x)
5151
return ForwardDiff.JacobianConfig(f!, y, x, ck, tag)
5252
end
5353

54+
function __forwarddiff_jacobian_config(f::F, x, ck::ForwardDiff.Chunk, tag) where {F}
55+
return ForwardDiff.JacobianConfig(f, x, ck, tag)
56+
end
57+
function __forwarddiff_jacobian_config(
58+
f::F, x::SArray, ck::ForwardDiff.Chunk{N}, tag) where {F, N}
59+
seeds = ForwardDiff.construct_seeds(ForwardDiff.Partials{N, eltype(x)})
60+
duals = ForwardDiff.Dual{typeof(tag), eltype(x), N}.(x)
61+
return ForwardDiff.JacobianConfig{typeof(tag), eltype(x), N, typeof(duals)}(seeds,
62+
duals)
63+
end
64+
5465
function __get_jacobian_config(ad::AutoPolyesterForwardDiff{CS}, args...) where {CS}
5566
x = last(args)
5667
return (CS === nothing || CS 0) ? __pick_forwarddiff_chunk(x) :

0 commit comments

Comments
 (0)