Skip to content
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

Errors when reading file from multiple processes #437

Closed
dchandan opened this issue Jul 16, 2015 · 3 comments
Closed

Errors when reading file from multiple processes #437

dchandan opened this issue Jul 16, 2015 · 3 comments

Comments

@dchandan
Copy link

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.

@shoyer
Copy link
Contributor

shoyer commented Jul 16, 2015

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.

@jswhit
Copy link
Collaborator

jswhit commented Jul 17, 2015

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

@dchandan
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants