-
Notifications
You must be signed in to change notification settings - Fork 32
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
Multiprocessing RuntimeError #192
Comments
Hi Max. Could you try putting your code in a function or using Something like: if __name__ == "__main__":
# your code goes here. |
Yes, I’m going to try |
It seems the fitting procedure has been started successfully, it's running. I've used |
Great! I think if you don't use the main check then the module gets
imported when the new process starts causing a recursion.
…On Fri, 8 Jul 2022, 16:51 MAX22110, ***@***.***> wrote:
It seems the fitting procedure has been started successfully, it's running
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQRGMQU2AR73Y3EH6YFZ7TVTBFBZANCNFSM526YUPGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Do you mean the module spawn.py? |
@rhayes777 Any advise for how I should build this into example scripts to ensure it doesnt crop up again? Would be annoying to have extra lines of code (e.g. |
I don't think there is anyway to avoid this exception on MacOS doing multiprocessing without that check. I'll have a dig just in case. |
Hi, I’m afraid (though I’m not sure this is the true reason) there is some problem with the solution you have found. |
@rhayes777 I think we need to stress-test parallelization of multiple PYthon versions (3.6 -> 3.9) and for different numpy / numba versions. I suspect this issue hasnt cropped up before because I am used to using 3.6. |
Could you see me your script so I can try to replicate the issue?
…On Tue, 12 Jul 2022, 10:27 MAX22110, ***@***.***> wrote:
Hi, I’m afraid (though I’m not sure this is the true reason) there is some
problem with the solution you have found.
In fact whenever I launch the script with that command you suggested, I’m
leaved with tons of background python multiprocessing running process and
this gives me an out of memory problem. I have to kill all of them
manually. I repeat, I don’t know if the reason is that command, but I’ve
never had this problem before.
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQRGMSD6JRN7IMXACVAIM3VTU27RANCNFSM526YUPGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
They are on |
Also on Linux (windows subsystem for linux techncially) |
Running my code, I am given the following error:
File "", line 1, in
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
prepare(preparation_data)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/runpy.py", line 268, in run_path
return _run_module_code(code, init_globals, run_name,
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/Max/Data_Analysis/StrongPipeline4.py", line 1408, in
result_7 = search.fit(model=model, analysis=analysis_6)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/site-packages/autofit/non_linear/abstract_search.py", line 489, in fit
self._fit(model=model, analysis=analysis, log_likelihood_cap=log_likelihood_cap)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/site-packages/autofit/non_linear/nest/dynesty/abstract.py", line 145, in _fit
pool = self.make_sneaky_pool(
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/site-packages/autofit/non_linear/abstract_search.py", line 64, in wrapper
return func(self, *args, **kwargs)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/site-packages/autofit/non_linear/abstract_search.py", line 730, in make_sneaky_pool
return SneakyPool(
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/site-packages/autofit/non_linear/parallel/sneaky.py", line 256, in init
process.start()
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "/Users/Max/miniconda3/envs/autolens/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if name == 'main':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
I am working with the Python version 3.9 and I'm running the code on remote machine through ssh.
The remote machine is a Mac.
The text was updated successfully, but these errors were encountered: