Commit 6cc9dd0e authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh

Implemented basic printing for TensorGraph.

parent 4c207d0d
/** ExaTN::Numerics: Tensor operation
REVISION: 2019/07/29
REVISION: 2019/09/03
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -36,6 +36,11 @@ void TensorOperation::printIt() const
return;
}
TensorOpCode TensorOperation::getOpcode() const
{
return opcode_;
}
unsigned int TensorOperation::getNumOperands() const
{
return num_operands_;
......
/** ExaTN::Numerics: Tensor operation
REVISION: 2019/08/30
REVISION: 2019/09/03
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -58,6 +58,9 @@ public:
/** Prints. **/
virtual void printIt() const;
/** Returns the tensor operation code (opcode). **/
TensorOpCode getOpcode() const;
/** Returns the number of tensor operands required for the tensor operation. **/
unsigned int getNumOperands() const;
......
#include "directed_boost_graph.hpp"
#include <iostream>
using namespace boost;
namespace exatn {
......@@ -138,5 +140,22 @@ void DirectedBoostGraph::computeShortestPath(VertexIdType startIndex,
return;
}
void DirectedBoostGraph::printIt()
{
lock();
std::cout << "#MSG: Printing DAG:" << std::endl;
auto num_nodes = num_vertices(*dag_);
for(VertexIdType i = 0; i < num_nodes; ++i){
auto deps = getNeighborList(i);
std::cout << "Node " << i << ": Depends on { ";
for(const auto & node_id: deps) std::cout << node_id << " ";
std::cout << "}" << std::endl;
}
std::cout << "#END MSG" << std::endl;
unlock();
return;
}
} // namespace runtime
} // namespace exatn
/** ExaTN:: Tensor Runtime: Directed acyclic graph of tensor operations
REVISION: 2019/08/26
REVISION: 2019/09/03
Copyright (C) 2018-2019 Tiffany Mintz, Dmitry Lyakh, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
......@@ -95,6 +95,8 @@ public:
std::vector<double> & distances,
std::vector<VertexIdType> & paths) override;
void printIt() override;
const std::string name() const override {
return "boost-digraph";
}
......
/** ExaTN:: Tensor Runtime: Directed acyclic graph (DAG) of tensor operations
REVISION: 2019/08/26
REVISION: 2019/09/03
Copyright (C) 2018-2019 Tiffany Mintz, Dmitry Lyakh, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
......@@ -172,6 +172,9 @@ public:
std::vector<double> & distances,
std::vector<VertexIdType> & paths) = 0;
/** Prints the DAG **/
virtual void printIt() = 0;
/** Clones an empty subclass instance (needed for plugin registry). **/
virtual std::shared_ptr<TensorGraph> clone() = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment