sim_fabric/lib.rs
1// Copyright (c) 2025 Graphcore Ltd. All rights reserved.
2
3//! Simulate a device comprising a rectangular fabric.
4//!
5//! The model is constructed the specified fabric and traffic generators
6//! and sinks connected to all of the fabric ports.
7//!
8//! The traffic generators can be configured to send different traffic
9//! patterns in order to evaluate the performance of the fabric.
10//!
11//! # Examples
12//!
13//! *Note*: in all the following comments the assumption is that a default
14//! 1GHz clock is being used. If the default clock frequency were to be
15//! changed then these calculations would be invalid.
16//!
17//! Running a basic all-to-all simulation
18//! ```text
19//! cargo run --bin sim-fabric --release -- --kib-to-send 1024 --stdout --traffic-pattern all-to-all-fixed
20//! ```
21//!
22//! In order to achieve the maximum throughput it is essential to make the
23//! frame sizes a multiple of the port width. For example, with a 128-bit
24//! port and the 20-byte ethernet frame overhead an ideal frame size would
25//! be something like 1484:
26//! ```text
27//! cargo run --bin sim-fabric --release -- --port-bits-per-tick 128 --frame-overhead-bytes 20 --frame-payload-bytes 1484 --kib-to-send 1024 --stdout
28//! ```
29//!
30//! This achieves the peak bandwith at one port of 14.9 GiB/s and if run with
31//! a balanced communcation pattern it can achieve that at each port (357.6
32//! GiB/s for the default 24-port fabric):
33//!
34//! Note: A throughput of 342.70 GiB/s or less may be observed because the
35//! src/dest pairing is random and a source will not send to itself. Try a
36//! different value for `--seed` to observe this behaviour.
37//!
38//! ```text
39//! cargo run --bin sim-fabric --release -- --port-bits-per-tick 128 --frame-overhead-bytes 20 --frame-payload-bytes 1484 --kib-to-send 1024 --traffic-pattern all-to-all-fixed --seed 3 --stdout
40//! ```
41
42pub mod frame_gen;
43pub mod source_sink_builder;