Struct coaster::frameworks::cuda::Driver
source · pub struct Driver;
Expand description
Defines the Cuda API.
Implementations§
source§impl API
impl API
sourcepub fn create_context(device: Device) -> Result<*mut Struct_CUctx_st, Error>
pub fn create_context(device: Device) -> Result<*mut Struct_CUctx_st, Error>
Creates a Cuda context.
An Cuda context can only be created with one device. Contexts are used by the Cuda runtime for managing objects such as command-queues, memory, program and kernel objects and for executing kernels on one or more devices specified in the context. An Cuda context is a synonym to a Coaster device.
sourcepub fn destroy_context(context: *mut Struct_CUctx_st) -> Result<(), Error>
pub fn destroy_context(context: *mut Struct_CUctx_st) -> Result<(), Error>
Removes a created Cuda context from the device.
Should be called when freeing a Cuda::Context to not trash up the Cuda device.
sourcepub fn synchronize_context() -> Result<(), Error>
pub fn synchronize_context() -> Result<(), Error>
Synchronize the CUDA context associated with the current CPU thread.
Should be called when you want to make sure that previous asynchronous operations have been executed.
source§impl API
impl API
sourcepub fn load_devices() -> Result<Vec<Device>, Error>
pub fn load_devices() -> Result<Vec<Device>, Error>
Returns fully initialized devices available through Cuda.
Combines the fetching of all device ids and the fetching of the individual device information.
sourcepub fn load_device_list() -> Result<Vec<Device>, Error>
pub fn load_device_list() -> Result<Vec<Device>, Error>
Returns a list of available devices for the provided platform.
sourcepub fn load_device_info(
device: &Device,
info: CUdevice_attribute
) -> Result<DeviceInfo, Error>
pub fn load_device_info( device: &Device, info: CUdevice_attribute ) -> Result<DeviceInfo, Error>
Returns the requested DeviceInfo for the provided device.
source§impl API
impl API
sourcepub fn mem_alloc(bytesize: size_t) -> Result<Memory, Error>
pub fn mem_alloc(bytesize: size_t) -> Result<Memory, Error>
Allocates memory on the Cuda device.
Allocates bytesize bytes of linear memory on the device. The allocated memory is suitably aligned for any kind of variable. The memory is not cleared. Returns a memory id for the created buffer, which can now be writen to.
sourcepub fn mem_free(memory: c_ulonglong) -> Result<(), Error>
pub fn mem_free(memory: c_ulonglong) -> Result<(), Error>
Releases allocated memory from the Cuda device.