Struct GpuStore

Source
pub struct GpuStore { /* private fields */ }

Implementations§

Source§

impl GpuStore

Source

pub fn get_default() -> &'static GpuInstance

Examples found in repository?
examples/assignment/main.rs (line 4)
3fn main() {
4    println!("Running in {:?}", GpuStore::get_default().info());
5    let mut ma = Tensor::from_data_and_shape(vec![1., 2., 3., 4., 5., 6., 7., 8.], vec![2, 2, 2]);
6    println!("{:?}", ma);
7    ma.assign(s!(1..2; ..; 1..2), 10.);
8    ma.assign(s!(0;0;0), -50.);
9    println!("{:?}", ma);
10    /*
11    Shape: [2, 2, 2]
12    [[[ -50  2 ]
13      [ 3  4 ]]
14
15     [[ 5  10 ]
16      [ 7  10 ]]]
17    */
18}
More examples
Hide additional examples
examples/simple_mm/main.rs (line 4)
3fn main() {
4    println!("Running in {:?}", GpuStore::get_default().info());
5    let ma = Tensor::from_data_and_shape(vec![1., 2., 3., 4., 5., 6., 7., 8.], vec![2, 2, 2]);
6    let mb = Tensor::from_data_and_shape(vec![2., 3., 4., 5.], vec![2, 2]);
7    let result = ma.matmul(&mb);
8    println!("{:?}", result);
9    /*
10    Running in AdapterInfo { name: "AMD Radeon Pro 560", vendor: 0, device: 0, device_type: DiscreteGpu, backend: Metal }
11    Shape: [2, 2, 2]
12    [[[ 10  13 ]
13      [ 22  29 ]]
14
15     [[ 34  45 ]
16      [ 46  61 ]]]
17    */
18}
Source

pub fn get(gpu_info: &AdapterInfo) -> &'static GpuInstance

Source

pub async fn select_gpu(gpu_info: &AdapterInfo)

Source

pub fn list_gpus() -> Vec<&'static AdapterInfo>

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V