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§
Sourcefn config(&self) -> &ParallelConfig
fn config(&self) -> &ParallelConfig
Get the parallelism configuration
Sourcefn world_size(&self) -> usize
fn world_size(&self) -> usize
Get world size
Sourcefn barrier<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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
Sourcefn 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_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)
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".