Skip to content
Merged
Changes from 1 commit
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
58 changes: 58 additions & 0 deletions .github/workflows/Enzyme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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

- uses: julia-actions/julia-buildpkg@v1

- name: Run AD with Enzyme on demo models
shell: julia --color=yes {0}
run: |
# Set up fresh environment
using Pkg
Pkg.activate(; temp=true)
Pkg.develop(path=".")
Pkg.add(["Enzyme", "ForwardDiff", "ADTypes", "Test"])

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
import 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