[][src]Struct rustacuda::device::Device

pub struct Device { /* fields omitted */ }

Opaque handle to a CUDA device.

Implementations

impl Device[src]

pub fn num_devices() -> CudaResult<u32>[src]

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 rustacuda::device::Device;
let num_devices = Device::num_devices()?;
println!("Number of devices: {}", num_devices);

pub fn get_device(ordinal: u32) -> CudaResult<Device>[src]

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 rustacuda::device::Device;
let device = Device::get_device(0)?;
println!("Device Name: {}", device.name()?);

pub fn devices() -> CudaResult<Devices>[src]

Return an iterator over all CUDA devices.

Example

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

pub fn total_memory(self) -> CudaResult<usize>[src]

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

Example

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

pub fn name(self) -> CudaResult<String>[src]

Returns the name of this device.

Example

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

pub fn get_attribute(self, attr: DeviceAttribute) -> CudaResult<i32>[src]

Returns information about this device.

Example

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

Trait Implementations

impl Clone for Device[src]

impl Copy for Device[src]

impl Debug for Device[src]

impl Eq for Device[src]

impl Hash for Device[src]

impl PartialEq<Device> for Device[src]

impl StructuralEq for Device[src]

impl StructuralPartialEq for Device[src]

Auto Trait Implementations

impl RefUnwindSafe for Device

impl Send for Device

impl Sync for Device

impl Unpin for Device

impl UnwindSafe for Device

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.