HDF5.jl icon indicating copy to clipboard operation
HDF5.jl copied to clipboard

thread safety?

Open bjarthur opened this issue 10 years ago • 1 comments

could someone please elaborate on @timholy 's concern about thread safety here: https://github.com/timholy/HDF5.jl/pull/132

i ask, because i've been having a problem writing .mat files from julia inside a pmap. julia's added procs are processes, not threads, correct? and if each process writes to a separate .mat file, shouldn't all be okay? yet doing so, what was eventually getting stored to disk was on occasion not what i wrote to it. strings were getting truncated or pre-pended to. numbers were changing values. all in a non-deterministic way. only single-threading matwrite by passing the data back to the main thread solved the problem.

bjarthur avatar Sep 11 '15 12:09 bjarthur

Yes, Julia uses processes for pmap. If you see a problem while accessing different files from different processes, then this can also be a problem with the file server -- I've seen systems where even reading (!) 100 files in parallel would return wrong results. That's obviously a system problem, I assume the NFS server was at fault.

From your description it sounds as if HDF5 is not at fault.

eschnett avatar Jun 10 '16 14:06 eschnett

Fixed by #1021.

simonbyrne avatar Jan 19 '23 05:01 simonbyrne