Commit 51513e15 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Fixing erroneous git push


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 10a01bf8
add_subdirectory(mpi)
if(MPI_FOUND)
add_subdirectory(mpi)
endif()
file (GLOB HEADERS *.hpp) file (GLOB HEADERS *.hpp)
......
...@@ -24,4 +24,3 @@ endif() ...@@ -24,4 +24,3 @@ endif()
add_dependencies(client_test exatensor-build) add_dependencies(client_test exatensor-build)
add_dependencies(server_test exatensor-build) add_dependencies(server_test exatensor-build)
add_subdirectory(example-tensor-method)
/** ExaTN::Numerics: Tensor /** ExaTN::Numerics: Tensor
REVISION: 2019/07/17 REVISION: 2019/07/22
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh) Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
...@@ -157,9 +157,9 @@ void Tensor::appendDimension(DimExtent dim_extent) ...@@ -157,9 +157,9 @@ void Tensor::appendDimension(DimExtent dim_extent)
return; return;
} }
std::size_t Tensor::getTensorId() const TensorHashType Tensor::getTensorHash() const
{ {
return reinterpret_cast<std::size_t>(this); return reinterpret_cast<TensorHashType>(this);
} }
} //namespace numerics } //namespace numerics
......
/** ExaTN::Numerics: Abstract Tensor /** ExaTN::Numerics: Abstract Tensor
REVISION: 2019/07/17 REVISION: 2019/07/22
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh) Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
...@@ -48,6 +48,8 @@ namespace exatn{ ...@@ -48,6 +48,8 @@ namespace exatn{
namespace numerics{ namespace numerics{
using TensorHashType = std::size_t;
class Tensor{ class Tensor{
public: public:
...@@ -126,7 +128,7 @@ public: ...@@ -126,7 +128,7 @@ public:
void appendDimension(DimExtent dim_extent); void appendDimension(DimExtent dim_extent);
/** Get the unique integer tensor id. **/ /** Get the unique integer tensor id. **/
std::size_t getTensorId() const; TensorHashType getTensorHash() const;
private: private:
......
/** ExaTN::Numerics: Tensor connected to other tensors inside a tensor network /** ExaTN::Numerics: Tensor connected to other tensors inside a tensor network
REVISION: 2019/07/16 REVISION: 2019/07/22
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh) Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......
/** ExaTN::Numerics: Tensor operation /** ExaTN::Numerics: Tensor operation
REVISION: 2019/06/05 REVISION: 2019/07/22
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh) Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
...@@ -46,12 +46,12 @@ unsigned int TensorOperation::getNumOperandsSet() const ...@@ -46,12 +46,12 @@ unsigned int TensorOperation::getNumOperandsSet() const
return static_cast<unsigned int>(operands_.size()); return static_cast<unsigned int>(operands_.size());
} }
std::size_t TensorOperation::getTensorOperandId(unsigned int op_num) TensorHashType TensorOperation::getTensorOperandHash(unsigned int op_num) const
{ {
return ((this->getTensorOperand(op_num)).get())->getTensorId(); return this->getTensorOperand(op_num)->getTensorHash();
} }
std::shared_ptr<Tensor> TensorOperation::getTensorOperand(unsigned int op_num) std::shared_ptr<Tensor> TensorOperation::getTensorOperand(unsigned int op_num) const
{ {
if(op_num < operands_.size()) return operands_[op_num]; if(op_num < operands_.size()) return operands_[op_num];
return std::shared_ptr<Tensor>(nullptr); return std::shared_ptr<Tensor>(nullptr);
......
/** ExaTN::Numerics: Tensor operation /** ExaTN::Numerics: Tensor operation
REVISION: 2019/06/05 REVISION: 2019/07/22
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh) Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/ Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
...@@ -51,10 +51,10 @@ public: ...@@ -51,10 +51,10 @@ public:
unsigned int getNumOperandsSet() const; unsigned int getNumOperandsSet() const;
/** Returns a unique integer tensor operand identifier. **/ /** Returns a unique integer tensor operand identifier. **/
std::size_t getTensorOperandId(unsigned int op_num); TensorHashType getTensorOperandHash(unsigned int op_num) const;
/** Returns a co-owned pointer to a specific tensor operand, or nullptr if not yet set. **/ /** Returns a co-owned pointer to a specific tensor operand, or nullptr if not yet set. **/
std::shared_ptr<Tensor> getTensorOperand(unsigned int op_num); std::shared_ptr<Tensor> getTensorOperand(unsigned int op_num) const;
/** Sets the next tensor operand. **/ /** Sets the next tensor operand. **/
void setTensorOperand(std::shared_ptr<Tensor> tensor); void setTensorOperand(std::shared_ptr<Tensor> tensor);
......
...@@ -13,15 +13,17 @@ add_library(${LIBRARY_NAME} ...@@ -13,15 +13,17 @@ add_library(${LIBRARY_NAME}
target_include_directories( target_include_directories(
${LIBRARY_NAME} ${LIBRARY_NAME}
PUBLIC . PUBLIC . graph optimizer executor
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include
${CMAKE_SOURCE_DIR}/src/exatn ${CMAKE_SOURCE_DIR}/src/exatn/numerics
${CMAKE_SOURCE_DIR}/tpls/cppmicroservices/framework/include ${CMAKE_SOURCE_DIR}/tpls/cppmicroservices/framework/include
PRIVATE PRIVATE
${CMAKE_SOURCE_DIR}/src/exatn
${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src/driver-rpc
) )
target_link_libraries(${LIBRARY_NAME} PUBLIC CppMicroServices exatn-numerics exatn-runtime-graph PRIVATE Boost::graph) target_link_libraries(${LIBRARY_NAME} PUBLIC CppMicroServices exatn-numerics
PRIVATE exatn-runtime-executor exatn-runtime-graph Boost::graph)
if(APPLE) if(APPLE)
set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path") set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
......
set(LIBRARY_NAME exatn-runtime-executor) set(LIBRARY_NAME exatn-runtime-executor)
file(GLOB SRC GraphExecutorActivator.cpp exatensor/ExatensorExecutor.cpp talsh/TalshExecutor.cpp) file(GLOB SRC
ExecutorActivator.cpp
node_executors/talsh/node_executor_talsh.cpp
node_executors/exatensor/node_executor_exatensor.cpp
graph_executors/eager/graph_executor_eager.cpp
graph_executors/lazy/graph_executor_lazy.cpp)
usfunctiongetresourcesource(TARGET ${LIBRARY_NAME} OUT SRC) usfunctiongetresourcesource(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongeneratebundleinit(TARGET ${LIBRARY_NAME} OUT SRC) usfunctiongeneratebundleinit(TARGET ${LIBRARY_NAME} OUT SRC)
...@@ -12,8 +17,10 @@ add_library(${LIBRARY_NAME} ...@@ -12,8 +17,10 @@ add_library(${LIBRARY_NAME}
target_include_directories( target_include_directories(
${LIBRARY_NAME} ${LIBRARY_NAME}
PUBLIC . talsh exatensor PUBLIC . node_executors/talsh node_executors/exatensor
${CMAKE_SOURCE_DIR}/src/exatn graph_executors/eager graph_executors/lazy
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include
${CMAKE_SOURCE_DIR}/src/exatn/numerics
${CMAKE_SOURCE_DIR}/tpls/cppmicroservices/framework/include ${CMAKE_SOURCE_DIR}/tpls/cppmicroservices/framework/include
) )
...@@ -32,7 +39,7 @@ usfunctionembedresources(TARGET ...@@ -32,7 +39,7 @@ usfunctionembedresources(TARGET
FILES FILES
manifest.json) manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC CppMicroServices PRIVATE exatn-runtime-graph) target_link_libraries(${LIBRARY_NAME} PUBLIC CppMicroServices exatn PRIVATE exatn-runtime-graph)
if(APPLE) if(APPLE)
set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path/../lib;@loader_path") set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path/../lib;@loader_path")
...@@ -50,4 +57,3 @@ file (GLOB HEADERS *.hpp) ...@@ -50,4 +57,3 @@ file (GLOB HEADERS *.hpp)
install(FILES ${HEADERS} DESTINATION include/exatn/runtime) install(FILES ${HEADERS} DESTINATION include/exatn/runtime)
install(TARGETS ${LIBRARY_NAME} DESTINATION plugins) install(TARGETS ${LIBRARY_NAME} DESTINATION plugins)
#include "graph_executor_eager.hpp"
#include "graph_executor_lazy.hpp"
#include "node_executor_talsh.hpp"
#include "node_executor_exatensor.hpp"
#include "cppmicroservices/BundleActivator.h"
#include "cppmicroservices/BundleContext.h"
#include <memory>
#include <set>
using namespace cppmicroservices;
namespace {
/**
*/
class US_ABI_LOCAL ExecutorActivator : public BundleActivator {
public:
ExecutorActivator() {}
/**
*/
void Start(BundleContext context) {
auto g1 = std::make_shared<exatn::runtime::EagerGraphExecutor>();
auto g2 = std::make_shared<exatn::runtime::LazyGraphExecutor>();
context.RegisterService<exatn::runtime::TensorGraphExecutor>(g1);
context.RegisterService<exatn::runtime::TensorGraphExecutor>(g2);
auto n1 = std::make_shared<exatn::runtime::TalshNodeExecutor>();
auto n2 = std::make_shared<exatn::runtime::ExatensorNodeExecutor>();
context.RegisterService<exatn::runtime::TensorNodeExecutor>(n1);
context.RegisterService<exatn::runtime::TensorNodeExecutor>(n2);
}
/**
*/
void Stop(BundleContext /*context*/) {}
};
} // namespace
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(ExecutorActivator)
#include "graph_executor_eager.hpp"
namespace exatn {
namespace runtime {
void EagerGraphExecutor::execute(TensorGraph & dag) {
int nodes_executed=0, execnode_id;
auto num_nodes = dag.getNumNodes();
while(nodes_executed <= num_nodes) {
execnode_id = nextExecutableNodeId(dag);
node_executor_->execute(*((dag.getNodeProperties(execnode_id)).getOperation()));
//TODO: update output tensor execution table
dag.setNodeExecuted(execnode_id);
nodes_executed++;
num_nodes = dag.getNumNodes();
}
}
int EagerGraphExecutor::nextExecutableNodeId(TensorGraph & dag){
auto num_nodes = dag.getNumNodes();
int i;
for(i = 0; i < num_nodes; i++) {
if(!dag.nodeExecuted(i)) {
if(dag.degree(i)==0)
break;
else {
auto n_list = dag.getNeighborList(i);
int j;
for(j = 0; j < n_list.size(); j++)
if(!dag.nodeExecuted(j))
break;
if(j >= n_list.size())
break;
}
}
}
assert(i < num_nodes);
return i;
}
} //namespace runtime
} //namespace exatn
/** ExaTN:: Tensor Runtime: Tensor graph executor: Eager
REVISION: 2019/07/24
Copyright (C) 2018-2019 Tiffany Mintz, Dmitry Lyakh, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
#ifndef EXATN_RUNTIME_EAGER_GRAPH_EXECUTOR_HPP_
#define EXATN_RUNTIME_EAGER_GRAPH_EXECUTOR_HPP_
#include "tensor_graph_executor.hpp"
#include <memory>
namespace exatn {
namespace runtime {
class EagerGraphExecutor : public TensorGraphExecutor {
public:
/** Traverses the DAG and executes all its nodes. **/
void execute(TensorGraph & dag) override;
protected:
int nextExecutableNodeId(TensorGraph & dag);
};
} //namespace runtime
} //namespace exatn
#endif //EXATN_RUNTIME_EAGER_GRAPH_EXECUTOR_HPP_
#include "graph_executor_lazy.hpp"
namespace exatn {
namespace runtime {
void LazyGraphExecutor::execute(TensorGraph & dag) {
//`Implement
return;
}
} //namespace runtime
} //namespace exatn
/** ExaTN:: Tensor Runtime: Tensor graph executor: Lazy
REVISION: 2019/07/24
Copyright (C) 2018-2019 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
#ifndef EXATN_RUNTIME_LAZY_GRAPH_EXECUTOR_HPP_
#define EXATN_RUNTIME_LAZY_GRAPH_EXECUTOR_HPP_
#include "tensor_graph_executor.hpp"
#include <memory>
namespace exatn {
namespace runtime {
class LazyGraphExecutor : public TensorGraphExecutor {
public:
/** Traverses the DAG and executes all its nodes. **/
void execute(TensorGraph & dag) override;
protected:
};
} //namespace runtime
} //namespace exatn
#endif //EXATN_RUNTIME_LAZY_GRAPH_EXECUTOR_HPP_
#include "node_executor_exatensor.hpp"
namespace exatn {
namespace runtime {
NodeExecHandleType ExatensorNodeExecutor::execute(TensorOperation & op)
{
//`Implement
return 0;
}
bool ExatensorNodeExecutor::sync(NodeExecHandleType op_handle, bool wait)
{
//`Implement
return false;
}
} //namespace runtime
} //namespace exatn
/** ExaTN:: Tensor Runtime: Tensor graph node executor: Exatensor
REVISION: 2019/07/24
Copyright (C) 2018-2019 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
#ifndef EXATN_RUNTIME_EXATENSOR_NODE_EXECUTOR_HPP_
#define EXATN_RUNTIME_EXATENSOR_NODE_EXECUTOR_HPP_
#include "tensor_node_executor.hpp"
namespace exatn {
namespace runtime {
class ExatensorNodeExecutor : public TensorNodeExecutor {
public:
NodeExecHandleType execute(TensorOperation & op) override;
bool sync(NodeExecHandleType op_handle, bool wait) override;
protected:
//`ExaTENSOR executor state
};
} //namespace runtime
} //namespace exatn
#endif //EXATN_RUNTIME_EXATENSOR_NODE_EXECUTOR_HPP_
#include "node_executor_talsh.hpp"
namespace exatn {
namespace runtime {
NodeExecHandleType TalshNodeExecutor::execute(TensorOperation & op)
{
//`Implement
return 0;
}
bool TalshNodeExecutor::sync(NodeExecHandleType op_handle, bool wait)
{
//`Implement
return false;
}
} //namespace runtime
} //namespace exatn
/** ExaTN:: Tensor Runtime: Tensor graph node executor: Talsh
REVISION: 2019/07/24
Copyright (C) 2018-2019 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
#ifndef EXATN_RUNTIME_TALSH_NODE_EXECUTOR_HPP_
#define EXATN_RUNTIME_TALSH_NODE_EXECUTOR_HPP_
#include "tensor_node_executor.hpp"
namespace exatn {
namespace runtime {
class TalshNodeExecutor : public TensorNodeExecutor {
public:
NodeExecHandleType execute(TensorOperation & op) override;
bool sync(NodeExecHandleType op_handle, bool wait) override;
protected:
//`TALSH executor state
};
} //namespace runtime
} //namespace exatn
#endif //EXATN_RUNTIME_TALSH_NODE_EXECUTOR_HPP_
/** ExaTN:: Tensor Runtime: Tensor graph executor
REVISION: 2019/07/24
Copyright (C) 2018-2019 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
#ifndef EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_
#define EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_
#include "tensor_graph.hpp"
#include "tensor_node_executor.hpp"
#include "tensor_operation.hpp"
#include <memory>
namespace exatn {
namespace runtime {
class TensorGraphExecutor {
public:
/** Set the DAG node executor (tensor operation executor). **/
bool setNodeExecutor(std::shared_ptr<TensorNodeExecutor> node_executor)
{
if(node_executor_) return false;
node_executor_ = node_executor;
return true;
}
/** Traverses the DAG and executes all its nodes. **/
virtual void execute(TensorGraph & dag) = 0;
protected:
std::shared_ptr<TensorNodeExecutor> node_executor_;
};
} //namespace runtime
} //namespace exatn
#endif //EXATN_RUNTIME_TENSOR_GRAPH_EXECUTOR_HPP_
/** ExaTN:: Tensor Runtime: Tensor graph node executor
REVISION: 2019/07/24
Copyright (C) 2018-2019 Dmitry Lyakh, Tiffany Mintz, Alex McCaskey
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle)
Rationale:
**/
#ifndef EXATN_RUNTIME_TENSOR_NODE_EXECUTOR_HPP_
#define EXATN_RUNTIME_TENSOR_NODE_EXECUTOR_HPP_
#include "tensor_operation.hpp"
namespace exatn {
namespace runtime {
// Tensor implementation:
using numerics::TensorHashType; //each numerics::Tensor has its unique integer hash
using numerics::Tensor;
using numerics::TensorOperation;
// DAG node execution handle (tensor operation execution handle):
using NodeExecHandleType = std::size_t;
class TensorNodeExecutor {
public: