Commit e7f7b70c authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh

Fixing TAL-SH runtime: To be fixed:

1. TAL-SH C++ implementation has assert with side effects;
2. talsh::Tensor::impl::~impl dtor currently expects write_task_ member to be NULL: Wrong:
   a. If Tensor.impl->write_task_ != NULL, simply check task completion and remove tensor pointer
      from inside the TensorTask (stored pointers to participating tensors).
   b. TensorTask dtor must also nullify write_task_ pointers in all participating tensors.
      Use double friendship.
parent 5d4c5c19
#include "graph_executor_eager.hpp"
#include <iostream>
#include <cassert>
namespace exatn {
namespace runtime {
void EagerGraphExecutor::execute(TensorGraph & dag) {
//`Implement
auto num_nodes = dag.getNumNodes();
decltype(num_nodes) current = 0;
while(current < num_nodes){
TensorOpExecHandle exec_handle;
dag.lock();
dag.setNodeExecuting(current);
std::cout << "#DEBUG(EagerGraphExecutor)[EXEC_THREAD]: Submitting tensor operation " << current; //debug
auto error_code = dag.getNodeProperties(current).getOperation()->accept(*node_executor_,&exec_handle);
dag.unlock();
std::cout << ": Status = " << error_code << ": "; //debug
if(error_code == 0){
std::cout << "Syncing ... "; //debug
auto synced = node_executor_->sync(exec_handle,&error_code,true);
if(synced && error_code == 0){
dag.setNodeExecuted(current);
std::cout << "Success" << std::endl; //debug
++current;
}else{
std::cout << "Failure to synchronize tensor operation: Error " << error_code << std::endl;
assert(false);
}
}else{
std::cout << "Will retry" << std::endl; //debug
}
num_nodes = dag.getNumNodes();
}
return;
}
......
......@@ -143,18 +143,18 @@ void DirectedBoostGraph::computeShortestPath(VertexIdType startIndex,
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;
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
......
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