Skip to content
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

Document public API #74

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
32 changes: 18 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
fail-fast: false
matrix:
version:
- '*' # Latest Release
- '1.9'
- release
- rc
os:
- ubuntu-latest
- windows-latest
Expand All @@ -20,11 +22,10 @@ jobs:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/install-juliaup@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
channel: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-uploadcoveralls@v1
Expand All @@ -36,13 +37,12 @@ jobs:
name: Test Min Compat Bounds
runs-on: ubuntu-latest
steps:
- uses: julia-actions/julia-downgrade-compat@v1
if: ${{ matrix.os == 'ubuntu-latest' }}
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/install-juliaup@v2
with:
version: 1.9
- uses: julia-actions/cache@v1
channel: "1.9"
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-downgrade-compat@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1

Expand All @@ -51,8 +51,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/cache@v1
- uses: julia-actions/install-juliaup@v2
with:
channel: release
- uses: julia-actions/cache@v2
- uses: "./"
with:
prefix: "cd test/Example.jl &&"
Expand All @@ -62,8 +64,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: julia-actions/cache@v1
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/install-juliaup@v2
with:
channel: "1.10"
- uses: julia-actions/cache@v2
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
20 changes: 11 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.6.0"
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Expand All @@ -28,17 +29,18 @@ BSON = "0.3"
BenchmarkTools = "1.5"
CUDA = "5"
CodecZlib = "0.7"
Dates = "1.9"
Compat = "4.11, 4"
Dates = "1.9, 1.10"
JSON = "0.21"
LibGit2 = "1.9"
LibGit2 = "1.9, 1.10"
NVTX = "0.3.2"
Pkg = "1.9, 1.10"
Profile = "1.9, 1.10"
Revise = "3"
NVTX = "0.3"
Pkg = "1.9"
Profile = "1.9"
Statistics = "1.9"
Test = "1.9"
UUIDs = "1.9"
julia = "1.9"
Statistics = "1.9, 1.10"
Test = "1.9, 1.10"
UUIDs = "1.9, 1.10"
julia = "1.9, 1.10"

[extras]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Expand Down
8 changes: 5 additions & 3 deletions src/PkgJogger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ using LibGit2
using Statistics
using Test
using Profile
using Compat: @compat

export @jog, @test_benchmarks
@compat public judge, ci, load_benchmarks, save_benchmarks, locate_benchmarks, tune!, getsuite, profile

import Base: PkgId
"""
Packages that are required by modules created with [`@jog`](@ref)

Generated modules will access these via `Base.loaded_modules`
"""
const JOGGER_PKGS = [
Base.identify_package(@__MODULE__, string(@__MODULE__)),
PkgId(UUID("6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"), "BenchmarkTools"),
PkgId(UUID("cf7118a7-6976-5b1a-9a39-7adc72f591a4"), "UUIDs"),
Base.PkgId(UUID("6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"), "BenchmarkTools"),
Base.PkgId(UUID("cf7118a7-6976-5b1a-9a39-7adc72f591a4"), "UUIDs"),
Base.PkgId(UUID("34da2185-b29b-5c13-b0c7-acf172513d20"), "Compat"),
]

const PKG_JOGGER_VER = VersionNumber(
Expand Down
10 changes: 4 additions & 6 deletions src/ci.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ function sandbox(f, pkg)
current_load_path = Base.LOAD_PATH

# Construct PackageSpec for self
self = PackageSpec(
name = JOGGER_PKGS[1].name,
uuid = JOGGER_PKGS[1].uuid,
path = Base.pkgdir(PkgJogger),
)
self_pkgid = Base.identify_package(@__MODULE__, string(@__MODULE__))
self = PackageSpec(; name = self_pkgid.name, uuid = self_pkgid.uuid)
path = pkgdir(@__MODULE__)

# Locate benchmark project
# TODO: Use Sub-project https://github.com/JuliaLang/Pkg.jl/issues/1233
Expand Down Expand Up @@ -118,7 +116,7 @@ function save_benchmarks(filename, results::BenchmarkTools.BenchmarkGroup)
"datetime" => Dates.now(),
"benchmarks" => results,
"git" => git_info(filename),
"pkgjogger" => PkgJogger.PKG_JOGGER_VER,
"pkgjogger" => pkgversion(@__MODULE__),
)

# Write benchmark to disk
Expand Down
9 changes: 6 additions & 3 deletions src/jogger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ macro jog(pkg)
if !isdir(bench_dir)
error("No benchmark directory found for $pkg. Expected: $bench_dir")
end

# Generate Using Statements
using_statements = Expr[]
for pkg in JOGGER_PKGS
Expand All @@ -64,7 +65,6 @@ macro jog(pkg)
end

# Strip redundant quote blocks and flatten modules into a single single Vector{Expr}`
# This is needed to avoid wrapping module blocks in `begin .. end` blocks
suite_exp = mapreduce(Base.Fix2(getfield, :args), vcat, suite_modules)

# String representation of the Jogger module for use in doc strings
Expand All @@ -76,6 +76,9 @@ macro jog(pkg)
using $pkg
$(using_statements...)

# The public interface of a Jogger
Compat.@compat public suite, benchmark, run, profile, save_benchmarks, load_benchmarks, judge, BENCHMARK_DIR

# Set Revise Mode and put submodules here
__revise_mode__ = :eval
$(suite_exp...)
Expand Down Expand Up @@ -172,7 +175,7 @@ macro jog(pkg)
"""
save_benchmarks(results::BenchmarkGroup)::String

Saves benchmarking results for $($pkg) to `BENCHMARK_DIR/trial/uuid4().bson.gz`,
Saves benchmarking results for $($pkg) to `BENCHMARK_DIR/trial/UUIDs.uuid4().bson.gz`,
and returns the path to the saved results

> Meta Data such as cpu load, time stamp, etc. are collected on save, not during
Expand Down Expand Up @@ -314,7 +317,7 @@ function build_module(s::BenchModule)

# If Revise.jl has been loaded, use it to track changes to the
# benchmarking module. Otherwise, don't track changes.
revise_id = PkgId(UUID("295af30f-e4ad-537b-8983-00126c2a3abe"), "Revise")
revise_id = Base.PkgId(UUID("295af30f-e4ad-537b-8983-00126c2a3abe"), "Revise")
if haskey(Base.loaded_modules, revise_id)
revise_exp = :(Base.loaded_modules[$revise_id].track($modname, $(s.filename)))
else
Expand Down
Loading