Multiprocessing (windows 10) BrokenPipeError: [Errno 32] Broken pipe

That’s great news! Thanks @lucianopaz!
The reason that windows needs the if __name__ is that on windows multiprocessing creates a completely new process, that then has to import the modules the code is using. On Unix it just forks the process, so it basically copies the original processes memory space (using copy on write so that it can do it fast).
It should work on jupyter, that does stuff internally to make using multiprocessing possible (but if you have a machine that fails that way handy, it would be great if you could try again just to make sure :slight_smile: )

So I guess this means that the problem is mostly about bad error messages? Somehow we lose the original (meaningful) RuntimeError or theano error and instead print the BrokenPipeError.
I guess when we receive a message from the other end we should catch BrokenPipeError and try to figure out what happend on the other end. We could also try to make the child process a bit more resilient to errors like that, it shouldn’t die because it can’t compute a gradient.

The relevant code should be here:

If I read the second warning here correctly, then I’m a bit confused about why we don’t get the error message on the main thread. If there is a theano problem, it should send that error message to the main thread and then exit. But why does the main thread just see a Broken Pipe, and not the error massage?

2 Likes