nabu.opencl.kernel module

class nabu.opencl.kernel.OpenCLKernel(kernel_name, ctx, queue=None, filename=None, src=None, automation_params=None, **build_kwargs)[source]

Bases: KernelBase

Helper class that wraps OpenCL kernel through pyopencl.

Parameters:
  • kernel_name (str) – Name of the OpenCL kernel.

  • ctx (pyopencl.Context) – OpenCL context to use.

  • queue (pyopencl.CommandQueue) – OpenCL queue to use. If provided, will use this queue’s context instead of ‘ctx’

  • filename (str, optional) – Path to the file name containing kernels definitions

  • src (str, optional) – Source code of kernels definitions

  • automation_params (dict, optional) – Automation parameters, see below

  • build_kwargs (optional) – Extra arguments to provide to pyopencl.Program.build(),

compile_kernel_source(kernel_name, build_kwargs)[source]
get_kernel()[source]
guess_block_size(shape)[source]

Guess a block size based on the shape of an array.

get_block_grid(*args, **kwargs)[source]
follow_device_arr(args)[source]
call(*args, **kwargs)[source]