#12690: Signal handling doesn't properly handle OpenMP code
--------------------------+----------------------------------------------
Reporter: ohanar | Owner: jdemeyer
Type: defect | Status: needs_review
Priority: major | Milestone: sage-duplicate/invalid/wontfix
Component: c_lib | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------+----------------------------------------------
Comment (by jdemeyer):
Using `sig_check()` inside the loop does work:
{{{
from cython.parallel import prange
include 'ext/interrupt.pxi'
def dumb_function():
cdef int i,x
while True:
for i in prange(1<<30,nogil=True):
with gil:
sig_check()
x += i
return x
}}}
From Cython's point of view, `sig_check()` simply raises an exception when
an interrupt occurred, which is explicitly allowed by
[http://docs.cython.org/src/userguide/parallelism.html#breaking-out-of-
loops]
The worst-case overhead is one loop iteration per thread, which is optimal
given the limitations of OpenMP.
We should probably declare `sig_check()` as nogil though, see #15352.
--
Ticket URL: <http://trac.sagemath.org/ticket/12690#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.