Skip to content

nabu.processing.kernel_base

source module nabu.processing.kernel_base

Base class for CudaKernel and OpenCLKernel Should not be used directly

Classes

  • KernelBase A base class for OpenCL and Cuda kernels.

source class KernelBase(kernel_name, filename=None, src=None, automation_params=None, silent_compilation_warnings=False)

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

Automation parameters

automation_params is a dictionary with the following keys and default values. 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.

Methods

source method KernelBase.check_filename_src(filename, src)

Raises

  • ValueError

source method KernelBase.set_automation_params(automation_params)

source staticmethod KernelBase.guess_grid_size(shape, block_size)

source staticmethod KernelBase.guess_block_size(shape)

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

source method KernelBase.get_block_grid(*args, **kwargs)

Raises

  • ValueError

source method KernelBase.follow_device_arr(args)

Raises

  • ValueError