Skip to content
Snippets Groups Projects
Commit 97ceed45 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

CompiledKernel: Provide error in case of unneeded keyword arguments.

parent b481ad2a
No related branches found
No related tags found
No related merge requests found
......@@ -146,10 +146,12 @@ class CompiledKernel:
outputs = []
encountered_non_numpy = False
kwargs_copy = kwargs.copy()
for arg in self.kernel.args:
is_written = arg.name in self.kernel.get_written_variables()
val = kwargs.get(arg.name)
val = kwargs_copy.pop(arg.name, None)
if val is None:
if not is_written:
raise TypeError("must supply input argument '%s'" % arg.name)
......@@ -181,6 +183,9 @@ class CompiledKernel:
else:
args.append(val)
assert not kwargs_copy, (
"extra arguments: "+", ".join(kwargs_copy.iterkeys()))
evt = self.cl_kernel(queue,
self.global_size_func(**domain_parameters),
self.local_size_func(**domain_parameters),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment