-
Notifications
You must be signed in to change notification settings - Fork 15
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
tests/test_parallel.py fails sometimes #13
Comments
Strange. Also occasionally happens when you execute it locally, or only in tests? It is always only one time domain sample that is wrong? I have not looked into the actual processing at all, but this might be an idea on narrowing the error down. |
I could also make it fail locally, however, only a single time so far. Seems to be a lot less frequent when executed on a local machine. |
Another traceback:
|
So it is not related to the Python version since this is 3.7 now? (That would have been very weird anyways, if all other packages are identical).
|
I'm pretty certain this should solve it. # part of parallel render_bsdm:
def _render_bsdm_sample(i, p, phi, theta, hrirs):
h_l, h_r = hrirs[hrirs.nearest(phi, theta)]
# global shared_array
with shared_arr.get_lock(): # synchronize access
shared_array[i:i + len(h_l), 0] += p * h_l
shared_array[i:i + len(h_l), 1] += p * h_r |
Hm, I am using |
Yes. I see the documentation is confusing in regards of the lock. The way that I understood it so far is, that it provides lock functionality for synchronized access, but it is not managed for you. This is because many examples I found online are also applying the lock in the way I specified in the code above. I did not check all methods. But could it be that |
Seems it was indeed the cf77fa8 and f5e5654 target this issue. The reentrant lock seemed necessary at least for Windows, even though on my local Linux machine I couldn't make it fail with Thank you @HaHeho ! |
Re-opening, because still not resolved. Traceback:
|
Windows potentially (by default) follows a different mechanic of spawning child processes. I am not sure why this would influence the lock though, However, I did not really understand the way you implemented the lock there. What is the reason for using According to this, I would assume that I would try that and see if that solves the problem. |
Actually, https://docs.python.org/3/library/multiprocessing.html#all-start-methods (Explicitly pass resources to child processes) explains that this might actually be cause by the different process spawning on Windows. I would still expect my suggested way above to work, and be the most easy to read. |
Test_parallel fails frequently, but not always.
It seems that
tests/test_parallel.py::test_render_bsdm
is causing it (most of the times?).As it doesn't occur every time, it might be undefined behaviour related to the shared memory access.
I will first try to collect some tracebacks, maybe they show some pattern.
The text was updated successfully, but these errors were encountered: