Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions communication/src/allocator/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::cell::RefCell;
use crate::allocator::thread::ThreadBuilder;
use crate::allocator::{Allocate, AllocateBuilder, Exchangeable, Thread, Process, ProcessBuilder};
use crate::allocator::zero_copy::allocator::{TcpBuilder, TcpAllocator};
use crate::allocator::simulation::SimAllocator;

use crate::{Push, Pull};

Expand All @@ -21,6 +22,8 @@ pub enum Allocator {
Process(Process),
/// Inter-process allocator (TCP-based, with a `Process` as its intra-process inner).
Tcp(TcpAllocator),
/// Single-threaded simulation allocator, with driver-controlled message delivery.
Sim(SimAllocator),
}

impl Allocator {
Expand All @@ -30,6 +33,7 @@ impl Allocator {
Allocator::Thread(t) => t.index(),
Allocator::Process(p) => p.index(),
Allocator::Tcp(z) => z.index(),
Allocator::Sim(s) => s.index(),
}
}
/// The number of workers.
Expand All @@ -38,6 +42,7 @@ impl Allocator {
Allocator::Thread(t) => t.peers(),
Allocator::Process(p) => p.peers(),
Allocator::Tcp(z) => z.peers(),
Allocator::Sim(s) => s.peers(),
}
}
/// Constructs several send endpoints and one receive endpoint.
Expand All @@ -46,6 +51,7 @@ impl Allocator {
Allocator::Thread(t) => t.allocate(identifier),
Allocator::Process(p) => p.allocate(identifier),
Allocator::Tcp(z) => z.allocate(identifier),
Allocator::Sim(s) => s.allocate(identifier),
}
}
/// Constructs several send endpoints and one receive endpoint.
Expand All @@ -54,6 +60,7 @@ impl Allocator {
Allocator::Thread(t) => t.broadcast(identifier),
Allocator::Process(p) => p.broadcast(identifier),
Allocator::Tcp(z) => z.broadcast(identifier),
Allocator::Sim(s) => s.broadcast(identifier),
}
}
/// Perform work before scheduling operators.
Expand All @@ -62,6 +69,7 @@ impl Allocator {
Allocator::Thread(t) => t.receive(),
Allocator::Process(p) => p.receive(),
Allocator::Tcp(z) => z.receive(),
Allocator::Sim(s) => s.receive(),
}
}
/// Perform work after scheduling operators.
Expand All @@ -70,6 +78,7 @@ impl Allocator {
Allocator::Thread(t) => t.release(),
Allocator::Process(p) => p.release(),
Allocator::Tcp(z) => z.release(),
Allocator::Sim(s) => s.release(),
}
}
/// Provides access to the shared event queue.
Expand All @@ -78,6 +87,7 @@ impl Allocator {
Allocator::Thread(ref t) => t.events(),
Allocator::Process(ref p) => p.events(),
Allocator::Tcp(ref z) => z.events(),
Allocator::Sim(ref s) => s.events(),
}
}

Expand All @@ -87,6 +97,7 @@ impl Allocator {
Allocator::Thread(t) => t.await_events(duration),
Allocator::Process(p) => p.await_events(duration),
Allocator::Tcp(z) => z.await_events(duration),
Allocator::Sim(s) => s.await_events(duration),
}
}

Expand Down Expand Up @@ -119,6 +130,7 @@ impl Allocate for Allocator {
Allocator::Thread(t) => t.await_events(_duration),
Allocator::Process(p) => p.await_events(_duration),
Allocator::Tcp(z) => z.await_events(_duration),
Allocator::Sim(s) => s.await_events(_duration),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions communication/src/allocator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod generic;

pub mod canary;
pub mod counters;
pub mod simulation;

pub mod zero_copy;

Expand Down
Loading
Loading