Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support OpenMP in array expressions

  • Loading branch information...
commit d22b3c4998be3bd75009a1a34f52c1538bf9692f 1 parent e19b8a7
@markflorisson authored
View
15 Cython/Compiler/Vector.py
@@ -55,8 +55,9 @@ def map_type(self, type, wrap=False):
class CythonSpecializerMixin(object):
is_partial_mapping = False
- def visit_FunctionNode(self, node):
+ has_error_handler = False
+ def visit_FunctionNode(self, node):
def qualify(type):
type = type.qualify("const", "CYTHON_RESTRICT")
type.base_type = type.base_type.qualify("const")
@@ -82,6 +83,18 @@ def visit_NodeWrapper(self, node):
op.variable = self.visit(op.variable)
return node
+ def visit_ErrorHandler(self, node):
+ self.has_error_handler = True
+ return super(CythonSpecializerMixin, self).visit_ErrorHandler(node)
+
+ def visit_OpenMPLoopNode(self, node):
+ self.visitchildren(node)
+ if self.has_error_handler:
+ # In case of any potential gotos, don't use OpenMP loops
+ return node.for_node
+ return node
+
+
def create_hybrid_code(codegen, old_minicode):
minicode = codegen.context.codewriter_cls(codegen.context)
minicode.indent = old_minicode.indent
2  Cython/minivect
@@ -1 +1 @@
-Subproject commit 1725a80167dd4382c8ec22b4b95a370c0996e7db
+Subproject commit 206ba394cee015539c59e8febab5a445f2a5b96f
View
1  tests/array_expressions/broadcasting.pyx
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
View
1  tests/array_expressions/elementwise.pyx
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
View
1  tests/array_expressions/new_memory.pyx
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
View
1  tests/array_expressions/specializations.pyx
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
Please sign in to comment.
Something went wrong with that request. Please try again.