-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Unexpected behaviour of SharedArray
in single core usage
#10773
Comments
Just to add, one could "fix" the example above by initializing the result arrays as
in case this isn't actually a bug but expected behaviour for |
@nilshg I tried with two systems and wasn't able to reproduce this. Can you give the output of |
Versioninfo:
On this system, I'm getting the following:
The problem does not occur on the same machine using |
Works for me (
|
I can reproduce the problem with
so it's likely a Windows-specific quirk in the SharedArray implementation. I think @twadleigh wrote that code? |
I did write the code for the windows implementation. I didn't, however, do any testing beyond what was already in the testbed for the POSIX implementation. |
Thanks Tracy. Would be helpful if someone who has a Windows machine and a bit of time can try tracking down the OS API calls that underlie the SharedArray operations and figure out more precisely what causes this. |
I just noticed that @nilshg says it is working on 0.4, which makes me scratch my head a bit. |
We seem to be getting more and more "fixed on master but don't know by what" bugs. Unless we can find some obviously related bugfix that would be simple to backport, trying to bisect this on Windows could be a lot of work and might point to some major restructuring of internals that can't be backported. |
Apologies, I might have been a little quick in saying that it works on 0.4; just went back to double check and now I'm getting the same (wrong) results as on 0.3.7. Maybe others who are running both versions could quickly verify this? |
I think I just found the bug, and it is probably only windows-specific by accident. Check out: Line 52 in d534b00
The shared segment name is generated, in part, using system time. If you create shared arrays in succession too quickly (as in this example), you will get non-unique segment names. Is the time returned from time() lower res on windows? If so, that could be why the problem is only noticeable there. Anyway, the fix should be simple. |
Another reason why this may work on POSIX vs. Windows: there is no analog of Still, the fix is to uniquify the segment name. |
Good catch! I would not be at all surprised if |
That's indeed really good debugging, @twadleigh. What about using |
There are some still-unresolved platform discrepancies regarding |
Cc @amitmurthy |
Would |
Maybe try |
Rather than time, this could be done with |
I'm going to put together a PR with a name made from some digits of the pid, some digits of time, and padded with |
Compensates for the lack of an analog of `shm_unlink` in Windows. Addresses JuliaLang#10773.
Went with 6 digits of pid with a long |
Compensates for the lack of an analog of `shm_unlink` in Windows. Addresses JuliaLang#10773.
Compensates for the lack of an analog of `shm_unlink` in Windows. Addresses JuliaLang#10773.
See this discussion in the Julia users group:
When running a
@sync @parallel
loop which writes its results into differentSharedArray
s on just one core, some of the returned arrays will contain information of other arrays being assigned to. This does not happen when the code is run on mutiple cores. I'm copying my original example from the users group below; in this example the return arrayr2
will contain the results ofr3
, while the three arrays calculated in parallel contain the expected results:The text was updated successfully, but these errors were encountered: