nabu.processing.kernel_base module

Base class for CudaKernel and OpenCLKernel Should not be used directly

class nabu.processing.kernel_base.KernelBase(kernel_name, filename=None, src=None, automation_params=None)[source]

Bases: object

A base class for OpenCL and Cuda kernels.

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

  • 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

  • parameters (Automation) –

  • ----------------------

  • values. (automation_params is a dictionary with the following keys and default) –

    guess_block: bool (True)

    If block is not specified during calls, choose a block size based on the size/dimensions of the first array. Mind that it is unlikely to be the optimal choice.

    guess_grid: bool (True):

    If the grid size is not specified during calls, choose a grid size based on the size of the first array.

    follow_device_ptr: bool (True)

    specify gpuarray.gpudata for all cuda GPUArrays (and pyopencl.array.data for pyopencl arrays). Otherwise, raise an error.

check_filename_src(filename, src)[source]
set_automation_params(automation_params)[source]
static guess_grid_size(shape, block_size)[source]
static 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]