def _build_program(self):
code = "\n".join(itertools.chain(self.common_header.pieces,
itertools.chain.from_iterable(cu.pieces for cu in self._compile_units)))
program = pyopencl.Program(self.context, code)
with warnings.catch_warnings():
# Intel OpenCL generates non empty output and that causes warnings
# from pyopencl. We just silence them.
warnings.simplefilter("ignore")
return program.build(options=DEFAULT_COMPILER_OPTIONS)
# Working around bug in pyopencl.Program.compile in pyopencl
# (https://lists.tiker.net/pipermail/pyopencl/2015-September/001986.html)
# TODO: Fix this in OpenCL
# compiled_units = [unit.compile(self.context, self.common_header.pieces)
# for unit in self._compile_units]
# return pyopencl.link_program(self.context, compiled_units)
评论列表
文章目录