Skip to main content

ParallelExecutor

Trait ParallelExecutor 

Source
pub trait ParallelExecutor: Send + Sync {
    // Required methods
    fn config(&self) -> &ParallelConfig;
    fn rank(&self) -> usize;
    fn world_size(&self) -> usize;
    fn device(&self) -> Device;
    fn barrier<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn all_reduce<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 mut [f32],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn all_gather<'life0, 'life1, 'async_trait>(
        &'life0 self,
        local_data: &'life1 [f32],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn broadcast<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 mut [f32],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn is_master(&self) -> bool { ... }
}
Expand description

Parallel executor trait

Required Methods§

Source

fn config(&self) -> &ParallelConfig

Get the parallelism configuration

Source

fn rank(&self) -> usize

Get local rank

Source

fn world_size(&self) -> usize

Get world size

Source

fn device(&self) -> Device

Get the local device

Source

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

Barrier synchronization across all ranks

Source

fn all_reduce<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 mut [f32], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

All-reduce operation (sum by default)

Source

fn all_gather<'life0, 'life1, 'async_trait>( &'life0 self, local_data: &'life1 [f32], ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

All-gather operation

Source

fn broadcast<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 mut [f32], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcast from master to all ranks

Provided Methods§

Source

fn is_master(&self) -> bool

Check if this is the master rank

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§