Commit a67a75a9 authored by Mintz, Tiffany's avatar Mintz, Tiffany
Browse files

fixed a few more build errors; still need to work on the shared pointer errors

parent 011df841
......@@ -16,20 +16,19 @@ void TensorRuntime::closeScope() { currentScope = ""; }
void TensorRuntime::submit(std::shared_ptr<numerics::TensorOperation> op) {
//upate the output tensor executation table
int newop_outid = op->getTensorOperandId(0);
std::map<std::string, std::map<int, int>>::iterator curTableIter;
std::map<int, int>::iterator &cur_table;
mtx.lock();
curTableIter = outTensorExecTbl.find(currentScope);
std::map<std::string, std::map<int, int>>::iterator curTableIter = outTensorExecTbl.find(currentScope);
if(curTableIter != outTensorExecTbl.end())
{
cur_table = curTableIter.second;
std::map<int, int> &cur_table = curTableIter->second;
if(cur_table.find(newop_outid)==cur_table.end())
cur_table[newop_outid]=1;
else
cur_table[newop_outid]+=1;
}
else
outTensorExeciTbl[currentScope][newop_outid]=1;
outTensorExecTbl[currentScope][newop_outid]=1;
// work on graph at dags[currentScope]
// add on to the graph
......@@ -38,11 +37,11 @@ void TensorRuntime::submit(std::shared_ptr<numerics::TensorOperation> op) {
std::shared_ptr<TensorOpNode> op1=std::make_shared<TensorOpNode>(op);
tg->addVertex(op1);
unsigned int num_op1_operands = op->getNumOperands();
TensorOpNode op0;
std::shared_ptr<TensorOpNode> op0;
for(int i=tg_sz-1; i>=0; i--)
{
op0=tg->getVertexProperties(i);
std::size_t op0_outid = op0.op->getTensorOperandId(0);
std::size_t op0_outid = op0->op->getTensorOperandId(0);
for(int j=1; j<num_op1_operands; j++) {
if(op0_outid == op1->op->getTensorOperandId(j))
tg->addEdge(op0,op1);
......@@ -58,7 +57,7 @@ void TensorRuntime::sync(const std::shared_ptr<numerics::TensorOperation> &op) {
while(syncing)
{
mtx.lock();
if(outTensorExec[op_outid]==0)
if(outTensorExecTbl[currentScope][op_outid]==0)
syncing=false;
mtx.unlock();
}
......@@ -71,7 +70,7 @@ void TensorRuntime::sync(const exatn::numerics::Tensor &tensor) {
while(syncing)
{
mtx.lock();
if(outTensorExec[tid]==0)
if(outTensorExecTbl[currentScope][tid]==0)
syncing=false;
mtx.unlock();
}
......
......@@ -8,7 +8,7 @@
#include "TensorGraph.hpp"
#include "tensor.hpp"
#include "tensor_operation.hpp"
#include "tensor_method.hpp"
//#include "tensor_method.hpp"
namespace exatn {
namespace runtime {
......@@ -17,7 +17,7 @@ class TensorRuntime {
protected:
std::map<std::string, std::shared_ptr<TensorGraph>> dags;
std::string currentScope;
std::map<std::string, map<int, int>> outTensorExecTbl; //table for tracking output tensor execution
std::map<std::string, std::map<int, int>> outTensorExecTbl; //table for tracking output tensor execution
std::mutex mtx; // mutex for lock on outTensorExec and dags
public:
void openScope(const std::string &scopeName);
......
......@@ -32,10 +32,10 @@ class TensorGraph : public Identifiable, public Cloneable<TensorGraph> {
public:
// Add an edge between src and tgt, this is
// a directed edge
virtual void addEdge(const TensorOpNode &srcNode, const TensorOpNode &tgtNode) = 0;
virtual void addEdge(const std::shared_ptr<TensorOpNode> &srcNode, const std::shared_ptr<TensorOpNode> &tgtNode) = 0;
virtual void addVertex(TensorOpNode &opNode) = 0;
virtual void addVertex(TensorOpNode &&opNode) = 0;
virtual void addVertex(std::shared_ptr<TensorOpNode> opNode) = 0;
//virtual void addVertex(TensorOpNode &&opNode) = 0;
// For now lets assume as you build it,
// you can't change the structure or the node values
......
Supports Markdown
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