CheckpointableKernel

Trait CheckpointableKernel 

Source
pub trait CheckpointableKernel: GpuKernel {
    type Checkpoint: Serialize + DeserializeOwned + Send + Sync;

    // Required methods
    fn checkpoint<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Checkpoint>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn restore<'life0, 'async_trait>(
        &'life0 mut self,
        checkpoint: Self::Checkpoint,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn can_checkpoint(&self) -> bool { ... }
    fn checkpoint_size_estimate(&self) -> usize { ... }
}
Expand description

Trait for kernels that support checkpoint/restore.

Enables recovery from failures by saving and restoring kernel state. Useful for long-running or stateful kernels.

§Type Parameters

  • C: Checkpoint type (must be serializable)

Required Associated Types§

Source

type Checkpoint: Serialize + DeserializeOwned + Send + Sync

The checkpoint state type

Required Methods§

Source

fn checkpoint<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Checkpoint>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a checkpoint of current kernel state.

§Returns

A serializable checkpoint that can be used to restore state.

Source

fn restore<'life0, 'async_trait>( &'life0 mut self, checkpoint: Self::Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Restore kernel state from a checkpoint.

§Arguments
  • checkpoint - Previously saved checkpoint state
§Returns

Ok if state was restored, Err if checkpoint is invalid.

Provided Methods§

Source

fn can_checkpoint(&self) -> bool

Check if checkpointing is currently safe.

Returns false if the kernel is in the middle of an operation that cannot be interrupted.

Source

fn checkpoint_size_estimate(&self) -> usize

Get the size of the checkpoint in bytes (estimate).

Useful for monitoring and capacity planning.

Implementors§