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
Xavier Thompson
cython
Commits
b48900fd
Commit
b48900fd
authored
May 04, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test runner and make nsteps private
parent
35d5e233
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
13 deletions
+21
-13
.hgignore
.hgignore
+1
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+12
-12
runtests.py
runtests.py
+8
-1
No files found.
.hgignore
View file @
b48900fd
...
...
@@ -11,6 +11,7 @@ Cython/Runtime/refnanny.c
BUILD/
build/
dist/
.git/
.gitrev
.coverage
*.orig
...
...
Cython/Compiler/Nodes.py
View file @
b48900fd
...
...
@@ -5754,6 +5754,9 @@ class ParallelStatNode(StatNode, ParallelNode):
#pragma omp for
We need this to determine the sharing attributes.
privatization_insertion_point a code insertion point used to make temps
private (esp. the "nsteps" temp)
"""
child_attrs
=
[
'body'
]
...
...
@@ -5936,6 +5939,8 @@ class ParallelWithBlockNode(ParallelStatNode):
code
.
put
(
'private(%s)'
%
', '
.
join
([
e
.
cname
for
e
in
self
.
privates
]))
self
.
privatization_insertion_point
=
code
.
insertion_point
()
code
.
putln
(
""
)
code
.
putln
(
"#endif /* _OPENMP */"
)
...
...
@@ -6138,13 +6143,7 @@ class ParallelRangeNode(ParallelStatNode):
# 'with gil' block. For now, just abort
code
.
putln
(
"if (%(step)s == 0) abort();"
%
fmt_dict
)
# Guard for never-ending loops: prange(0, 10, -1) or prange(10, 0, 1)
# range() returns [] in these cases
code
.
put
(
"if ( (%(start)s < %(stop)s && %(step)s > 0) || "
"(%(start)s > %(stop)s && %(step)s < 0) ) "
%
fmt_dict
)
code
.
begin_block
()
code
.
putln_openmp
(
"#pragma omp critical"
)
# Note: nsteps is private in an outer scope if present
code
.
putln
(
"%(nsteps)s = (%(stop)s - %(start)s) / %(step)s;"
%
fmt_dict
)
self
.
generate_loop
(
code
,
fmt_dict
)
...
...
@@ -6161,9 +6160,6 @@ class ParallelRangeNode(ParallelStatNode):
self
.
release_closure_privates
(
code
)
# end the 'if' block that guards against infinite loops
code
.
end_block
()
def
generate_loop
(
self
,
code
,
fmt_dict
):
code
.
putln
(
"#ifdef _OPENMP"
)
...
...
@@ -6182,6 +6178,12 @@ class ParallelRangeNode(ParallelStatNode):
if
self
.
schedule
:
code
.
put
(
" schedule(%s)"
%
self
.
schedule
)
if
self
.
parent
:
c
=
self
.
parent
.
privatization_insertion_point
c
.
put
(
" private(%(nsteps)s)"
%
fmt_dict
)
self
.
privatization_insertion_point
=
code
.
insertion_point
()
code
.
putln
(
""
)
code
.
putln
(
"#endif /* _OPENMP */"
)
...
...
@@ -6192,8 +6194,6 @@ class ParallelRangeNode(ParallelStatNode):
code
.
end_block
()
#------------------------------------------------------------------------------------
#
# Runtime support code
...
...
runtests.py
View file @
b48900fd
...
...
@@ -109,13 +109,18 @@ def get_openmp_compiler_flags(language):
else
:
cc
=
sysconfig
.
get_config_var
(
'CC'
)
# For some reason, cc can be e.g. 'gcc -pthread'
cc
=
cc
.
split
()[
0
]
matcher
=
re
.
compile
(
r"gcc version (\
d+
\.\
d+)
").search
try:
import subprocess
except ImportError:
try:
in_, out, err = os.popen(cc + "
-
v
")
except EnvironmentError, e:
except EnvironmentError:
# Be compatible with Python 3
_, e, _ = sys.exc_info()
warnings.warn("
Unable
to
find
the
%
s
compiler
:
%
s
:
%
s
" %
(language, os.strerror(e.errno), cc))
return None
...
...
@@ -126,6 +131,8 @@ def get_openmp_compiler_flags(language):
p = subprocess.Popen([cc, "
-
v
"], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
except EnvironmentError, e:
# Be compatible with Python 3
_, e, _ = sys.exc_info()
warnings.warn("
Unable
to
find
the
%
s
compiler
:
%
s
:
%
s
" %
(language, os.strerror(e.errno), cc))
return None
...
...
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