Trying to read from a HDF5 file and convert to another format in parallel?

Just to be clear, the following thread-parallel writing and reading (of different HDF5 files) works just fine (because of the lock mentioned by @mkitti):

@sync for t in 1:nthreads()
    @spawn h5open("file$t.h5", "w") do f
        for i in 1:100
            f[string(i)] = rand(1000, 1000)
        end
    end
end

@sync for t in 1:nthreads()
    @spawn h5open("file$t.h5", "r") do f
        s = 0.0
        for i in 1:100
            s += sum(read(f[string(i)]))
        end
        @show t, s
    end
end

It’s hence not clear - at least not to me - where the segfault in the OP is coming from.