Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
b9f7a142
Commit
b9f7a142
authored
Jun 22, 2018
by
scoder
Committed by
GitHub
Jun 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2391 from gabrieldemarmiesse/test_parallelism_2
Added tests to "Using Parallelism" part 2
parents
241b8677
a6ee14bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
docs/examples/userguide/parallelism/breaking_loop.pyx
docs/examples/userguide/parallelism/breaking_loop.pyx
+13
-0
docs/src/userguide/parallelism.rst
docs/src/userguide/parallelism.rst
+2
-14
No files found.
docs/examples/userguide/parallelism/breaking_loop.pyx
0 → 100644
View file @
b9f7a142
from
cython.parallel
import
prange
cdef
int
func
(
Py_ssize_t
n
):
cdef
Py_ssize_t
i
for
i
in
prange
(
n
,
nogil
=
True
):
if
i
==
8
:
with
gil
:
raise
Exception
()
elif
i
==
4
:
break
elif
i
==
2
:
return
i
docs/src/userguide/parallelism.rst
View file @
b9f7a142
...
...
@@ -191,21 +191,9 @@ exiting procedure is best-effort. For prange() this means that the loop
body is skipped after the first break, return or exception for any subsequent
iteration in any thread. It is undefined which value shall be returned if
multiple different values may be returned, as the iterations are in no
particular order:
:
particular order:
from cython.parallel import prange
cdef int func(Py_ssize_t n):
cdef Py_ssize_t i
for i in prange(n, nogil=True):
if i == 8:
with gil:
raise Exception()
elif i == 4:
break
elif i == 2:
return i
.. literalinclude:: ../../examples/userguide/parallelism/breaking_loop.pyx
In the example above it is undefined whether an exception shall be raised,
whether it will simply break or whether it will return 2.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment