diff --git a/Project.toml b/Project.toml index ac68126..7449df6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,9 +1,8 @@ name = "KSVD" uuid = "778123d0-3295-4563-8004-fb5c576fbcd9" -version = "1.8.0" +version = "1.8.1" [deps] -ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" @@ -28,15 +27,14 @@ DistributedArrays = "aaf54ef3-cdf8-58ed-94cc-d582ad619b94" KSVDCudaExt = "CUDA" [compat] -ChunkSplitters = "2" DataStructures = "0.18" Distributions = "0.22 - 0.25" -OhMyThreads = "0.5" +KrylovKit = "0.8" +OhMyThreads = "0.5 - 0.8" PrecompileTools = "1" ProgressMeter = "1" SparseArrays = "1.9" StatsBase = "0.30 - 0.35" -KrylovKit = "0.8" ThreadedDenseSparseMul = "0.4, 0.5" TimerOutputs = "0.5" julia = "1.9" diff --git a/src/ksvd_update.jl b/src/ksvd_update.jl index 9b67d9d..32f1abf 100644 --- a/src/ksvd_update.jl +++ b/src/ksvd_update.jl @@ -4,7 +4,7 @@ import OhMyThreads import OhMyThreads: tforeach # import OhMyThreads: SerialScheduler import TimerOutputs: TimerOutput, @timeit -import ChunkSplitters: chunks +import OhMyThreads.ChunkSplitters: chunks import Base.Threads: nthreads, threadpool # set a default @@ -141,7 +141,7 @@ function compute_E_Ω!(::ThreadedKSVDMethodPrecomp{true}, E_Ω_buf, E, Y, D, X, if size(E_Ω_buf, 2) <= length(ωₖ) @warn """ - The preallocated error buffer is too small. Not all errors will be computed. This is probably because + The preallocated error buffer is too small: $(size(E_Ω_buf, 2)) vs $(length(ωₖ)). Not all errors will be computed. This is probably because `maybe_init_buffer!` has been called with a ratio_nonzero that's too small. Try setting it to `1`. """ ωₖ = ωₖ[1:size(E_Ω_buf, 2)] diff --git a/src/ksvd_update_threaded_utils.jl b/src/ksvd_update_threaded_utils.jl index f3cb6a2..a04620b 100644 --- a/src/ksvd_update_threaded_utils.jl +++ b/src/ksvd_update_threaded_utils.jl @@ -1,4 +1,4 @@ -maybe_init_buffers!(method::KSVDMethod, emb_dim, n_dict_vecs, n_samples, timer=TimerOutput(); pct_nz=1.) = nothing +maybe_init_buffers!(method::KSVDMethod, emb_dim, n_dict_vecs, n_samples, timer=TimerOutput(); ratio_nonzero=1.) = nothing function maybe_init_buffers!(method::Union{ParallelKSVD{precompute_error, T}, BatchedParallelKSVD{precompute_error, T}}, emb_dim, n_dict_vecs, n_samples, timer=TimerOutput(); ratio_nonzero=1.) where {precompute_error, T<:Real} @timeit_debug timer "init buffers" begin diff --git a/src/util.jl b/src/util.jl index f5491b8..ac58cb6 100644 --- a/src/util.jl +++ b/src/util.jl @@ -67,7 +67,7 @@ end # gen() = sum(sample([0,1], ProbabilityWeights([0.99, 0.01]), 100_000)) # histogram([gen() for _ in 1:1000]) " Compute buffer size that is large enough with extremely high likelyhood." -function compute_reasonable_buffer_size(N, pct_nz; failure_chance = eps()) +function compute_reasonable_buffer_size(N, pct_nz; failure_chance = 0) D = Binomial(N, pct_nz) quantile(D, 1-failure_chance) end diff --git a/test/runtests.jl b/test/runtests.jl index 16dc373..9a7f6a2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -13,4 +13,5 @@ end @testset "Run the whole thing" begin data = rand(100, 500) ksvd(data, 200) + @test true end