Commit 98291d6d authored by Dmitry I. Lyakh's avatar Dmitry I. Lyakh

Fixed exatn::sync() semantics.

parent 704f1a53
/** ExaTN::Numerics: General client header
REVISION: 2020/07/01
REVISION: 2020/07/06
Copyright (C) 2018-2020 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2020 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -519,8 +519,8 @@ inline bool evaluateTensorNetworkSync(const ProcessGroup & process_group, //in:
{return numericalServer->evaluateTensorNetworkSync(process_group,name,network);}
/** Synchronizes all outstanding update operations on a given tensor
specified by its symbolic name. **/
/** Synchronizes all outstanding update operations on a given tensor specified by
its symbolic name. If ProcessGroup is not provided, defaults to the local process.**/
inline bool sync(const std::string & name, //in: tensor name
bool wait = true) //in: wait versus test for completion
{return numericalServer->sync(name,wait);}
......@@ -551,7 +551,8 @@ inline bool evaluateSync(const ProcessGroup & process_group, //in: chosen group
return success;}
/** Synchronizes all outstanding operations on a given tensor network object. **/
/** Synchronizes all outstanding operations on a given tensor network object.
If ProcessGroup is not provided, defaults to the local process. **/
inline bool sync(TensorNetwork & network, //in: finalized tensor network
bool wait = true) //in: wait versus test for completion
{return numericalServer->sync(network,wait);}
......@@ -588,7 +589,8 @@ inline bool evaluateSync(const ProcessGroup & process_group, //in: chosen group
return success;}
/** Synchronizes all outstanding operations on a given tensor. **/
/** Synchronizes all outstanding operations on a given tensor.
If ProcessGroup is not provided, defaults to the local process. **/
inline bool sync(const Tensor & tensor, //in: tensor
bool wait = true) //in: wait versus test for completion
{return numericalServer->sync(tensor,wait);}
......@@ -599,7 +601,8 @@ inline bool sync(const ProcessGroup & process_group, //in: chosen group of MPI
{return numericalServer->sync(process_group,tensor,wait);}
/** Synchronizes all outstanding tensor operations in the current scope (barrier). **/
/** Synchronizes all outstanding tensor operations in the current scope (barrier).
If ProcessGroup is not provided, defaults to the local process. **/
inline bool sync(bool wait = true) //in: wait versus test for completion
{return numericalServer->sync(wait);}
......
/** ExaTN::Numerics: Numerical server
REVISION: 2020/07/02
REVISION: 2020/07/06
Copyright (C) 2018-2020 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2020 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -484,7 +484,7 @@ bool NumServer::submit(const ProcessGroup & process_group,
destroy_slice->setTensorOperand(input_slice.second);
submitted = submit(destroy_slice); if(!submitted) return false;
}
if(serialize) sync(getCurrentProcessGroup()); //debug
if(serialize) sync(); //debug
input_slices.clear();
} //loop over tensor operations
//Erase intermediate tensor slices once all tensor operations have been executed:
......@@ -570,7 +570,7 @@ bool NumServer::submit(const ProcessGroup & process_group,
bool NumServer::sync(const Tensor & tensor, bool wait)
{
return sync(getDefaultProcessGroup(),tensor,wait);
return sync(getCurrentProcessGroup(),tensor,wait);
}
bool NumServer::sync(const ProcessGroup & process_group, const Tensor & tensor, bool wait)
......@@ -593,7 +593,7 @@ bool NumServer::sync(TensorOperation & operation, bool wait) //`Local synchroniz
bool NumServer::sync(TensorNetwork & network, bool wait)
{
return sync(getDefaultProcessGroup(),network,wait);
return sync(getCurrentProcessGroup(),network,wait);
}
bool NumServer::sync(const ProcessGroup & process_group, TensorNetwork & network, bool wait)
......@@ -603,7 +603,7 @@ bool NumServer::sync(const ProcessGroup & process_group, TensorNetwork & network
bool NumServer::sync(bool wait)
{
return sync(getDefaultProcessGroup(),wait);
return sync(getCurrentProcessGroup(),wait);
}
bool NumServer::sync(const ProcessGroup & process_group, bool wait)
......@@ -621,7 +621,7 @@ bool NumServer::sync(const ProcessGroup & process_group, bool wait)
bool NumServer::sync(const std::string & name, bool wait)
{
return sync(getDefaultProcessGroup(),name,wait);
return sync(getCurrentProcessGroup(),name,wait);
}
bool NumServer::sync(const ProcessGroup & process_group, const std::string & name, bool wait)
......
/** ExaTN::Numerics: Numerical server
REVISION: 2020/07/01
REVISION: 2020/07/06
Copyright (C) 2018-2020 Dmitry I. Lyakh (Liakh)
Copyright (C) 2018-2020 Oak Ridge National Laboratory (UT-Battelle) **/
......@@ -239,7 +239,8 @@ public:
std::shared_ptr<Tensor> accumulator); //inout: tensor accumulator (result)
/** Synchronizes all update operations on a given tensor.
Changing wait to FALSE, only tests for completion. **/
Changing wait to FALSE, only tests for completion.
If ProcessGroup is not provided, defaults to the local process. **/
bool sync(const Tensor & tensor,
bool wait = true);
bool sync(const ProcessGroup & process_group,
......@@ -251,21 +252,24 @@ public:
bool sync(TensorOperation & operation,
bool wait = true);
/** Synchronizes execution of a specific tensor network.
Changing wait to FALSE, only tests for completion. **/
Changing wait to FALSE, only tests for completion.
If ProcessGroup is not provided, defaults to the local process. **/
bool sync(TensorNetwork & network,
bool wait = true);
bool sync(const ProcessGroup & process_group,
TensorNetwork & network,
bool wait = true);
/** Synchronizes execution of all outstanding tensor operations.
Changing wait to FALSE, only tests for completion. **/
Changing wait to FALSE, only tests for completion.
If ProcessGroup is not provided, defaults to the local process. **/
bool sync(bool wait = true);
bool sync(const ProcessGroup & process_group,
bool wait = true);
/** HIGHER-LEVEL WRAPPERS **/
/** Synchronizes all outstanding update operations on a given tensor. **/
/** Synchronizes all outstanding update operations on a given tensor.
If ProcessGroup is not provided, defaults to the local process. **/
bool sync(const std::string & name, //in: tensor name
bool wait = true); //in: wait versus test for completion
bool sync(const ProcessGroup & process_group,
......
......@@ -129,7 +129,7 @@ TEST(NumServerTester, ExamplarExaTN)
z2.reset();
//Synchronize ExaTN server:
exatn::sync();
exatn::sync(all_processes);
exatn::resetRuntimeLoggingLevel(0);
}
#endif
......
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