From 020203ae854b259e898e53d51739db06e1c8b89f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 26 Oct 2011 01:42:56 -0400 Subject: [PATCH] Give a good error message for missing variables in get_problems(). --- MEMO | 9 ++++++--- loopy/__init__.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/MEMO b/MEMO index 9c5270914..a281b9808 100644 --- a/MEMO +++ b/MEMO @@ -37,14 +37,14 @@ Things to consider To-do ^^^^^ +- Just touching a variable written to by a non-idempotent + instruction makes that instruction also not idempotent + - assert dependencies <= parent_inames in loopy/__init__.py ??? - user interface for dim length prescription -- Give a good error message if a parameter assignment in get_problems() - is missing. - - Deal with equality constraints. (These arise, e.g., when partitioning a loop of length 16 into 16s.) @@ -83,6 +83,9 @@ Future ideas Dealt with ^^^^^^^^^^ +- Give a good error message if a parameter assignment in get_problems() + is missing. + - Slab decomposition for ILP -> I don't think that's possible. diff --git a/loopy/__init__.py b/loopy/__init__.py index 67af82443..46f6a7655 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -411,8 +411,15 @@ def get_problems(kernel, parameters): glens, llens = kernel.get_grid_sizes_as_exprs() from pymbolic import evaluate - glens = evaluate(glens, parameters) - llens = evaluate(llens, parameters) + from pymbolic.mapper.evaluator import UnknownVariableError + try: + glens = evaluate(glens, parameters) + llens = evaluate(llens, parameters) + except UnknownVariableError, name: + raise RuntimeError("When checking your kernel for problems, " + "a value for parameter '%s' was not available. Pass " + "it in the 'parameters' kwarg to check_kernels()." + % name) if (max(len(glens), len(llens)) > kernel.device.max_work_item_dimensions): -- GitLab