Skip to content

Commit

Permalink
Merge pull request #33 from triscale-innov/ff/issue32
Browse files Browse the repository at this point in the history
Fix hygiene-related bug with Julia 1.6.0
  • Loading branch information
ffevotte authored Apr 19, 2021
2 parents 03f2429 + fa58f50 commit ee8d5b5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.5] - 2021-04-19

This is a bugfix release.

### Changed

- Fix hygiene-related bug with Julia 1.6.0 (#32, #33)



## [0.1.4] - 2021-04-13
Expand All @@ -13,7 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Changed

- Fix CI issues (#22)
- Compatibility with `CompatBounds.jl` 0.12 (#29)
- Compatibility with `PrettyTables.jl` 0.12 (#29)



Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "GFlops"
uuid = "2ea8233c-34d4-5acc-88b4-02f326385bcc"
license = "MIT"
authors = ["François Févotte <francois.fevotte@triscale-innov.com>"]
version = "0.1.4"
version = "0.1.5"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Expand Down
18 changes: 12 additions & 6 deletions src/count_ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,25 @@ end



# Helper accessor (that can be overriden to fake benchmarking times in tests)
times(t::BenchmarkTools.Trial) = t.times

macro gflops(funcall)
benchmark = quote
$BenchmarkTools.@benchmark $funcall
end

quote
let
b = @benchmark $funcall
ns = minimum(b.times)
b = $(esc(benchmark))
ns = minimum(times(b))

cnt = flop($(count_ops(funcall)))
gflops = cnt/ns
peakfraction = 1e9*gflops / peakflops()
memory = $(GFlops.BenchmarkTools).prettymemory(b.memory)
gflops = cnt / ns
peakfraction = 1e9 * gflops / peakflops()
memory = $BenchmarkTools.prettymemory(b.memory)
@printf(" %.2f GFlops, %.2f%% peak (%.2e flop, %.2e s, %d alloc: %s)\n",
gflops, peakfraction*100, cnt, ns*1e-9,
gflops, peakfraction*100, cnt, ns*1e-9,
b.allocs, memory)
gflops
end
Expand Down
26 changes: 7 additions & 19 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,9 @@ function my_prod(m, v)
res
end

import BenchmarkTools: @benchmark
struct FakeResults
times
allocs
memory
end
macro benchmark(e)
quote
FakeResults(#= times =# [2.0, 3.0],
#= allocs =# 1,
#= memory =# 1042)
end
end


# Fake benchmarked times
import BenchmarkTools
GFlops.times(::BenchmarkTools.Trial) = [2.0, 3.0]

@testset "GFlops" begin
@testset "Counter" begin
Expand Down Expand Up @@ -128,7 +116,7 @@ end
@test GFlops.flop(cnt) == 1
end
end

@testset "sqrt" begin
let cnt = @count_ops sqrt(4.2)
@test cnt.sqrt64 == 1
Expand Down Expand Up @@ -219,15 +207,15 @@ end
x = rand(N)
y = Vector{Float64}(undef, N)

@test @gflops(my_axpy!(a, x, y)) == N
@test @gflops(my_axpy!(π, $(rand(N)), y)) == N
@test @gflops(my_axpy!($a, $x, $y)) == N
@test @gflops(my_axpy!($π, $(rand(N)), $y)) == N
end

let
N = 100
m = rand(N, N)
v = rand(N)
@test @gflops(my_prod(m, v)) == N*N
@test @gflops(my_prod($m, $v)) == N*N
end
end
end

2 comments on commit ee8d5b5

@ffevotte
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

This is a bugfix release.

Changed

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/34689

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.5 -m "<description of version>" ee8d5b5e1387751a9477e74e16e6e0bd2aebc20e
git push origin v0.1.5

Please sign in to comment.