Skip to content
Snippets Groups Projects
Commit 885bfc42 authored by Alex Rothberg's avatar Alex Rothberg
Browse files

Allow passing build options with IPython Magic

parent d3f31844
No related branches found
No related tags found
No related merge requests found
......@@ -174,8 +174,8 @@ class Program(object):
# {{{ build
def build(self, options=[], devices=None, cache_dir=None):
if isinstance(options, str):
options = [options]
if isinstance(options, basestring):
options = [str(options)]
options = (options
+ _DEFAULT_BUILD_OPTIONS
......
......@@ -23,11 +23,14 @@ class PyOpenCLMagics(Magics):
except KeyError:
ctx = None
if not isinstance(ctx, cl.Context):
ctx = None
if ctx is None:
raise RuntimeError("unable to locate cl context, which must be "
"present in namespace as 'cl_ctx' or 'ctx'")
prg = cl.Program(ctx, cell.encode("utf8")).build()
prg = cl.Program(ctx, cell.encode("utf8")).build(options=line)
for knl in prg.all_kernels():
self.shell.user_ns[knl.function_name] = knl
......
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