Commit 99e9a06b authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh
Browse files

Added asynchronous tensor operation processing API into NumServer.

parent 46666be2
......@@ -96,6 +96,37 @@ void NumServer::destroySubspace(SubspaceId subspace_id)
return;
}
int submit(std::shared_ptr<TensorOperation> operation)
{
//`Finish
return 0;
}
int submit(std::shared_ptr<TensorNetwork> network)
{
//`Finish
return 0;
}
bool sync(const Tensor & tensor, bool wait)
{
//`Finish
return false;
}
bool sync(const TensorOperation & operation, bool wait)
{
//`Finish
return false;
}
bool sync(const TensorNetwork & network, bool wait)
{
//`Finish
return false;
}
} //namespace numerics
} //namespace exatn
......@@ -4,6 +4,17 @@ REVISION: 2019/06/05
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
/** Rationale:
(a) Numerical server provides basic tensor network processing functionality:
+ Opening/closing TAProL scopes (top scope 0 "GLOBAL" is open automatically);
+ Creation/destruction of named vector spaces and their named subspaces;
+ Registration/retrieval of external data;
+ Registration/retrieval of external tensor methods;
+ Submission for processing of individual tensor operations and tensor networks.
(b) Processing of individual tensor operations and tensor networks has asynchronous semantics:
Submit TensorOperation/TensorNetwork for processing, then synchronize on the tensor-result.
**/
#ifndef EXATN_NUMERICS_NUM_SERVER_HPP_
#define EXATN_NUMERICS_NUM_SERVER_HPP_
......@@ -80,6 +91,22 @@ public:
void destroySubspace(const std::string & subspace_name); //in: name of the subspace to destroy
void destroySubspace(SubspaceId subspace_id);
/** Submits an individual tensor operation for processing. **/
int submit(std::shared_ptr<TensorOperation> operation);
/** Submits a tensor network for processing (evaluating the tensor-result). **/
int submit(std::shared_ptr<TensorNetwork> network);
/** Synchronizes all tensor operations on a given tensor. **/
bool sync(const Tensor & tensor,
bool wait = false);
/** Synchronizes execution of a specific tensor operation. **/
bool sync(const TensorOperation & operation,
bool wait = false);
/** Synchronizes execution of a specific tensor network. **/
bool sync(const TensorNetwork & network,
bool wait = false);
private:
SpaceRegister space_register_; //register of vector spaces and their named subspaces
......
/** ExaTN::Numerics: Tensor
REVISION: 2018/12/18
REVISION: 2019/06/05
Copyright (C) 2018-2018 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2018 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -76,6 +76,11 @@ std::pair<SpaceId,SubspaceId> Tensor::getDimSpaceAttr(unsigned int dim_id) const
return signature_.getDimSpaceAttr(dim_id);
}
std::size_t Tensor::getTensorId() const
{
return reinterpret_cast<std::size_t>(this);
}
} //namespace numerics
} //namespace exatn
/** ExaTN::Numerics: Abstract Tensor
REVISION: 2019/05/27
REVISION: 2019/06/05
Copyright (C) 2018-2019 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2019 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -102,6 +102,9 @@ public:
SubspaceId getDimSubspaceId(unsigned int dim_id) const;
std::pair<SpaceId,SubspaceId> getDimSpaceAttr(unsigned int dim_id) const;
/** Get the unique integer tensor id. **/
std::size_t getTensorId() const;
private:
std::string name_; //tensor name
......
......@@ -48,7 +48,7 @@ unsigned int TensorOperation::getNumOperandsSet() const
std::size_t TensorOperation::getTensorOperandId(unsigned int op_num)
{
return reinterpret_cast<std::size_t>(this->getTensorOperand(op_num).get());
return ((this->getTensorOperand(op_num)).get())->getTensorId();
}
std::shared_ptr<Tensor> TensorOperation::getTensorOperand(unsigned int op_num)
......
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