Hi all,
> It smells like something that's happening at the HDF5 level, rather than the
> h5py level. I can't back that up (and it won't be anytime soon that I can
> investigate it), but the behavior is exactly what you would expect for a
> memory page somewhere in the library that's not marked copy-on-write but
> should be. It's been a pain to work around, but not so much of a pain that
> I've had to go digging (yet).
My impression is that the HDF5 library is not routinely tested against
fork()-based programs. It's disappointing, but likewise I was never
able to figure out exactly what caused this behavior. If anyone does
manage to track it down I'm sure the HDF Group would also like to
know. Until then the best approach is to not open your file(s) until
the child processes start.
Because of the headaches of using HDF5 with the multiprocessing
package, we added a new capability in h5py 2.2 which allows access to
Parallel HDF5 using mpi4py:
http://www.h5py.org/docs/topics/mpi.html
MPI is very different from the "multiprocessing" model, but among
other things it lets you access (read & write) the same file from
multiple parallel processes at the same time. MPI is the parallelism
flavor officially supported by the HDF Group, so it's also very well
tested.
Andrew