Skip to content

Commit

Permalink
minor test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
denizyuret committed Feb 12, 2022
1 parent f5ae0e6 commit 0d372be
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
29 changes: 29 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
Knet v1.4.10 Release Notes
=========================

* switch default GPU array type from KnetArray to CuArray
* allow loading on Apple M1
* support SpecialFunctions 2.x
* fix674: libknet8 compile error on unknown architectures
* tutorial updates
* minor test fixes


Knet v1.4.9 Release Notes
=========================
4720782 2021-10-13

* progress on layers21
* added vae chapter to docs
* updated libknet8 for windows
* made tutorial colab compatible


Knet v1.4.8 Release Notes
=========================
13fea96 2021-08-08

* fixed libknet8 path


Knet v1.4.7 Release Notes
=========================
d4af838 2021-07-23

* Compatibility fixes for Julia 1.6/1.7 and CUDA 3.x.
* Starting ops21, layers21, models21.
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Knet"
uuid = "1902f260-5fb4-5aff-8c31-6271790ab950"
authors = ["Deniz Yuret <denizyuret@gmail.com>"]
version = "1.4.9"
version = "1.4.10"

[deps]
AutoGrad = "6710c13c-97f1-543f-91c5-74e8f7d95b35"
Expand All @@ -27,8 +27,8 @@ FileIO = "1.0"
ImageCore = "0.7, 0.8, 0.9"
ImageMagick = "1.0"
JLD2 = "0.1, 0.2, 0.3, 0.4"
NNlib = "0.6, 0.7"
SpecialFunctions = "0.8, 0.9, 0.10, 1.0, 2"
NNlib = "0.6, 0.7, 0.8"
SpecialFunctions = "0.8, 0.9, 0.10, 1.0, 2.0"
julia = "1.0"

[extras]
Expand Down
6 changes: 3 additions & 3 deletions test/karray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ if CUDA.functional()
([1,3],:), (:,[1,3]), # Vector{Int},Colon
([2,2],:), (:,[2,2]), # Repeated index
# ([],), # Empty Array: fails with CuArray
((a.>0.5),), # BitArray
(trues(size(a)),), # BitArray: may fail when using (a.>0.5) as index if all false.
([1 3; 2 4],), # Array{Int}
(CartesianIndex(3,),), (CartesianIndex(2,3),), # CartesianIndex
(:,a[1,:].>0.5),(a[:,1].>0.5,:), # BitArray2 # FAIL for julia4
(:,trues(size(a[1,:]))),(trues(size(a[:,1])),:), # BitArray2 # FAIL for julia4
([CartesianIndex(2,2), CartesianIndex(2,1)],), # Array{CartesianIndex} # FAIL for julia4
)
#@show i
Expand Down Expand Up @@ -144,7 +144,7 @@ if CUDA.functional()
(:,:,2), # Colon, Colon, Int
(:,:,1:2), # Colon, Colon, UnitRange
# ([],), # Empty Array fails with CuArray
((a.>0.5),), # BitArray
(trues(size(a)),), # BitArray
)
#@show i
k = KnetArray(a)
Expand Down
8 changes: 3 additions & 5 deletions test/kptr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ end
# Test the cuda allocator.
if CUDA.functional()
cuallocator[]=true
cxt = CUDA.context()
usedmem() = CUDA.usage(cxt)[] - CUDA.cached_memory()
used = usedmem()
used = CUDA.used_memory()
@testset "kptr:cuda" begin
@test (p = KnetPtr(128); usedmem() == used + 128)
@test (p = KnetPtr(128); CUDA.used_memory() == used + 128)
p = nothing
end
end
Expand All @@ -55,7 +53,7 @@ GC.gc(true)

if CUDA.functional()
@testset "kptr:cudagc" begin
@test usedmem() == used
@test CUDA.used_memory() == used
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/serialize.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Test, Random, FileIO, JLD2
using Knet.KnetArrays: KnetArray, Cptr, jld2serialize, cpucopy, gpucopy
using Knet.Ops20: RNN, conv4
using CUDA: CUDA, functional
using CUDA: CUDA, functional, @allowscalar
using AutoGrad: Param, params, @diff, value

struct M370; layer; end;
Expand All @@ -10,12 +10,12 @@ struct M370; layer; end;
M1 = RNN(2,3)
M2 = M1 |> cpucopy
@test typeof(M2.w.value) <: Array
@test M2.w.value == M1.w.value
@test @allowscalar M2.w.value == M1.w.value
@test Array{Float32} == jld2serialize(Array{Float32})
if CUDA.functional()
M3 = M2 |> gpucopy
@test typeof(M3.w.value) <: KnetArray
@test M3.w.value == M2.w.value
@test @allowscalar M3.w.value == M2.w.value
array_of_ka = map(value,params(M3))
array_of_ca = array_of_ka |> cpucopy
@test first(array_of_ca) isa Array
Expand Down

2 comments on commit 0d372be

@denizyuret
Copy link
Owner Author

Choose a reason for hiding this comment

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

@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/54527

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 v1.4.10 -m "<description of version>" 0d372be17c0546fa3cef6fd12aff0f9ef4223544
git push origin v1.4.10

Please sign in to comment.