-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error creating group #4
Comments
Glad you like it :) |
thanks for the thought--yes, this code is accessing HDF5 from only the master thread that is running In my case, rather than Edit: to make this more clear, I added an assertion to the code: |
Ah, sorry. My mistake. |
thx for the thought. no resolution I'm afraid. What's frustrating is the error is different each time it runs. Clearly related to threading, though--works fine with unable to flush file
Segmentation fault
unable to get link info
The distributed version runs fine, however. Very odd. using HDF5, H5Sparse, SparseArrays
import Base.Threads: @threads
using Distributed
import Distributed: @distributed
addprocs(36)
@everywhere begin
import Pkg
Pkg.activate(".")
using SparseArrays
end
function write_n_sparse_datasets(h5path, n, channel, blocker, type=:H5)
h5 = h5open(h5path, "w")
while n > 0
@assert Threads.threadid() == 1 # we only access from the master thread
dset_name, data = take!(channel)
take!(blocker)
println("take $n")
if type == :H5
h5[dset_name] = data
elseif type == :H5Sparse
H5SparseMatrixCSC(h5, dset_name, data)
end
n -= 1
end
h5
end
function test(type=:H5, n=10, N=512*512*300)
to_write = RemoteChannel(()->Channel(Inf))
blocker = RemoteChannel(()->Channel(5))
h5_path = tempname()*".h5"
isfile(h5_path) ? rm(h5_path) : ()
@distributed for i in 1:n
@async begin
put!(blocker, i)
println("start $i")
data = collect(rand(N,1) .> 0.9)
if type == :H5
put!(to_write, "$i" => data)
elseif type == :H5Sparse
data = sparse(data)
put!(to_write, "$i" => data)
end
println("put $i")
end
end
println("call write")
h5 = write_n_sparse_datasets(h5_path, n, to_write, blocker, type)
@show keys(h5)
close(h5)
rm(h5_path)
end
test(:H5Sparse, 100) # no errors |
I don't think this is a problem with H5Sparse at this point, so closing |
Hello, thanks for this package!
I've encountered a very subtle bug that does seem specifically triggered by H5Sparse.jl and not HDF5.jl. I've created a minimally working example below. I have not been able to trigger the bug without the use of a Channel. It seems there is a race condition related to group creation...
Error output
The text was updated successfully, but these errors were encountered: