Skip to content
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

[OpenBLAS] Add hang-on-exit patch #353

Merged
merged 1 commit into from
Dec 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion O/OpenBLAS/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ fi
# Enter the fun zone
cd ${WORKSPACE}/srcdir/OpenBLAS-*/
cd ${WORKSPACE}/srcdir/OpenBLAS*/
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/openblas-winexit.patch
# Build the actual library
make "${flags[@]}"
Expand Down
27 changes: 27 additions & 0 deletions O/OpenBLAS/bundled/patches/openblas-winexit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
commit b16fa2e7111dc4dc1d9d987bd5dcbf89c82b9ee8
Author: Keno Fischer <[email protected]>
Date: Sun Dec 29 15:08:13 2019 -0500

win32: Don't run cleanup if we're about to exit anyway

If the process is about to exit, there's no point trying to do
a bunch of work to clean up resources. The kernel will release
them much more efficiently when the process exits at the end
of this function.

diff --git a/exports/dllinit.c b/exports/dllinit.c
index 4a05c0e1..88f9af65 100644
--- a/exports/dllinit.c
+++ b/exports/dllinit.c
@@ -50,7 +50,10 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) {
gotoblas_init();
break;
case DLL_PROCESS_DETACH:
- gotoblas_quit();
+ // If the process is about to exit, don't bother releasing any resources
+ // The kernel is much better at bulk releasing then.
+ if (!reserved)
+ gotoblas_quit();
break;
case DLL_THREAD_ATTACH:
break;