Struct rust_gpu_tools::opencl::Kernel[][src]

pub struct Kernel<'a> {
    pub builder: ExecuteKernel<'a>,
    // some fields omitted
}
Expand description

A kernel that can be executed.

Fields

builder: ExecuteKernel<'a>

The underlying kernel builder.

Implementations

Set a kernel argument.

The arguments must live as long as the kernel. Hence make sure they are not dropped as long as the kernel is in use.

Example where this behaviour is enforced and leads to a compile-time error:

use rust_gpu_tools::opencl::Program;

fn would_break(program: &Program) {
   let data = vec![1, 2, 3, 4];
   let buffer = program.create_buffer_from_slice(&data).unwrap();
   let kernel = program.create_kernel("my_kernel", 4, 256).unwrap();
   let kernel = kernel.arg(&buffer);
   // This drop wouldn't error if the arguments wouldn't be bound to the kernels lifetime.
   drop(buffer);
   kernel.run().unwrap();
}

Actually run the kernel.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.