Struct coaster::frameworks::cuda::Driver

source ·
pub struct Driver;
Expand description

Defines the Cuda API.

Implementations§

source§

impl API

source

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.

source

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.

source

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

source

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.

source

pub fn load_device_list() -> Result<Vec<Device>, Error>

Returns a list of available devices for the provided platform.

source

pub fn load_device_info( device: &Device, info: CUdevice_attribute ) -> Result<DeviceInfo, Error>

Returns the requested DeviceInfo for the provided device.

source§

impl API

source

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.

source

pub fn mem_free(memory: c_ulonglong) -> Result<(), Error>

Releases allocated memory from the Cuda device.

source

pub fn mem_cpy_h_to_d( host_mem: &FlatBox, device_mem: &mut Memory ) -> Result<(), Error>

Copies memory from the Host to the Cuda device.

source

pub fn mem_cpy_d_to_h( device_mem: &Memory, host_mem: &mut FlatBox ) -> Result<(), Error>

Copies memory from the Cuda device to the Host.

source§

impl API

source

pub fn init() -> Result<(), Error>

Initialize the Cuda Driver API.

must be called before any other function from the driver API.

Trait Implementations§

source§

impl Clone for API

source§

fn clone(&self) -> API

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for API

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for API

Auto Trait Implementations§

§

impl RefUnwindSafe for API

§

impl Send for API

§

impl Sync for API

§

impl Unpin for API

§

impl UnwindSafe for API

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.