ucb-sejits / stencil_code

Stencil Specializer using ctree
http://stencil-code.readthedocs.org/en/latest/
4 stars 2 forks source link

Stencils should detect errors in __call__ arguments #2

Open chick opened 10 years ago

chick commented 10 years ago

It is easy to get confused about the parameters to use when calling an instance of a stencil. The kernel method's signature most likely does not match the actual call signature. This often because the kernel includes the output as an argument and call does not. There can be other reasons, but regardless of cause the error messages are difficult to understand

File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
File "/Users/chick/Aspire/PyCharmProjects/ucb-ctree/ctree/c/codegen.py", line 97, in visit_SymbolRef
    s += "%s " % codegen_type(node.type)
File "/Users/chick/Aspire/PyCharmProjects/ucb-ctree/ctree/types.py", line 88, in codegen_type
    "Expected a ctypes type instance, not %s, (%s):" % (ctype, type(ctype))
leonardt commented 10 years ago

Can you produce the relevant code snippet that generates this error?

chick commented 10 years ago

I can, it may specific to this particular stencil though, I wasn't trying to fault the error but more to support some sort of up_front_checking of arguments (although that might be an unacceptable performance hit since it would sit in front of the specialized kernel call