From 2e688adacd7491082c607524088c65d7e7253561 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 16 Jun 2015 16:40:31 -0500 Subject: [PATCH] Diagnostic message shuffling to support doctests --- loopy/__init__.py | 4 +++- loopy/diagnostic.py | 4 ++-- loopy/target/pyopencl/__init__.py | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/loopy/__init__.py b/loopy/__init__.py index f2b04d49f..dcd8e27c1 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -32,7 +32,7 @@ from islpy import dim_type from loopy.symbolic import (RuleAwareIdentityMapper, RuleAwareSubstitutionMapper, SubstitutionRuleMappingContext, TaggedVariable, Reduction, LinearSubscript, ) -from loopy.diagnostic import LoopyError +from loopy.diagnostic import LoopyError, LoopyWarning # {{{ imported user interface @@ -111,6 +111,8 @@ __all__ = [ "make_kernel", "c_preprocess", "parse_transformed_fortran", "parse_fortran", + "LoopyError", "LoopyWarning", + # {{{ from this file "split_iname", "join_inames", "tag_inames", "duplicate_inames", diff --git a/loopy/diagnostic.py b/loopy/diagnostic.py index 56d7f6706..93cbd125d 100644 --- a/loopy/diagnostic.py +++ b/loopy/diagnostic.py @@ -37,11 +37,11 @@ class LoopyAdvisory(LoopyWarningBase): pass -class ParameterFinderWarning(LoopyWarningBase): +class ParameterFinderWarning(LoopyWarning): pass -class WriteRaceConditionWarning(LoopyWarningBase): +class WriteRaceConditionWarning(LoopyWarning): pass # }}} diff --git a/loopy/target/pyopencl/__init__.py b/loopy/target/pyopencl/__init__.py index a0a119dce..174506cd6 100644 --- a/loopy/target/pyopencl/__init__.py +++ b/loopy/target/pyopencl/__init__.py @@ -125,16 +125,16 @@ def adjust_local_temp_var_storage(kernel, device): def check_sizes(kernel, device): import loopy as lp + from loopy.diagnostic import LoopyAdvisory, LoopyError + if device is None: from loopy.diagnostic import warn warn(kernel, "no_device_in_pre_codegen_checks", "No device parameter was passed to the PyOpenCLTarget. " "Perhaps you want to pass a device to benefit from " - "additional checking.") + "additional checking.", LoopyAdvisory) return - from loopy.diagnostic import LoopyAdvisory, LoopyError - parameters = {} for arg in kernel.args: if isinstance(arg, lp.ValueArg) and arg.approximately is not None: -- GitLab