-
Notifications
You must be signed in to change notification settings - Fork 35
Add Enzyme testing as a separate CI action #950
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
705bb68
Add Enzyme testing as a separate CI action
penelopeysm 2e8c01d
Move to separate script in test/enzyme
penelopeysm 7bd370f
Colour
penelopeysm f021f82
Merge branch 'main' into py/enzyme-in-ci
penelopeysm a603e9e
rename file to main.jl
penelopeysm 1f1e5e8
test/enzyme -> test/integration/enzyme
penelopeysm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,35 @@ | ||
name: Enzyme on demo models | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
# needed to allow julia-actions/cache to delete old caches that it has created | ||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
# Cancel existing tests on the same PR if a new commit is added to a pull request | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
||
jobs: | ||
enzyme: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: "1" | ||
|
||
- uses: julia-actions/cache@v2 | ||
|
||
- name: Run AD with Enzyme on demo models | ||
working-directory: test/enzyme | ||
run: | | ||
julia --project=. --color=yes -e 'using Pkg; Pkg.instantiate()' | ||
julia --project=. --color=yes main.jl |
This file contains hidden or 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,9 @@ | ||
[deps] | ||
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8" | ||
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" | ||
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[sources] | ||
DynamicPPL = {path = "../../"} |
This file contains hidden or 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,17 @@ | ||
using DynamicPPL.TestUtils: DEMO_MODELS | ||
using DynamicPPL.TestUtils.AD: run_ad | ||
using ADTypes: AutoEnzyme | ||
using Test: @test, @testset | ||
import Enzyme: set_runtime_activity, Forward, Reverse | ||
using ForwardDiff: ForwardDiff # run_ad uses FD for correctness test | ||
|
||
ADTYPES = Dict( | ||
"EnzymeForward" => AutoEnzyme(; mode=set_runtime_activity(Forward)), | ||
"EnzymeReverse" => AutoEnzyme(; mode=set_runtime_activity(Reverse)), | ||
) | ||
|
||
@testset "$ad_key" for (ad_key, ad_type) in ADTYPES | ||
@testset "$(model.f)" for model in DEMO_MODELS | ||
@test run_ad(model, ad_type) isa Any | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.