JuliaSIMD / VectorizedRNG.jl

Vectorized uniform and normal random samplers.
MIT License
33 stars 7 forks source link

Strange error #6

Open PallHaraldsson opened 4 years ago

PallHaraldsson commented 4 years ago

I thought I should let you know, even if this didn't stop me from using the package:

I had recently instaled a later nightly.

julia> using VectorizedRNG
ERROR: InitError: could not load library "libdSFMT"
libdSFMT.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dsfmt_init_by_array at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/DSFMT.jl:70 [inlined]
 [2] seed!(::Random.MersenneTwister, ::Array{UInt32,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/RNGs.jl:282
 [3] seed! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/RNGs.jl:289 [inlined]
 [4] seed! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/Random.jl:426 [inlined]
 [5] Random.MersenneTwister(::Nothing) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/RNGs.jl:138 (repeats 2 times)
 [6] default_rng(::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/RNGs.jl:303
 [7] default_rng at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/RNGs.jl:297 [inlined]
 [8] rand(::Type{UInt64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/Random.jl:259
 [9] randnonzero at /home/pharaldsson_sym/.julia/packages/VectorizedRNG/dtFZR/src/xoshiro.jl:20 [inlined]
 [10] initXoshift!(::Ptr{UInt64}, ::Int64) at /home/pharaldsson_sym/.julia/packages/VectorizedRNG/dtFZR/src/xoshiro.jl:25
 [11] __init__() at /home/pharaldsson_sym/.julia/packages/VectorizedRNG/dtFZR/src/VectorizedRNG.jl:59
 [12] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [13] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:781
 [14] _require(::Base.PkgId) at ./loading.jl:1006
 [15] require(::Base.PkgId) at ./loading.jl:927
 [16] require(::Module, ::Symbol) at ./loading.jl:922
during initialization of module VectorizedRNG

julia> using VectorizedRNG

[no error]

[ran code using the RNG and got no error, but as usual, no output so just assume it worked.]

julia> versioninfo()
Julia Version 1.5.0-DEV.360
Commit 012b270df6 (2020-02-28 07:57 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, broadwell)

[then a strange thing, after exiting]

$ julia

julia> using VectorizedRNG
[ Info: Precompiling VectorizedRNG [33b4df10-0173-11e9-2a0c-851a7edac40e]

julia> using VectorizedRNG
PallHaraldsson commented 4 years ago

I misread, I was actually running in old Julia 1.5, so I had never precompiled on newer 1.5.

So the precompile is not strange, and probably installing a later 1.5, i.e. having two is a problem (just shouldn't be?). Could the later install (I had probably already run if, for some other code), messed up for the installed packages for older 1.5?

PallHaraldsson commented 4 years ago

FYI, after running in later 1.5, I can open older 1.5 and run same code, no problem in neither.

I get slightly more allocations for first run in later 1.5 (compiler changed), but same for second run.

chriselrod commented 4 years ago

That looks like the error was from the Random standard library:

ERROR: InitError: could not load library "libdSFMT"
libdSFMT.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dsfmt_init_by_array at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/DSFMT.jl:70 [inlined]
 [2] seed!(::Random.MersenneTwister, ::Array{UInt32,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Random/src/RNGs.jl:282

which uses libdSFMT. When you load VectorizedRNG, it uses the default random number generator to set its initial state. Somehow, it looks like the default random number generator was broken.