pub struct GpuBackendCore { /* private fields */ }Expand description
One process-owned GPU backend core.
Every value of this type is a public handle. Clones mint a new
PublicHandleLease, and dropping the last lease signals close the same
way Self::close does. Dropping all handles therefore never leaks the device
owner, but neither does it wait for cleanup; callers that need to know when
the devices are reusable call one of the close_and_wait* methods first.
Implementations§
Source§impl GpuBackendCore
impl GpuBackendCore
Sourcepub fn new(config: ValidatedGpuBackendConfig) -> Result<Self>
pub fn new(config: ValidatedGpuBackendConfig) -> Result<Self>
Claims the process owner of the configured devices, installs their GPU resources, and publishes the backend.
Only one backend may be live per process; a second call while one is
live, or while a closed one is still draining, fails with the
backend_already_live reason. Construction blocks the calling thread
for the CUDA context, memory manager, and stream pool installation of
every device. On failure the close coordinator takes over every
installed resource, and the error carries rollback_cleanup facts that
say whether that cleanup reached quiescence within its bounded slice or
was transferred to the coordinator’s thread. In the latter case the
owner lease is released asynchronously, so a retry may briefly observe
backend_already_live.
Source§impl GpuBackendCore
impl GpuBackendCore
Sourcepub fn session_capability(&self) -> GpuBackendSession
pub fn session_capability(&self) -> GpuBackendSession
Mints the capability that session and optimizer state hold.
A session is not a public handle: it holds the resource core weakly, so any number of live sessions neither delay the last-handle close signal nor keep the resource generation reachable after close has taken it. The observation core is held strongly because attempt reports and metrics must stay readable after the GPU resources are gone.
pub fn device_startup_records(&self) -> &[GpuBackendDeviceStartupRecord]
Sourcepub fn kvikio_process_config(&self) -> Option<KvikioProcessConfig>
pub fn kvikio_process_config(&self) -> Option<KvikioProcessConfig>
KvikIO’s process settings as applied when this backend was built, or
None for a cuDF build without KvikIO support.
pub fn identity(&self) -> GpuBackendCoreIdentity
Sourcepub fn begin_attempt(
&self,
request: BeginAttemptRequest,
) -> Result<AttemptBegin>
pub fn begin_attempt( &self, request: BeginAttemptRequest, ) -> Result<AttemptBegin>
Sourcepub fn backend_metrics_snapshot(&self) -> BackendMetricsSnapshot
pub fn backend_metrics_snapshot(&self) -> BackendMetricsSnapshot
Returns one coherent pull snapshot for this backend resource generation.
The snapshot has a monotonic store generation so a consumer can detect whether it combined observations from different points in time.
Sourcepub fn close(&self) -> bool
pub fn close(&self) -> bool
Signals close without waiting. Returns true only for the caller that
won the lifecycle gate; later calls, and a last-handle drop after an
explicit close, return false and change nothing.
From the winning call on, every new admission, service read, and
attempt begin fails with the backend_closing reason, while work that
already holds a permit runs to completion. Cleanup proceeds on the
coordinator’s thread.
Sourcepub fn close_snapshot(&self) -> GpuBackendCloseSnapshot
pub fn close_snapshot(&self) -> GpuBackendCloseSnapshot
Point-in-time close progress. Readable at any time, including before close and from inside observation delivery.
Sourcepub fn close_and_wait(
&self,
timeout: Duration,
) -> Result<GpuBackendCloseSnapshot>
pub fn close_and_wait( &self, timeout: Duration, ) -> Result<GpuBackendCloseSnapshot>
Signals close and blocks the calling thread until both quiescence
scopes are reached or timeout elapses.
A timeout returns ServiceOverloaded with reason backend_close_timeout
and the quiescence facts at that moment; cleanup continues on the
coordinator’s thread and a later call can observe its completion. A
cleanup failure returns Internal with reason cleanup_failed_closed;
the owner lease is then retained, and the devices cannot be claimed
again in this process. Calling from a runtime observation observer is
rejected with reentrant_observation_close before close is signalled,
because that observer is itself observation work the wait would need to
finish.
Sourcepub fn close_and_wait_until(
&self,
deadline: Instant,
) -> Result<GpuBackendCloseSnapshot>
pub fn close_and_wait_until( &self, deadline: Instant, ) -> Result<GpuBackendCloseSnapshot>
Self::close_and_wait against an absolute deadline. Lock contention
inside the wait consumes this same deadline.
Sourcepub async fn close_and_wait_async(
&self,
timeout: Duration,
) -> Result<GpuBackendCloseSnapshot>
pub async fn close_and_wait_async( &self, timeout: Duration, ) -> Result<GpuBackendCloseSnapshot>
Self::close_and_wait for callers on a Tokio runtime. The wait parks
a thread, so it runs on the host runtime’s blocking pool; the reentrancy
check runs first, on the caller’s task, so a rejected call never spawns.
Trait Implementations§
Source§impl Clone for GpuBackendCore
impl Clone for GpuBackendCore
Auto Trait Implementations§
impl Freeze for GpuBackendCore
impl RefUnwindSafe for GpuBackendCore
impl Send for GpuBackendCore
impl Sync for GpuBackendCore
impl Unpin for GpuBackendCore
impl UnsafeUnpin for GpuBackendCore
impl UnwindSafe for GpuBackendCore
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more