-
Notifications
You must be signed in to change notification settings - Fork 34
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
Avoid using thread_local to work-around mingw bug #3
base: cpp
Are you sure you want to change the base?
Conversation
ae74a7c
to
b637fc6
Compare
Cc @matthew-brett also |
Thanks a lot for this, @peterbell10 ! I don't have access to a MinGW installation either, so let's see what @carlkl says. |
If I read the changes correctly, the evolution of this multi-threading code in https://github.com/mreineck/ducc/blob/ducc0/src/ducc0/infra/threading.cc should be unaffected by this problem; do you agree @peterbell10 ? Pity we can't switch to this implementation yet, at least for scipy. |
Yes, because you use pass scheduler explicitly instead of via thread-local storage it should be equivalent. |
@peterbell10, I will test this as soon as I can with msys2 scipy. |
As a data point, I tried naively copying
but in both cases, Scipy.fft still hangs. |
Can I ask - what is the best way of replicating the hang without compiling Scipy? I have not observed a hang on my machine when using mingw-w64 to compile the demo from this repo : #1 (comment) - even running the demo hundreds of times. |
I now tested this PR with scipy. Sorry for the long time ... |
This stacktrace looks like issue LLD had with mingw-w64 GCC: https://reviews.llvm.org/D102944 To clarify:
Emutls that GCC uses is buggy on Windows but it's totally unrelated to mingw-w64, TLS in Clang+mingw-w64 works just fine. |
I don't think that this hang is related to DLL unloading but I may be wrong. In my opinion it has to do with threads shutdown. And there is no |
I have to correct myself: The hang happens at process termination. @mati865, is this related to https://sourceforge.net/p/mingw-w64/bugs/859/? |
as reference: msys2/MINGW-packages#10164 (comment). Seems to be the |
Sorry foe the late reply, this notification got lost in my backlog.
I think this is similar issue that might require another fix. |
Ref #1, #2, msys2/MINGW-packages#10164
The mingw issue suggests that thread-local storage is buggy in mingw, so avoiding
thread_local
might help. I don't have a mingw setup to test though.cc @carlkl, @rgommers