Skip to content

Commit

Permalink
Added unit tests for Float16
Browse files Browse the repository at this point in the history
Closes: gh-30
  • Loading branch information
ffevotte committed May 23, 2022
1 parent 1a3ad46 commit 3c2a5d0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
version:
- '1.0'
- '1'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [0.1.6] - Unreleased

### Added

- Support half precision (Float16). Many thanks to milankl (#31)

### Changed

- Updated CompatHelper setup
- Updated compatibility bounds (#34)
- Updated compatibility bounds (#34, #36)



Expand Down
22 changes: 22 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ GFlops.times(::BenchmarkTools.Trial) = [2.0, 3.0]
end
end

@testset "mul+add 16" begin
let N = 100
a = Float16(2.5)
x = rand(Float16, N)
y = similar(x)

cnt = @count_ops my_axpy!(a, x, y)
@test cnt.add16 == N
@test cnt.mul16 == N
@test GFlops.flop(cnt) == 2*N


m = rand(Float16, N, N)
v = rand(Float16, N)

cnt = @count_ops(my_prod(m, v))
@test cnt.add16 == N*N
@test cnt.mul16 == N*N
@test GFlops.flop(cnt) == 2*N*N
end
end

@testset "neg" begin
let cnt = @count_ops -(4.2)
@test cnt.neg64 == 1
Expand Down

0 comments on commit 3c2a5d0

Please sign in to comment.