diff --git a/devito/passes/iet/parpragma.py b/devito/passes/iet/parpragma.py index 9eb6da047f1..9639b27ffa0 100644 --- a/devito/passes/iet/parpragma.py +++ b/devito/passes/iet/parpragma.py @@ -614,7 +614,7 @@ def _make_partree(self, candidates, nthreads=None, index=None): if self._is_offloadable(root): body = self.DeviceIteration(gpu_fit=self.gpu_fit, ncollapsed=len(collapsable) + 1, - tile=self.par_tile, + tile=self.par_tile.next(), **root.args) partree = ParallelTree([], body, nthreads=nthreads) diff --git a/devito/tools/data_structures.py b/devito/tools/data_structures.py index 13c3e68d9b9..95f9f65d0e9 100644 --- a/devito/tools/data_structures.py +++ b/devito/tools/data_structures.py @@ -626,6 +626,8 @@ def __init__(self, items): self.current = 0 def next(self): + if self.last == 0: + return None item = self.items[self.current] self.current = min(self.last - 1, self.current+1) return item