momemta::ComputationGraphBuilder Class Reference

#include <Graph.h>

Detailed Description

Builder for the computation graph.

Connections between modules are used as constrains for proper ordering of operations. If a module does not contribute to the graph (it's output is not used and it's not a sticky module), it's ignored and removed from the final graph.

In case it's not possible to build the computation graph (cyclic dependencies for example), an exception is thrown.

See also
momemta::ComputationGraph

Definition at line 127 of file Graph.h.

Public Member Functions

 ComputationGraphBuilder (const momemta::ModuleList &available_modules, const Configuration &configuration)
 Create a new builder. More...
 
std::shared_ptr< ComputationGraphbuild ()
 Build the computation graph. More...
 
void exportGraph (const std::string &output) const
 Export a GraphViz representation of the computation graph to a file. More...
 

Constructor & Destructor Documentation

◆ ComputationGraphBuilder()

momemta::ComputationGraphBuilder::ComputationGraphBuilder ( const momemta::ModuleList &  available_modules,
const Configuration configuration 
)

Create a new builder.

Warning
The configuration may be updated if, after pruning of unused modules, the number of integration dimensions requested have changed.
Parameters
available_modulesList of definitions of all the available modules.
configurationThe configuration to use to build the computation graph. It may be updated if, after pruning of unused modules, the number of integration dimensions requested changed.
See also
momemta::ModuleRegistry::exportList()

Definition at line 294 of file Graph.cc.

Member Function Documentation

◆ build()

std::shared_ptr< ComputationGraph > momemta::ComputationGraphBuilder::build ( )

Build the computation graph.

An exception is thrown if a graph cannot be build. In such case, a graphviz representation of the graph is automatically dumped into the current working directory into a file named graph.debug, which may be used to diagnosticate the issue.

Returns
A pointer to the computation graph.

Definition at line 298 of file Graph.cc.

◆ exportGraph()

void momemta::ComputationGraphBuilder::exportGraph ( const std::string &  output) const

Export a GraphViz representation of the computation graph to a file.

Note
You must first construct the graph with build() before calling this function
Parameters
outputThe name of the output file

Definition at line 877 of file Graph.cc.

Referenced by build().


The documentation for this class was generated from the following files: