4 #include <boost/format.hpp>
6 #include "smaug/core/datatypes.h"
7 #include "smaug/core/typedefs.h"
8 #include "smaug/core/network.h"
9 #include "smaug/utility/utils.h"
11 using namespace smaug;
13 void Network::addOperator(
Operator* op) {
14 Vertex v = add_vertex(VertexProperty(op),
graph);
20 assert(src != dest &&
"Adding an edge to the node itself!");
21 add_edge(src->getVertex(), dest->getVertex(), EdgeProperty(indices),
graph);
24 void Network::dumpDataflowGraph()
const {
25 std::ofstream out(
name +
"_dataflow_graph.dot", std::ofstream::out);
29 bool Network::validate()
const {
34 std::cerr <<
"[ERROR]: " << op->getName()
35 <<
" was not configured correctly!\n";
42 void Network::printSummary()
const {
43 static const std::string hline(
44 "______________________________________________"
45 "______________________________________________");
46 std::list<Vertex> vertices;
47 boost::topological_sort(
graph, std::front_inserter(vertices));
48 std::cout << hline <<
"\n";
49 std::cout << boost::format(kLayerFormat)
53 std::cout << hline <<
"\n";
54 for (
auto vertex : vertices) {
56 op->printSummary(std::cout);
57 std::cout << hline <<
"\n";