From cd8a9329b2fb99432fe1b3e69c2af16f4dfc51fb Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Mon, 18 Feb 2019 14:27:46 +0100
Subject: [PATCH] Fixes in GPU kernel generation for walberla

---
 gpucuda/kernelcreation.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gpucuda/kernelcreation.py b/gpucuda/kernelcreation.py
index 0e5d2939b..2bc0327d6 100644
--- a/gpucuda/kernelcreation.py
+++ b/gpucuda/kernelcreation.py
@@ -36,6 +36,7 @@ def create_cuda_kernel(assignments, function_name="kernel", type_info=None, inde
         if isinstance(ghost_layers, int):
             for i in range(len(common_shape)):
                 iteration_slice.append(slice(ghost_layers, -ghost_layers if ghost_layers > 0 else None))
+            ghost_layers = [(ghost_layers, ghost_layers)] * len(common_shape)
         else:
             for i in range(len(common_shape)):
                 iteration_slice.append(slice(ghost_layers[i][0],
@@ -50,9 +51,10 @@ def create_cuda_kernel(assignments, function_name="kernel", type_info=None, inde
     assignments = cell_idx_assignments + assignments
 
     block = Block(assignments)
-    unify_shape_symbols(block, common_shape=common_shape, fields=fields_without_buffers)
 
     block = indexing.guard(block, common_shape)
+    unify_shape_symbols(block, common_shape=common_shape, fields=fields_without_buffers)
+
     ast = KernelFunction(block, function_name=function_name, ghost_layers=ghost_layers, backend='gpucuda')
     ast.global_variables.update(indexing.index_variables)
 
-- 
GitLab