You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: include/osp/bsp/model/BspInstance.hpp
+92-66Lines changed: 92 additions & 66 deletions
Original file line number
Diff line number
Diff line change
@@ -29,40 +29,71 @@ namespace osp {
29
29
30
30
/**
31
31
* @class BspInstance
32
-
* @brief Represents an instance of the BSP (Bulk Synchronous Parallel) model.
32
+
* @brief Represents a scheduling problem instance for the Bulk Synchronous Parallel (BSP) model.
33
33
*
34
-
* The BspInstance class encapsulates the computational DAG (Directed Acyclic Graph) and the BSP architecture
35
-
* for a specific instance of the BSP model. It provides methods to access and modify the architecture and DAG,
36
-
* as well as retrieve information about the instance such as the number of vertices and processors.
34
+
* The BspInstance class serves as a container for all the necessary information to define a
35
+
* BSP scheduling problem. It acts as the "ground" object that holds the actual implementation
36
+
* of the graph and architecture.
37
37
*
38
-
* The instance specifies the compatibility between node types and processor types.
38
+
* It aggregates three main components:
39
39
*
40
-
* @tparam Graph_t The type of the computational DAG.
40
+
* 1. **Computational DAG**: The directed acyclic graph representing the program to be executed.
41
+
* It defines the tasks (nodes), their dependencies (directed edges), and associated weights (work, memory, communication).
42
+
*
43
+
* 2. **BSP Architecture**: The hardware model description, including the number of processors,
44
+
* their types, memory bounds, and communication/synchronization costs.
45
+
* Note that processor indices are represented using `unsigned`.
46
+
*
47
+
* 3. **Node-Processor Compatibility**: A matrix defining which node types can be executed on which
48
+
* processor types. This enables the modeling of heterogeneous systems (e.g., CPU + GPU) where
49
+
* certain nodes are restricted to specific hardware accelerators.
50
+
*
51
+
* @warning Be careful when assigning an existing graph to a BspInstance. Depending on the
52
+
* constructor or assignment operator used, this may result in a deep copy of the graph structure,
53
+
* which can be expensive for large graphs.
54
+
*
55
+
* This class provides a unified interface to access and modify these components, facilitating
56
+
* the development of scheduling algorithms that need to query problem constraints and properties.
57
+
*
58
+
* @tparam Graph_t The type of the computational DAG, which must satisfy the `is_computational_dag` concept.
41
59
*/
42
60
template<typename Graph_t>
43
61
classBspInstance {
44
62
static_assert(is_computational_dag_v<Graph_t>, "BspInstance can only be used with computational DAGs.");
45
63
46
64
private:
47
65
/**
48
-
* @brief The computational DAG of the instance. Holds the graph structure and the node types, work, memory, communication weights.
66
+
* @brief The computational DAG representing the program structure.
67
+
*
68
+
* It contains the graph topology (nodes and directed edges) as well as attributes such as node types,
69
+
* work weights, memory weights, and edge communication weights.
49
70
*/
50
71
Graph_t cdag;
51
72
/**
52
-
* @brief The BSP architecture of the instance. Holds the processor types and the memory bounds. Communication and synchronization cost. And the send cost between processors.
73
+
* @brief The BSP architecture model.
74
+
*
75
+
* It defines the hardware characteristics including processor types, memory limits,
76
+
* communication bandwidth/latency (send costs), and global synchronization costs.
53
77
*/
54
78
BspArchitecture<Graph_t> architecture;
55
79
56
80
/**
57
81
* @brief Stores the compatibility between node types and processor types.
58
82
*
59
-
* The architecture defines a type for each processor, and the dag defines a type for each node.
83
+
* The architecture defines a type for each processor, and the DAG defines a type for each node.
60
84
* This matrix stores for each node type and processor type whether they are compatible, i.e.,
61
-
* if a node of the can be assigned to a processor of the given type in a schedule.
85
+
* if a node of that type can be assigned to a processor of the given type in a schedule.
62
86
* @note The outer vector is indexed by node type, the inner vector is indexed by processor type.
0 commit comments