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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
27ffe2c8
Commit
27ffe2c8
authored
May 15, 2020
by
da-woods
Committed by
Stefan Behnel
May 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run ParallelRangeTransform also recursively on function arguments (GH-3608)
Closes
https://github.com/cython/cython/issues/3594
parent
3b1b45de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+1
-0
tests/run/parallel.pyx
tests/run/parallel.pyx
+6
-0
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
27ffe2c8
...
@@ -1161,6 +1161,7 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
...
@@ -1161,6 +1161,7 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
def
visit_CallNode
(
self
,
node
):
def
visit_CallNode
(
self
,
node
):
self
.
visit
(
node
.
function
)
self
.
visit
(
node
.
function
)
if
not
self
.
parallel_directive
:
if
not
self
.
parallel_directive
:
self
.
visitchildren
(
node
,
exclude
=
(
'function'
,))
return
node
return
node
# We are a parallel directive, replace this node with the
# We are a parallel directive, replace this node with the
...
...
tests/run/parallel.pyx
View file @
27ffe2c8
...
@@ -8,6 +8,9 @@ from libc.stdlib cimport malloc, free
...
@@ -8,6 +8,9 @@ from libc.stdlib cimport malloc, free
openmp
.
omp_set_nested
(
1
)
openmp
.
omp_set_nested
(
1
)
cdef
int
forward
(
int
x
)
nogil
:
return
x
def
test_parallel
():
def
test_parallel
():
"""
"""
>>> test_parallel()
>>> test_parallel()
...
@@ -20,6 +23,9 @@ def test_parallel():
...
@@ -20,6 +23,9 @@ def test_parallel():
with
nogil
,
cython
.
parallel
.
parallel
():
with
nogil
,
cython
.
parallel
.
parallel
():
buf
[
threadid
()]
=
threadid
()
buf
[
threadid
()]
=
threadid
()
# Recognise threadid() also when it's used in a function argument.
# See https://github.com/cython/cython/issues/3594
buf
[
forward
(
cython
.
parallel
.
threadid
())]
=
forward
(
threadid
())
for
i
in
range
(
maxthreads
):
for
i
in
range
(
maxthreads
):
assert
buf
[
i
]
==
i
assert
buf
[
i
]
==
i
...
...
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