File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Enzyme on demo models
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ pull_request :
8
+
9
+ # needed to allow julia-actions/cache to delete old caches that it has created
10
+ permissions :
11
+ actions : write
12
+ contents : read
13
+
14
+ # Cancel existing tests on the same PR if a new commit is added to a pull request
15
+ concurrency :
16
+ group : ${{ github.workflow }}-${{ github.ref || github.run_id }}
17
+ cancel-in-progress : ${{ startsWith(github.ref, 'refs/pull/') }}
18
+
19
+ jobs :
20
+ enzyme :
21
+ runs-on : ubuntu-latest
22
+ steps :
23
+ - uses : actions/checkout@v4
24
+
25
+ - uses : julia-actions/setup-julia@v2
26
+ with :
27
+ version : " 1"
28
+
29
+ - uses : julia-actions/cache@v2
30
+
31
+ - name : Run AD with Enzyme on demo models
32
+ working-directory : test/integration/enzyme
33
+ run : |
34
+ julia --project=. --color=yes -e 'using Pkg; Pkg.instantiate()'
35
+ julia --project=. --color=yes main.jl
Original file line number Diff line number Diff line change
1
+ [deps ]
2
+ ADTypes = " 47edcb42-4c32-4615-8424-f2b9edc5f35b"
3
+ DynamicPPL = " 366bfd00-2699-11ea-058f-f148b4cae6d8"
4
+ Enzyme = " 7da242da-08ed-463a-9acd-ee780be4f1d9"
5
+ ForwardDiff = " f6369f11-7733-5829-9624-2563aa707210"
6
+ Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
7
+
8
+ [sources ]
9
+ DynamicPPL = {path = " ../../../" }
Original file line number Diff line number Diff line change
1
+ using DynamicPPL. TestUtils: DEMO_MODELS
2
+ using DynamicPPL. TestUtils. AD: run_ad
3
+ using ADTypes: AutoEnzyme
4
+ using Test: @test , @testset
5
+ import Enzyme: set_runtime_activity, Forward, Reverse
6
+ using ForwardDiff: ForwardDiff # run_ad uses FD for correctness test
7
+
8
+ ADTYPES = Dict (
9
+ " EnzymeForward" => AutoEnzyme (; mode= set_runtime_activity (Forward)),
10
+ " EnzymeReverse" => AutoEnzyme (; mode= set_runtime_activity (Reverse)),
11
+ )
12
+
13
+ @testset " $ad_key " for (ad_key, ad_type) in ADTYPES
14
+ @testset " $(model. f) " for model in DEMO_MODELS
15
+ @test run_ad (model, ad_type) isa Any
16
+ end
17
+ end
You can’t perform that action at this time.
0 commit comments