Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #561 from JuliaGPU/tb/seed
Browse files Browse the repository at this point in the history
Fix and test seed methods.
  • Loading branch information
maleadt authored Jan 8, 2020
2 parents e8ff17a + d435e6b commit 4dedd0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rand/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Base.unsafe_convert(::Type{curandGenerator_t}, rng::RNG) = rng.handle
seed!(rng::RNG=generator()) = (curandGenerateSeeds(rng); return)

seed!(seed::Int64, offset::Int64=0) = seed!(generator(), seed, offset)
function seed!(rng::RNG, seed::Int64, offset::Int64)
function seed!(rng::RNG, seed::Int64, offset::Int64=0)
curandSetPseudoRandomGeneratorSeed(rng, seed)
curandSetGeneratorOffset(rng, offset)
@allocates curandGenerateSeeds(rng)
Expand Down
7 changes: 7 additions & 0 deletions test/rand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
using CuArrays.CURAND

CURAND.seed!()
CURAND.seed!(1)
CURAND.seed!(1, 0)

rng = CURAND.generator()
CURAND.seed!(rng)
CURAND.seed!(rng, 1)
CURAND.seed!(rng, 1, 0)

# NOTE: tests should cover both pow2 and non-pow2 dims

Expand Down

0 comments on commit 4dedd0f

Please sign in to comment.