From fbf1ec12b7426ee51cad1892dc1135c7eecab592 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Tue, 17 Dec 2019 12:57:18 +0100
Subject: [PATCH] Assert non-empty assignments on kernelcreation

This yields better error messages
---
 pystencils/gpucuda/kernelcreation.py | 1 +
 pystencils/kernelcreation.py         | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/pystencils/gpucuda/kernelcreation.py b/pystencils/gpucuda/kernelcreation.py
index eecfe278e..d002cb0f0 100644
--- a/pystencils/gpucuda/kernelcreation.py
+++ b/pystencils/gpucuda/kernelcreation.py
@@ -16,6 +16,7 @@ def create_cuda_kernel(assignments,
                        ghost_layers=None,
                        skip_independence_check=False,
                        use_textures_for_interpolation=True):
+    assert assignments, "Assignments must not be empty!"
     fields_read, fields_written, assignments = add_types(assignments, type_info, not skip_independence_check)
     all_fields = fields_read.union(fields_written)
     read_only_fields = set([f.name for f in fields_read - fields_written])
diff --git a/pystencils/kernelcreation.py b/pystencils/kernelcreation.py
index 408cc506b..555196a62 100644
--- a/pystencils/kernelcreation.py
+++ b/pystencils/kernelcreation.py
@@ -1,5 +1,5 @@
-from types import MappingProxyType
 from itertools import combinations
+from types import MappingProxyType
 
 import sympy as sp
 
@@ -74,6 +74,7 @@ def create_kernel(assignments,
                [0., 0., 0., 0., 0.]])
     """
     # ----  Normalizing parameters
+    assert assignments, "Assignments must not be empty!"
     split_groups = ()
     if isinstance(assignments, AssignmentCollection):
         if 'split_groups' in assignments.simplification_hints:
-- 
GitLab