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

Opaque handle to a CUDA device.

Implementations

Get the number of CUDA-capable devices.

Returns the number of devices with compute-capability 2.0 or greater which are available for execution.

Example
use cust::device::Device;
let num_devices = Device::num_devices()?;
println!("Number of devices: {}", num_devices);

Get a handle to the ordinal’th CUDA device.

Ordinal must be in the range 0..num_devices(). If not, an error will be returned.

Example
use cust::device::Device;
let device = Device::get_device(0)?;
println!("Device Name: {}", device.name()?);

Return an iterator over all CUDA devices.

Example
use cust::device::Device;
for device in Device::devices()? {
    let device = device?;
    println!("Device Name: {}", device.name()?);
}

Returns the total amount of memory available on the device in bytes.

Example
use cust::device::Device;
let device = Device::get_device(0)?;
println!("Device Memory: {}", device.total_memory()?);

Returns the name of this device.

Example
use cust::device::Device;
let device = Device::get_device(0)?;
println!("Device Name: {}", device.name()?);

Returns information about this device.

Example
use cust::device::{Device, DeviceAttribute};
let device = Device::get_device(0)?;
println!("Max Threads Per Block: {}",
    device.get_attribute(DeviceAttribute::MaxThreadsPerBlock).unwrap());

Returns a raw handle to this device, not handing over ownership, meaning that dropping this device will try to drop the underlying device.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

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.