-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add `BenchmarkCI` * fix branch error * Format .jl files (#270) Co-authored-by: prbzrg <[email protected]> * rename * fix benchmark --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: prbzrg <[email protected]>
- Loading branch information
1 parent
2b77981
commit 543d8f7
Showing
8 changed files
with
72 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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,25 @@ | ||
name: Benchmarks | ||
on: pull_request | ||
|
||
jobs: | ||
Benchmark: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
arch: x64 | ||
show-versioninfo: true | ||
- uses: julia-actions/cache@v1 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- name: Install dependencies | ||
run: julia --color=yes -e 'using Pkg; Pkg.add(["PkgBenchmark", "BenchmarkCI"])' | ||
- name: Run benchmarks | ||
run: julia --color=yes -e 'using BenchmarkCI; BenchmarkCI.judge(; baseline="origin/main")' | ||
- name: Print judgement | ||
run: julia --color=yes -e 'using BenchmarkCI; BenchmarkCI.displayjudgement()' | ||
- name: Post results | ||
run: julia --color=yes -e 'using BenchmarkCI; BenchmarkCI.postjudge()' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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 |
---|---|---|
|
@@ -16,7 +16,6 @@ jobs: | |
- RNODE | ||
- FFJORD | ||
- Planar | ||
- Benchmark | ||
- Quality | ||
- Instability | ||
version: | ||
|
This file contains 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 |
---|---|---|
|
@@ -25,3 +25,6 @@ Manifest.toml | |
LocalPreferences.toml | ||
|
||
.vscode | ||
|
||
.benchmarkci | ||
benchmark/*.json |
This file contains 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,7 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" | ||
Lux = "b2108857-7c20-44ae-9111-449ecde12c47" | ||
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" |
This file contains 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,37 @@ | ||
using ContinuousNormalizingFlows, BenchmarkTools, Flux, Lux, PkgBenchmark, Random, Zygote | ||
|
||
SUITE = BenchmarkGroup() | ||
|
||
SUITE["main"] = BenchmarkGroup(["package", "simple"]) | ||
SUITE["main"]["0-order"] = BenchmarkGroup(["direct"]) | ||
SUITE["main"]["1-order"] = BenchmarkGroup(["gradient"]) | ||
|
||
BenchmarkTools.DEFAULT_PARAMETERS.samples = 2^13 | ||
BenchmarkTools.DEFAULT_PARAMETERS.seconds = convert(Float64, 2 * 60) | ||
BenchmarkTools.DEFAULT_PARAMETERS.evals = 1 | ||
BenchmarkTools.DEFAULT_PARAMETERS.overhead = 0.0 | ||
BenchmarkTools.DEFAULT_PARAMETERS.gctrial = true | ||
BenchmarkTools.DEFAULT_PARAMETERS.gcsample = false | ||
BenchmarkTools.DEFAULT_PARAMETERS.time_tolerance = convert(Float64, eps(Float16)) | ||
BenchmarkTools.DEFAULT_PARAMETERS.memory_tolerance = convert(Float64, eps(Float16)) | ||
|
||
nvars = 8 | ||
n = 128 | ||
rng = Random.default_rng() | ||
r = rand(Float32, nvars, n) | ||
|
||
nn = FluxCompatLayer(Flux.f32(Flux.Dense(nvars => nvars, tanh))) | ||
icnf = construct(RNODE, nn, nvars; compute_mode = ZygoteMatrixMode) | ||
|
||
ps, st = Lux.setup(rng, icnf) | ||
diff_loss_train(x) = loss(icnf, TrainMode(), r, x, st) | ||
diff_loss_test(x) = loss(icnf, TestMode(), r, x, st) | ||
grad_diff_loss_train() = Zygote.gradient(diff_loss_train, ps) | ||
grad_diff_loss_test() = Zygote.gradient(diff_loss_test, ps) | ||
t_loss_train() = loss(icnf, TrainMode(), r, ps, st) | ||
t_loss_test() = loss(icnf, TestMode(), r, ps, st) | ||
|
||
SUITE["main"]["0-order"]["train"] = @benchmarkable $t_loss_train() | ||
SUITE["main"]["0-order"]["test"] = @benchmarkable $t_loss_test() | ||
SUITE["main"]["1-order"]["train"] = @benchmarkable $grad_diff_loss_train() | ||
SUITE["main"]["1-order"]["test"] = @benchmarkable $grad_diff_loss_test() |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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