-
Notifications
You must be signed in to change notification settings - Fork 39
Refactor CI #406
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
base: main
Are you sure you want to change the base?
Refactor CI #406
Changes from all commits
117b8e8
d0e6a6f
fb6d71c
b020f9e
cd4e62f
78f3ef9
982d19b
1b9964a
4f1004c
481c5ca
eb4bdfb
1400d75
c993dfb
ef21f50
e81001e
d67f0c0
28d0ca8
a7852b6
a86b716
098ef8d
ce870f7
ba4db0e
1d8e224
9971c97
af877e8
4b2cbba
fac6c00
7382f7b
ebe3de3
99cf586
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# We want to only run doctests on a single version of Julia, because | ||
# things like error messages / output can change between versions and | ||
# is fragile to test against. | ||
name: Doctests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
merge_group: | ||
types: [checks_requested] | ||
|
||
# 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: | ||
test: | ||
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 | ||
|
||
- uses: julia-actions/julia-runtest@v1 | ||
env: | ||
GROUP: Doctests |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ makedocs(; | |
"Examples" => "examples.md", | ||
], | ||
checkdocs=:exports, | ||
doctest=false, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,49 @@ | ||
@testset "AD for VecCorrBijector" begin | ||
d = 4 | ||
dist = LKJ(d, 2.0) | ||
b = bijector(dist) | ||
binv = inverse(b) | ||
using Enzyme: ForwardMode | ||
|
||
x = rand(dist) | ||
y = b(x) | ||
@testset "VecCorrBijector: $backend_name" for (backend_name, adtype) in TEST_ADTYPES | ||
ENZYME_FWD_AND_1p11 = VERSION >= v"1.11" && adtype isa AutoEnzyme{<:Enzyme.ForwardMode} | ||
|
||
test_ad(y) do x | ||
sum(transform(b, binv(x))) | ||
end | ||
@testset "d = $d" for d in (1, 2, 4) | ||
dist = LKJ(d, 2.0) | ||
b = bijector(dist) | ||
binv = inverse(b) | ||
|
||
x = rand(dist) | ||
y = b(x) | ||
|
||
test_ad(y) do y | ||
sum(transform(binv, y)) | ||
roundtrip(y) = sum(transform(b, binv(y))) | ||
inverse_only(y) = sum(transform(binv, y)) | ||
if d == 4 && ENZYME_FWD_AND_1p11 | ||
@test_throws Enzyme.Compiler.EnzymeNoDerivativeError test_ad( | ||
roundtrip, adtype, y | ||
) | ||
@test_throws Enzyme.Compiler.EnzymeNoDerivativeError test_ad( | ||
inverse_only, adtype, y | ||
) | ||
else | ||
test_ad(roundtrip, adtype, y) | ||
test_ad(inverse_only, adtype, y) | ||
end | ||
end | ||
end | ||
|
||
@testset "AD for VecCholeskyBijector" begin | ||
d = 4 | ||
dist = LKJCholesky(d, 2.0) | ||
b = bijector(dist) | ||
binv = inverse(b) | ||
@testset "VecCholeskyBijector: $backend_name" for (backend_name, adtype) in TEST_ADTYPES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty much. The idea is that Bijectors provides these functions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and each adtype corresponds to an AD backend of interest (plus some configuration options e.g. whether to use forward- or reverse-mode). |
||
@testset "d = $d, uplo = $uplo" for d in (1, 2, 4), uplo in ('U', 'L') | ||
dist = LKJCholesky(d, 2.0, uplo) | ||
b = bijector(dist) | ||
binv = inverse(b) | ||
|
||
x = rand(dist) | ||
y = b(x) | ||
x = rand(dist) | ||
y = b(x) | ||
cholesky_to_triangular = | ||
uplo == 'U' ? Bijectors.cholesky_upper : Bijectors.cholesky_lower | ||
|
||
test_ad(y) do y | ||
sum(transform(b, binv(y))) | ||
end | ||
roundtrip(y) = sum(transform(b, binv(y))) | ||
test_ad(roundtrip, adtype, y) | ||
|
||
test_ad(y) do y | ||
sum(Bijectors.cholesky_upper(transform(binv, y))) | ||
# we need to tack on `cholesky_upper`/`cholesky_lower`, because directly calling | ||
# `sum` on a LinearAlgebra.Cholesky doesn't give a scalar | ||
inverse_only(y) = sum(cholesky_to_triangular(transform(binv, y))) | ||
test_ad(inverse_only, adtype, y) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to
test/ad/mooncake.jl