From ada027b905c2291158909192c93d1075866f5b17 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sat, 7 Jan 2023 10:37:42 -0500 Subject: [PATCH 1/2] overload NNlib._rng_compat_array --- Project.toml | 4 ++-- src/utils.jl | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 8ab8ffa..8ca9abd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "NNlibCUDA" uuid = "a00861dc-f156-4864-bf3c-e6376f28a68d" -version = "0.2.5" +version = "0.2.6" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" @@ -13,7 +13,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] Adapt = "3.3" CUDA = "3.11" -NNlib = "0.8.14" +NNlib = "0.8.15" julia = "1.6" [extras] diff --git a/src/utils.jl b/src/utils.jl index f6ce38f..04bcef1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,5 +1,9 @@ NNlib._rng_from_array(::CuArray) = CUDA.default_rng() +NNlib._rng_compat_array(::CUDA.RNG, ::CuArray) = nothing +NNlib._rng_compat_array(rng::AbstractRNG, ::CuArray) = throw(ArgumentError( + "cannot use RNG::$(typeof(rng)) with array::CuArray")) + function divide_kernel!(xs, ys, max_idx) index = threadIdx().x + (blockIdx().x - 1) * blockDim().x From 1f56f108c3aa60648c939aa9551291a8e7575c1e Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sat, 7 Jan 2023 12:19:04 -0500 Subject: [PATCH 2/2] trigger CI --- src/utils.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index 04bcef1..a9eaa8d 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,8 +1,8 @@ NNlib._rng_from_array(::CuArray) = CUDA.default_rng() -NNlib._rng_compat_array(::CUDA.RNG, ::CuArray) = nothing -NNlib._rng_compat_array(rng::AbstractRNG, ::CuArray) = throw(ArgumentError( - "cannot use RNG::$(typeof(rng)) with array::CuArray")) +NNlib._rng_compat_array(rng::CUDA.RNG, A::CuArray) = nothing +NNlib._rng_compat_array(rng::AbstractRNG, A::CuArray) = throw(ArgumentError( + "cannot use rng::$(typeof(rng)) with array::CuArray, only CUDA's own RNG type works")) function divide_kernel!(xs, ys, max_idx) index = threadIdx().x + (blockIdx().x - 1) * blockDim().x