Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overload NNlib._rng_compat_array #62

Merged
merged 2 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
NNlib._rng_from_array(::CuArray) = CUDA.default_rng()

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

Expand Down