Skip to content

Commit 75f18b7

Browse files
authored
Merge branch 'main' into vc/string2
2 parents f343d45 + b95c737 commit 75f18b7

14 files changed

+387
-269
lines changed

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/CI.yml

+18-46
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- '1.11'
2626
- 'nightly'
2727
os:
28-
- ubuntu-20.04
28+
- ubuntu-24.04
2929
- macOS-latest
3030
- windows-latest
3131
arch:
@@ -38,17 +38,17 @@ jobs:
3838
arch: x64
3939
libEnzyme: local
4040
include:
41-
- os: ubuntu-20.04
41+
- os: ubuntu-24.04
4242
arch: x86
4343
libEnzyme: packaged
4444
version: '1.10'
4545
assertions: false
46-
- os: ubuntu-20.04
46+
- os: ubuntu-24.04
4747
arch: x64
4848
libEnzyme: packaged
4949
version: '1.10'
5050
assertions: true
51-
- os: ubuntu-20.04
51+
- os: ubuntu-24.04
5252
arch: x64
5353
libEnzyme: packaged
5454
version: '1.11'
@@ -72,16 +72,7 @@ jobs:
7272
sed -i.bak 's/exit 2/exit 0/g' julia/deps/tools/jlchecksum
7373
make -C julia -j $(nproc) FORCE_ASSERTIONS=1 LLVM_ASSERTIONS=1 JULIA_PRECOMPILE=0
7474
echo $PWD/julia/usr/bin >> $GITHUB_PATH
75-
- uses: actions/cache@v2
76-
env:
77-
cache-name: cache-artifacts
78-
with:
79-
path: ~/.julia/artifacts
80-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
81-
restore-keys: |
82-
${{ runner.os }}-test-${{ env.cache-name }}-
83-
${{ runner.os }}-test-
84-
${{ runner.os }}-
75+
- uses: julia-actions/cache@v2
8576
- name: add EnzymeCore
8677
shell: julia --color=yes --project=. {0}
8778
run: |
@@ -95,16 +86,16 @@ jobs:
9586
continue-on-error: ${{ matrix.version == 'nightly' }}
9687
id: build_libenzyme
9788
run: |
98-
julia --project=deps -e 'using Pkg; Pkg.instantiate()'
99-
julia --project=deps deps/build_local.jl
89+
julia --color=yes --project=deps -e 'using Pkg; Pkg.instantiate()'
90+
julia --color=yes --project=deps deps/build_local.jl
10091
cp LocalPreferences.toml test/
10192
- name: Build libEnzyme MacOS
10293
if: ${{ matrix.libEnzyme == 'local' && matrix.os == 'macOS-latest'}}
10394
continue-on-error: ${{ matrix.version == 'nightly' }}
10495
id: build_libenzyme_mac
10596
run: |
106-
julia --project=deps -e 'using Pkg; Pkg.instantiate()'
107-
SDKROOT=`xcrun --show-sdk-path` julia --project=deps deps/build_local.jl
97+
julia --color=yes --project=deps -e 'using Pkg; Pkg.instantiate()'
98+
SDKROOT=`xcrun --show-sdk-path` julia --color=yes --project=deps deps/build_local.jl
10899
cp LocalPreferences.toml test/
109100
- uses: julia-actions/julia-buildpkg@v1
110101
if: matrix.version != 'nightly' || steps.build_libenzyme.outcome == 'success' || steps.build_libenzyme_mac.outcome == 'success'
@@ -120,10 +111,10 @@ jobs:
120111
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
121112
- uses: julia-actions/julia-processcoverage@v1
122113
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
123-
- uses: codecov/codecov-action@v4
114+
- uses: codecov/codecov-action@v5
124115
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
125116
with:
126-
file: lcov.info
117+
files: lcov.info
127118
token: ${{ secrets.CODECOV_TOKEN }}
128119
fail_ci_if_error: false # or true if you want CI to fail when Codecov fails
129120
enzymetestutils:
@@ -150,16 +141,7 @@ jobs:
150141
with:
151142
version: ${{ matrix.version }}
152143
arch: ${{ matrix.arch }}
153-
- uses: actions/cache@v2
154-
env:
155-
cache-name: cache-artifacts
156-
with:
157-
path: ~/.julia/artifacts
158-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
159-
restore-keys: |
160-
${{ runner.os }}-test-${{ env.cache-name }}-
161-
${{ runner.os }}-test-
162-
${{ runner.os }}-
144+
- uses: julia-actions/cache@v2
163145
- name: setup EnzymeTestUtils
164146
shell: julia --color=yes {0}
165147
id: setup_testutils
@@ -182,7 +164,7 @@ jobs:
182164
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
183165
with:
184166
directories: lib/EnzymeTestUtils/src
185-
- uses: codecov/codecov-action@v4
167+
- uses: codecov/codecov-action@v5
186168
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
187169
with:
188170
files: lcov.info
@@ -212,16 +194,7 @@ jobs:
212194
with:
213195
version: ${{ matrix.version }}
214196
arch: ${{ matrix.arch }}
215-
- uses: actions/cache@v2
216-
env:
217-
cache-name: cache-artifacts
218-
with:
219-
path: ~/.julia/artifacts
220-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
221-
restore-keys: |
222-
${{ runner.os }}-test-${{ env.cache-name }}-
223-
${{ runner.os }}-test-
224-
${{ runner.os }}-
197+
- uses: julia-actions/cache@v2
225198
- name: setup EnzymeCore
226199
shell: julia --color=yes {0}
227200
id: setup_testutils
@@ -244,7 +217,7 @@ jobs:
244217
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
245218
with:
246219
directories: lib/EnzymeCore/src
247-
- uses: codecov/codecov-action@v4
220+
- uses: codecov/codecov-action@v5
248221
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
249222
with:
250223
files: lcov.info
@@ -287,19 +260,18 @@ jobs:
287260
version: '1'
288261
- uses: julia-actions/cache@v2
289262
- run: |
290-
julia --project=docs -e '
263+
julia --color=yes --project=docs -e '
291264
using Pkg
292-
Pkg.develop([PackageSpec(path="lib/EnzymeCore"), PackageSpec(path="lib/EnzymeTestUtils"), PackageSpec(path=pwd())])
293265
Pkg.instantiate()'
294266
env:
295267
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
296268
- run: |
297-
julia --project=docs -e '
269+
julia --color=yes --project=docs -e '
298270
using Documenter: DocMeta, doctest
299271
using Enzyme
300272
DocMeta.setdocmeta!(Enzyme, :DocTestSetup, :(using Enzyme); recursive=true)
301273
doctest(Enzyme)'
302-
- run: julia --project=docs docs/make.jl
274+
- run: julia --color=yes --project=docs docs/make.jl
303275
env:
304276
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
305277
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/Format.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Format'
2+
3+
on:
4+
pull_request_target:
5+
paths: ['**/*.jl']
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
8+
permissions:
9+
contents: read
10+
11+
# needed for julia-actions/cache to delete old caches
12+
actions: write
13+
14+
# needed for googleapis/code-suggester
15+
pull-requests: write
16+
17+
jobs:
18+
runic:
19+
runs-on: ubuntu-latest
20+
if: github.event.pull_request.draft == false
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{github.event.pull_request.head.ref}}
25+
repository: ${{github.event.pull_request.head.repo.full_name}}
26+
fetch-depth: 0
27+
28+
- name: Setup Julia
29+
uses: julia-actions/setup-julia@v2
30+
with:
31+
version: '1'
32+
arch: 'x64'
33+
- uses: julia-actions/cache@v2
34+
35+
- name: Install Runic
36+
run: |
37+
julia --project=@runic -e 'using Pkg; Pkg.add("Runic")'
38+
curl -o git-runic https://raw.githubusercontent.com/fredrikekre/Runic.jl/master/bin/git-runic
39+
chmod +x git-runic
40+
sudo mv git-runic /usr/local/bin
41+
42+
- name: Run Runic
43+
run: |
44+
set +e
45+
git runic origin/master
46+
[ $? -eq 2 ] && exit 1 || exit 0
47+
48+
- name: Suggest changes
49+
uses: googleapis/code-suggester@v2
50+
env:
51+
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
command: review
54+
pull_number: ${{ github.event.pull_request.number }}
55+
git_dir: '.'

.github/workflows/PreviewCleanup.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout gh-pages branch
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313
with:
1414
ref: gh-pages
1515
- name: Delete preview and history + push changes

.github/workflows/benchmark_pr.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ on:
66
permissions:
77
pull-requests: write
88

9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
915
jobs:
1016
generate_plots:
1117
runs-on: ubuntu-latest
1218

1319
steps:
14-
- uses: actions/checkout@v2
15-
- uses: julia-actions/setup-julia@v1
20+
- uses: actions/checkout@v4
21+
- uses: julia-actions/setup-julia@v2
1622
with:
1723
version: "1"
18-
- uses: julia-actions/cache@v1
24+
- uses: julia-actions/cache@v2
1925
- name: Extract Package Name from Project.toml
2026
id: extract-package-name
2127
run: |
@@ -26,8 +32,8 @@ jobs:
2632
JULIA_NUM_THREADS: 2
2733
run: |
2834
# Lightweight build step, as sometimes the runner runs out of memory:
29-
julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.add("AirspeedVelocity")'
30-
julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.build("AirspeedVelocity")'
35+
julia --color=yes -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.add("AirspeedVelocity")'
36+
julia --color=yes -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.build("AirspeedVelocity")'
3137
- name: Add ~/.julia/bin to PATH
3238
run: |
3339
echo "$HOME/.julia/bin" >> $GITHUB_PATH
@@ -60,15 +66,15 @@ jobs:
6066
echo 'Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).' >> body.md
6167
6268
- name: Find Comment
63-
uses: peter-evans/find-comment@v2
69+
uses: peter-evans/find-comment@v3
6470
id: fcbenchmark
6571
with:
6672
issue-number: ${{ github.event.pull_request.number }}
6773
comment-author: 'github-actions[bot]'
6874
body-includes: Benchmark Results
6975

7076
- name: Comment on PR
71-
uses: peter-evans/create-or-update-comment@v3
77+
uses: peter-evans/create-or-update-comment@v4
7278
with:
7379
comment-id: ${{ steps.fcbenchmark.outputs.comment-id }}
7480
issue-number: ${{ github.event.pull_request.number }}

.github/workflows/scripts_deploy.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ on:
99

1010
jobs:
1111
docs:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-24.04
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515

16-
- uses: julia-actions/setup-julia@v1
16+
- uses: julia-actions/setup-julia@v2
1717
with:
1818
version: '1'
19-
- uses: julia-actions/cache@v1
19+
- uses: julia-actions/cache@v2
2020
- run: |
21-
julia --project=docs -e '
21+
julia --color=yes --project=docs -e '
2222
using Pkg
2323
Pkg.develop([PackageSpec(path="lib/EnzymeCore"), PackageSpec(path=pwd()), PackageSpec(path="lib/EnzymeTestUtils")])
2424
Pkg.instantiate()'
2525
env:
2626
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
2727
- run: |
28-
julia --project=docs -e '
28+
julia --color=yes --project=docs -e '
2929
using Documenter: DocMeta, doctest
3030
using Enzyme
3131
DocMeta.setdocmeta!(Enzyme, :DocTestSetup, :(using Enzyme); recursive=true)

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ lib/EnzymeCore/Manifest.toml
77
/test/Manifest.toml
88
/docs/Manifest.toml
99
/docs/build/
10+
/docs/src/generated/
1011

1112
.vscode

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/fredrikekre/runic-pre-commit
3+
rev: v1.0.0
4+
hooks:
5+
- id: runic

docs/Project.toml

+7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
4+
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
5+
EnzymeTestUtils = "12d8515a-0907-448a-8884-5fe00fdf1c5a"
46
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
57
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
68

79
[compat]
810
Documenter = "1"
911
Literate = "2"
12+
13+
[sources]
14+
Enzyme = {path = ".."}
15+
EnzymeCore = {path = "../lib/EnzymeCore"}
16+
EnzymeTestUtils = {path = "../lib/EnzymeTestUtils"}

docs/make.jl

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
pushfirst!(LOAD_PATH, joinpath(@__DIR__, "..")) # add Enzyme to environment stack
2-
pushfirst!(LOAD_PATH, joinpath(@__DIR__, "..", "lib")) # add EnzymeCore to environment stack
3-
41
using Enzyme
52
using EnzymeCore
63
using EnzymeTestUtils

docs/src/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Enzyme provides convenience functions for second-order derivative computations,
227227

228228
Unlike [`autodiff`](@ref) and [`gradient`](@ref), a mode is not specified. Here, Enzyme will choose to perform forward over reverse mode (generally the fastest for this type of operation).
229229

230-
```jldoctest hvp; filter = r"([0-9]+\\.[0-9]{8})[0-9]+" => s"\\1***"
230+
```jldoctest hvp; filter = r"([0-9]+\.[0-9]{8})[0-9]+" => s"\1***"
231231
julia> f(x) = sin(x[1] * x[2]);
232232
233233
julia> hvp(f, [2.0, 3.0], [5.0, 2.7])
@@ -238,7 +238,7 @@ julia> hvp(f, [2.0, 3.0], [5.0, 2.7])
238238

239239
Enzyme also provides an in-place variant which will store the hessian vector product in a pre-allocated array (this will, however, still allocate another array for storing an intermediate gradient).
240240

241-
```jldoctest hvp2; filter = r"([0-9]+\\.[0-9]{8})[0-9]+" => s"\\1***"
241+
```jldoctest hvp2; filter = r"([0-9]+\.[0-9]{8})[0-9]+" => s"\1***"
242242
julia> f(x) = sin(x[1] * x[2])
243243
f (generic function with 1 method)
244244
@@ -254,7 +254,7 @@ julia> res
254254

255255
Finally. Enzyme provides a second in-place variant which simultaneously computes both the hessian vector product, and the gradient. This function uses no additional allocation, and is much more efficient than separately computing the hvp and the gradient.
256256

257-
```jldoctest hvp3; filter = r"([0-9]+\\.[0-9]{8})[0-9]+" => s"\\1***"
257+
```jldoctest hvp3; filter = r"([0-9]+\.[0-9]{8})[0-9]+" => s"\1***"
258258
julia> f(x) = sin(x[1] * x[2]);
259259
260260
julia> res = Vector{Float64}(undef, 2);

0 commit comments

Comments
 (0)