Struct rust_gpu_tools::opencl::Program [−][src]
pub struct Program { /* fields omitted */ }
Expand description
Abstraction that contains everything to run an OpenCL kernel on a GPU.
The majority of methods are the same as [crate::cuda::Program
], so you can write code using this
API, which will then work with OpenCL as well as CUDA kernels.
Implementations
Returns the name of the GPU, e.g. “GeForce RTX 3090”.
Creates a program for a specific device from OpenCL source code.
Creates a program for a specific device from a compiled OpenCL binary.
Creates a new buffer that can be used for input/output with the GPU.
The length
is the number of elements to create.
Returns a kernel.
The global_work_size
does not follow the OpenCL definition. It is not the total
number of threads. Instead it follows CUDA’s definition and is the number of
local_work_size
sized thread groups. So the total number of threads is
global_work_size * local_work_size
.
Puts data from an existing buffer onto the GPU.
The offset
is in number of T
sized elements, not in their byte size.
Reads data from the GPU into an existing buffer.
The offset
is in number of T
sized elements, not in their byte size.
Run some code in the context of the program
On CUDA it sets the correct contexts and synchronizes the stream before returning. On OpenCL it’s only executing the closure without any other side-effects.