Commit f677f4f
committed
blas_thread_shutdown: release OpenMP resources too
OpenMP 5.0 introduced the function omp_pause_resource_all that instructs
the runtime to "relinquish resources used by OpenMP on all devices". In
practice, these resources include the locks that would otherwise trip up
the runtime after a fork(). Releasing these resources in a function
called by pthread_atfork() makes it possible for the child process to
continue functioning after the runtime automatically re-acquires its
resources.
Thread safety: blas_thread_shutdown doesn't check whether there are
other BLAS operations running in parallel, so this isn't any less safe
than before with respect to OpenBLAS function calls. On the other hand,
if there are other OpenMP operations in progress, asking the runtime to
pause may result in unspecified behaviour. A hard pause is allowed to
deallocate threadprivate variables too.1 parent c5f0dcf commit f677f4f
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
| |||
0 commit comments