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
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
...
@@ -11,6 +11,7 @@ Cython/Runtime/refnanny.c
BUILD/
BUILD/
build/
build/
dist/
dist/
.git/
.gitrev
.gitrev
.coverage
.coverage
*.orig
*.orig
...
...
Cython/Compiler/Nodes.py
View file @
b48900fd
...
@@ -5754,6 +5754,9 @@ class ParallelStatNode(StatNode, ParallelNode):
...
@@ -5754,6 +5754,9 @@ class ParallelStatNode(StatNode, ParallelNode):
#pragma omp for
#pragma omp for
We need this to determine the sharing attributes.
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'
]
child_attrs
=
[
'body'
]
...
@@ -5936,6 +5939,8 @@ class ParallelWithBlockNode(ParallelStatNode):
...
@@ -5936,6 +5939,8 @@ class ParallelWithBlockNode(ParallelStatNode):
code
.
put
(
code
.
put
(
'private(%s)'
%
', '
.
join
([
e
.
cname
for
e
in
self
.
privates
]))
'private(%s)'
%
', '
.
join
([
e
.
cname
for
e
in
self
.
privates
]))
self
.
privatization_insertion_point
=
code
.
insertion_point
()
code
.
putln
(
""
)
code
.
putln
(
""
)
code
.
putln
(
"#endif /* _OPENMP */"
)
code
.
putln
(
"#endif /* _OPENMP */"
)
...
@@ -6138,13 +6143,7 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -6138,13 +6143,7 @@ class ParallelRangeNode(ParallelStatNode):
# 'with gil' block. For now, just abort
# 'with gil' block. For now, just abort
code
.
putln
(
"if (%(step)s == 0) abort();"
%
fmt_dict
)
code
.
putln
(
"if (%(step)s == 0) abort();"
%
fmt_dict
)
# Guard for never-ending loops: prange(0, 10, -1) or prange(10, 0, 1)
# Note: nsteps is private in an outer scope if present
# 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"
)
code
.
putln
(
"%(nsteps)s = (%(stop)s - %(start)s) / %(step)s;"
%
fmt_dict
)
code
.
putln
(
"%(nsteps)s = (%(stop)s - %(start)s) / %(step)s;"
%
fmt_dict
)
self
.
generate_loop
(
code
,
fmt_dict
)
self
.
generate_loop
(
code
,
fmt_dict
)
...
@@ -6161,9 +6160,6 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -6161,9 +6160,6 @@ class ParallelRangeNode(ParallelStatNode):
self
.
release_closure_privates
(
code
)
self
.
release_closure_privates
(
code
)
# end the 'if' block that guards against infinite loops
code
.
end_block
()
def
generate_loop
(
self
,
code
,
fmt_dict
):
def
generate_loop
(
self
,
code
,
fmt_dict
):
code
.
putln
(
"#ifdef _OPENMP"
)
code
.
putln
(
"#ifdef _OPENMP"
)
...
@@ -6182,6 +6178,12 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -6182,6 +6178,12 @@ class ParallelRangeNode(ParallelStatNode):
if
self
.
schedule
:
if
self
.
schedule
:
code
.
put
(
" schedule(%s)"
%
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
(
""
)
code
.
putln
(
"#endif /* _OPENMP */"
)
code
.
putln
(
"#endif /* _OPENMP */"
)
...
@@ -6192,8 +6194,6 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -6192,8 +6194,6 @@ class ParallelRangeNode(ParallelStatNode):
code
.
end_block
()
code
.
end_block
()
#------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------
#
#
# Runtime support code
# Runtime support code
...
...
runtests.py
View file @
b48900fd
...
@@ -109,13 +109,18 @@ def get_openmp_compiler_flags(language):
...
@@ -109,13 +109,18 @@ def get_openmp_compiler_flags(language):
else
:
else
:
cc
=
sysconfig
.
get_config_var
(
'CC'
)
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
matcher
=
re
.
compile
(
r"gcc version (\
d+
\.\
d+)
").search
try:
try:
import subprocess
import subprocess
except ImportError:
except ImportError:
try:
try:
in_, out, err = os.popen(cc + "
-
v
")
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
" %
warnings.warn("
Unable
to
find
the
%
s
compiler
:
%
s
:
%
s
" %
(language, os.strerror(e.errno), cc))
(language, os.strerror(e.errno), cc))
return None
return None
...
@@ -126,6 +131,8 @@ def get_openmp_compiler_flags(language):
...
@@ -126,6 +131,8 @@ def get_openmp_compiler_flags(language):
p = subprocess.Popen([cc, "
-
v
"], stdout=subprocess.PIPE,
p = subprocess.Popen([cc, "
-
v
"], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT)
except EnvironmentError, e:
except EnvironmentError, e:
# Be compatible with Python 3
_, e, _ = sys.exc_info()
warnings.warn("
Unable
to
find
the
%
s
compiler
:
%
s
:
%
s
" %
warnings.warn("
Unable
to
find
the
%
s
compiler
:
%
s
:
%
s
" %
(language, os.strerror(e.errno), cc))
(language, os.strerror(e.errno), cc))
return None
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