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
4dd190a7
Commit
4dd190a7
authored
May 04, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shut up as much compiler warnings as possible through firstprivate
parent
a3e838e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+14
-0
tests/run/sequential_parallel.pyx
tests/run/sequential_parallel.pyx
+4
-6
No files found.
Cython/Compiler/Nodes.py
View file @
4dd190a7
...
@@ -6146,8 +6146,20 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -6146,8 +6146,20 @@ class ParallelRangeNode(ParallelStatNode):
# Note: nsteps is private in an outer scope if present
# Note: nsteps is private in an outer scope if present
code
.
putln
(
"%(nsteps)s = (%(stop)s - %(start)s) / %(step)s;"
%
fmt_dict
)
code
.
putln
(
"%(nsteps)s = (%(stop)s - %(start)s) / %(step)s;"
%
fmt_dict
)
# The target iteration variable might not be initialized, do it only if
# we are executing at least 1 iteration, otherwise we should leave the
# target unaffected. The target iteration variable is firstprivate to
# shut up compiler warnings caused by lastprivate, as the compiler
# erroneously believes that nsteps may be <= 0, leaving the private
# target index uninitialized
code
.
putln
(
"if (%(nsteps)s > 0)"
%
fmt_dict
)
code
.
begin_block
()
code
.
putln
(
"%(target)s = 0;"
%
fmt_dict
)
self
.
generate_loop
(
code
,
fmt_dict
)
self
.
generate_loop
(
code
,
fmt_dict
)
code
.
end_block
()
# And finally, release our privates and write back any closure
# And finally, release our privates and write back any closure
# variables
# variables
for
temp
in
start_stop_step
:
for
temp
in
start_stop_step
:
...
@@ -6173,6 +6185,8 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -6173,6 +6185,8 @@ class ParallelRangeNode(ParallelStatNode):
if
op
and
op
in
"+*-&^|"
and
entry
!=
self
.
target
.
entry
:
if
op
and
op
in
"+*-&^|"
and
entry
!=
self
.
target
.
entry
:
code
.
put
(
" reduction(%s:%s)"
%
(
op
,
entry
.
cname
))
code
.
put
(
" reduction(%s:%s)"
%
(
op
,
entry
.
cname
))
else
:
else
:
if
entry
==
self
.
target
.
entry
:
code
.
put
(
" firstprivate(%s)"
%
entry
.
cname
)
code
.
put
(
" lastprivate(%s)"
%
entry
.
cname
)
code
.
put
(
" lastprivate(%s)"
%
entry
.
cname
)
if
self
.
schedule
:
if
self
.
schedule
:
...
...
tests/run/sequential_parallel.pyx
View file @
4dd190a7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
cimport
cython.parallel
cimport
cython.parallel
from
cython.parallel
import
prange
,
threadid
from
cython.parallel
import
prange
,
threadid
from
libc.stdlib
cimport
malloc
,
free
from
libc.stdlib
cimport
malloc
,
free
,
abort
from
libc.stdio
cimport
puts
from
libc.stdio
cimport
puts
import
sys
import
sys
...
@@ -67,11 +67,7 @@ def test_propagation():
...
@@ -67,11 +67,7 @@ def test_propagation():
def
test_unsigned_operands
():
def
test_unsigned_operands
():
"""
"""
This test is disabled, as this currently does not work (neither does it
>>> test_unsigned_operands()
for 'for i from x < i < y:'. I'm not sure we should strife to support
this, at least the C compiler gives a warning.
test_unsigned_operands()
10
10
"""
"""
cdef
int
i
cdef
int
i
...
@@ -83,6 +79,8 @@ def test_unsigned_operands():
...
@@ -83,6 +79,8 @@ def test_unsigned_operands():
for
i
in
prange
(
start
,
stop
,
step
,
nogil
=
True
):
for
i
in
prange
(
start
,
stop
,
step
,
nogil
=
True
):
steps_taken
+=
1
steps_taken
+=
1
if
steps_taken
>
10
:
abort
()
return
steps_taken
return
steps_taken
...
...
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