Using the OpenMP directive transformations automatically changes the provided integer value of collapse if do loops are not directly nested but are prefixed or encapsulated with a Directive.
However, if there are other Directives in one of the nested loops, this raises GenerationError:
# If there is a collapse clause, there must be as many immediately
# nested loops as the collapse value
if self._collapse:
cursor = self.dir_body.children[0]
for depth in range(self._collapse):
if not isinstance(cursor, Loop):
raise GenerationError(
f"OMPLoopDirective must have as many immediately "
f"nested loops as the collapse clause specifies but "
f"'{self}' has a collapse={self._collapse} and the "
f"nested statement at depth {depth} is a "
f"{type(cursor).__name__} rather than a Loop.")
cursor = cursor.loop_body.children[0]
Using the OpenMP directive transformations automatically changes the provided integer value of
collapseif do loops are not directly nested but are prefixed or encapsulated with a Directive.However, if there are other Directives in one of the nested loops, this raises
GenerationError: