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

Better error reporting in create_some_context.

parent c31944d1
No related branches found
No related tags found
No related merge requests found
...@@ -745,7 +745,7 @@ def create_some_context(interactive=True, answers=None): ...@@ -745,7 +745,7 @@ def create_some_context(interactive=True, answers=None):
for i, dev in enumerate(devices): for i, dev in enumerate(devices):
if choice in dev.name.lower(): if choice in dev.name.lower():
return dev return dev
raise RuntimeError("input did not match any platform") raise RuntimeError("input did not match any device")
if not devices: if not devices:
raise Error("no devices found") raise Error("no devices found")
...@@ -768,6 +768,11 @@ def create_some_context(interactive=True, answers=None): ...@@ -768,6 +768,11 @@ def create_some_context(interactive=True, answers=None):
user_inputs = pre_provided_answers + user_inputs user_inputs = pre_provided_answers + user_inputs
print("Set the environment variable PYOPENCL_CTX='%s' to " print("Set the environment variable PYOPENCL_CTX='%s' to "
"avoid being asked again." % ":".join(user_inputs)) "avoid being asked again." % ":".join(user_inputs))
if answers:
raise RuntimeError("not all provided choices were used by "
"create_some_context. (left over: '%s')" % ":".join(answers))
return Context(devices) return Context(devices)
_csc = create_some_context _csc = create_some_context
......
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