GpuBuilder

Struct GpuBuilder 

Source
pub struct GpuBuilder { /* private fields */ }
Expand description

Builder for acquiring a fabric GPU lease.

Allows specifying minimum VRAM requirements.

§Examples

use grafos_std::gpu::GpuBuilder;

let lease = GpuBuilder::new().min_vram(1024).acquire()?;
// lease.gpu() is available for submit() calls

Implementations§

Source§

impl GpuBuilder

Source

pub fn new() -> Self

Create a new builder with no VRAM constraint and no exclusivity preference (daemon default applies).

Source

pub fn min_vram(self, n: u64) -> Self

Set the minimum VRAM required in bytes.

Source

pub fn exclusivity(self, class: GpuExclusivityClass) -> Self

Request a specific GPU exclusivity class for this lease.

When set, the daemon emits TLV_LEASE_GPU_EXCLUSIVITY (0x0903) on the LEASE_ALLOC request. When omitted, the daemon’s --gpu-share-mode default applies.

§Examples
use grafos_std::gpu::{GpuBuilder, GpuExclusivityClass};

let lease = GpuBuilder::new()
    .min_vram(1024)
    .exclusivity(GpuExclusivityClass::DeviceExclusive)
    .acquire()?;
Source

pub fn affinity(self, a: Affinity) -> Self

Add an affinity constraint (toward the target).

Source

pub fn anti_affinity(self, strength: Strength, target: Target) -> Self

Add an anti-affinity constraint (away from the target).

Source

pub fn lease_secs(self, secs: u32) -> Self

Set the lease TTL in seconds.

Source

pub fn acquire(self) -> Result<GpuLease>

Acquire a GPU lease.

On wasm32, allocates via the gpu_lease_alloc host import. On native, uses the local mock lease allocator.

§Errors

Returns crate::error::FabricError::CapacityExceeded or crate::error::FabricError::Disconnected if the host cannot satisfy the request.

Trait Implementations§

Source§

impl Default for GpuBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.