Using pickle to write and read files in python with multiple processes

  mpi, pickle, python

I am using mpi4py and want to write and read pickle files in the process. I keep getting errors like

return pickle.load(open(filename, "rb"))
EOFError: Ran out of input

I am pretty sure this is because a thread is trying to read a file that is currently open to write by another thread. How can I make pickle MPI-safe?

Source: Python Questions

LEAVE A COMMENT