MyraMath


Source: tests/jobgraph/FusedJobGraph.cpp

1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
11 // JobGraph bits.
14 
15 // Algorithms.
19 #include <myramath/jobgraph/detail/execute_serial.h>
20 
21 // Reporting.
22 #include <tests/myratest.h>
23 
24 #include <iostream>
25 
26 using namespace myra;
27 
28 ADD_TEST("FusedJobGraph","[jobgraph]")
29  {
30  FusedJobGraph graph;
31  int count = 0;
32  int g0 = graph.insert( make_LambdaJobGraph([&count](){++count;}) );
33  int g1 = graph.insert( make_LambdaJobGraph([&count](){++count;}) );
34  graph.add_edge( g0, JobID(0), g1, JobID(0) );
35  REQUIRE( verify(graph) );
36  //graphviz(graph,std::cout);
37  execute_serial(graph);
38  REQUIRE( count==2 );
39  }
Contains multiple JobGraph&#39;s, fuses them together according to user-defined dependency relationships...
Given a JobGraph G, verifies it has valid topology.
Definition: syntax.dox:1
Execute&#39;s a JobGraph.
void add_edge(int g0, JobID j0, int g1, JobID j1)
Adds a dependency, that g0.job(j0) must execute before g1.job(j1).
Definition: FusedJobGraph.cpp:102
int insert(const JobGraph &g)
Adds a JobGraph to *this, returns a GraphID to refer to it in the future.
Definition: FusedJobGraph.cpp:90
Key type used to identify the Job&#39;s of a JobGraph.
Definition: JobID.h:60
JobGraph make_LambdaJobGraph(const Lambda &lambda)
Given a Lambda, returns a JobGraph that calls lambda() when execute()&#39;d.
Definition: LambdaJobGraph.h:129
Given a JobGraph, produces a .dot file for visualization with graphviz.
Encapsulates a Lambda function into a JobGraph of a single Job.
Contains multiple JobGraph&#39;s, fuses them together.
Definition: FusedJobGraph.h:31


Results: [PASS]


Go back to Summary of /test programs.