Skip to content

Errors when reading file from multiple processes #437

Closed

Description

@dchandan

I am encountering HDF error in a program where the file id's of input files are shared across multiple python processes for concurrent reading. If I substitute the netCDF4 library for the PyNIO library, then no errors are produced. Would you know why the netCDF4 library is not working for concurrent reads? I installed netCDF4 through the enthought python distribution.

Activity

  1. shoyer commented on Jul 16, 2015

    @shoyer
    Contributor

    Are you attempting to use the same netCDF4.Dataset object across multiple processes? My understanding is that netCDF4.Dataset objects cannot be pickled, and hence, cannot be transferred between processes. However, in my experience it works fine if the Dataset objects are created in the separate processes.

  2. jswhit commented on Jul 17, 2015

    @jswhit
    Collaborator

    do you mean that you get an error with PyNIO, but not netCDF4, or vice-versa?

  3. dchandan commented on Jul 17, 2015

    @dchandan
    Author

    I am afraid I reached my conclusions far too quickly. Although I thought that PyNIO was passing my tests, it turned out that was pure luck, and that in fact on subsequent runs I encountered the same problem as with netcdf4. I followed up with Stephan's comment and he is right - the Dataset object cannot be shared among multiple processes. The problem with PyNIO was the same (although they don't call it Dataset). I ended up with opening the files from multiple processes and that worked out with both netCDF4 and PyNIO. Sorry for prematurely reporting this as an issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions