-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
make julia -p N use fork instead of exec #985
Comments
Summary of state that needs to be reinitialized:
Then we need to run This could use the feature in process.jl that allows spawning a julia function like a process, since that does fork without exec. It might be annoying that processes started this way share some state (like which files have been loaded), while remote processes will not. This means something tested with local processes might not work when distributed. So in summary I'm not fully convinced this is a good idea. |
Plus, it's not possible to do cleanly on Windows (though of course it would be possible to have different approaches for Unix/Windows) |
Ok, I'm going to mark this as "won't fix" and close it then. |
I'd like to resume this issue, since I think fork() is an essential tool for performance tuning on unix. Since you already closed this issue, I'd like you to change your mind with a more elaborated answer:
This relates to my issue #7589, as it's a pretty obvious optimization that should be invisible to the user if implemented properly. |
+1. I strongly agree.
|
We are soon going to have multi threading support. For many cases that will end up being a better solution, but fork based solutions will still be needed. |
It's unclear whether it will be possible/practical to have identical semantics for multiprocess vs. multithreaded setups, so one may want to use multiple processes even if threads could be more efficient just so that the semantics are the same as they would be for a fully distributed computation. |
This. I'd argue they should not be. We obviously want both to be as easy to use as possible, but they're such different models that we shouldn't try to make them indistinguishable from one another. I don't think Julia's parallel performance is up to snuff with MPI for fine-grained communication (but I should really get on that NERSC paperwork to find out for sure), but all of today's serious HPC clusters are running hybrid distributed/shared setups with MPI between nodes and OpenMP within the cores on each node (and an increasing number of them throw in Cuda/OpenCL/Xeon Phi accelerators into that mix too). Exposing independent hierarchical control of threads and processes to expert users will be vital to edge Julia's capabilities further in that direction. |
Yeah, that's where we're leaning towards. But that means you might still want to use the multiprocess model sometimes. |
I think we're in the same line of thought here. My specific usage scenario of fork() as a hidden optimization is ClusterManager was only a sensible motivator for not discarding fork as "non portable". It's obvious that fork would allow more sophisticated forms of IPC as well (different processes but with shared memory segments, descriptor passing, etc), and combinations of all forms of parallelism can be used at the same time in complex projects (ie, MPI allows multi-process + multi-thread models to co-exist and communicate with varying degree of messaging cost). Depends entirely on what the programmer wants to do and what models the underlying data/algorithm supports. |
Re windows: I came across some discussion of NtCreateProcess / ZwCreateProcess last night and wanted to mention it because it hasn't come up before on the list. Seems to be undocumented, and cygwin chose not to use it. However, SciLab does use it for their windows fork implementation, fwiw... |
I'll throw in some more considerations about using fork() here. I was recently trying to use vfork+exec directly from julia. Consider the following pseudocode: 1: pid = ccall(:vfork) Is it currently safe to assume that nothing is polling descriptors/queues Do we need a macro to disable libuv within a block, and/or need a macro to disable tasks entirely? There is also some state to be reset when forking. For instance, the list of Until then, there's not much that can be done in the forked process. For |
The tricky bit here is making sure each process knows that it isn't process 1.
The text was updated successfully, but these errors were encountered: