nabu.cuda.kernel module

class nabu.cuda.kernel.CudaKernel(kernel_name, filename=None, src=None, signature=None, texrefs=[], automation_params=None, **sourcemodule_kwargs)[source]

Bases: KernelBase

Helper class that wraps CUDA kernel through pycuda SourceModule.

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

  • signature (str, optional) – Signature of kernel function. If provided, pycuda will not guess the types of kernel arguments, making the calls slightly faster. For example, a function acting on two pointers, an integer and a float32 has the signature “PPif”.

  • texrefs (list, optional) – List of texture references, if any

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

  • sourcemodule_kwargs (optional) – Extra arguments to provide to pycuda.compiler.SourceModule(),

compile_kernel_source(kernel_name, sourcemodule_kwargs)[source]
prepare(kernel_signature, texrefs)[source]
follow_device_arr(args)[source]
get_last_kernel_time()[source]

Return the execution time (in seconds) of the last called kernel. The last called kernel should have been called with time_kernel=True.

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