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() callsImplementations§
Source§impl GpuBuilder
impl GpuBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder with no VRAM constraint and no exclusivity preference (daemon default applies).
Sourcepub fn exclusivity(self, class: GpuExclusivityClass) -> Self
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()?;Sourcepub fn anti_affinity(self, strength: Strength, target: Target) -> Self
pub fn anti_affinity(self, strength: Strength, target: Target) -> Self
Add an anti-affinity constraint (away from the target).
Sourcepub fn lease_secs(self, secs: u32) -> Self
pub fn lease_secs(self, secs: u32) -> Self
Set the lease TTL in seconds.
Sourcepub fn acquire(self) -> Result<GpuLease>
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§
Auto Trait Implementations§
impl Freeze for GpuBuilder
impl RefUnwindSafe for GpuBuilder
impl Send for GpuBuilder
impl Sync for GpuBuilder
impl Unpin for GpuBuilder
impl UnwindSafe for GpuBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more