pub struct Program { /* private fields */ }
Expand description

Abstraction that contains everything to run a CUDA kernel on a GPU.

The majority of methods are the same as crate::opencl::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 a compiled CUDA binary file.

Creates a program for a specific device from a compiled CUDA binary.

Creates a new buffer that can be used for input/output with the GPU.

The length is the number of elements to create.

It is usually used to create buffers that are initialized by the GPU. If you want to directly transfer data from the host to the GPU, you would use the safe Program::create_buffer_from_slice instead.

Safety

The buffer needs to be initalized (by the host with Program::write_from_buffer) or by the GPU) before it can be read via Program::read_into_buffer.

Creates a new buffer on the GPU and initializes with the given slice.

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.

Reads data from the GPU into an existing buffer.

Run some code in the context of the program.

It sets the correct contexts.

It takes the program as a parameter, so that we can use the same function body, for both the OpenCL and the CUDA code path. The only difference is the type of the program.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.