Permalink
Browse files

Support OpenMP in array expressions

  • Loading branch information...
1 parent e19b8a7 commit d22b3c4998be3bd75009a1a34f52c1538bf9692f @markflorisson committed Jul 1, 2012
View
@@ -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
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"
@@ -1,4 +1,5 @@
# tag: numpy
+# tag: openmp
# mode: run
include "utils.pxi"

0 comments on commit d22b3c4

Please sign in to comment.