Samchon Framework for CPP
1.0.0
|
#include <ParallelSystem.hpp>
Public Member Functions | |
virtual | ~ParallelSystem () |
virtual void | construct (std::shared_ptr< library::XML > xml) override |
Construct data of the Entity from an XML object. More... | |
auto | getPerformance () const -> double |
void | setPerformance (double val) |
void | enforcePerformance (double val) |
virtual auto | toXML () const -> std::shared_ptr< library::XML > override |
Get an XML object represents the EntityGroup. More... | |
Public Member Functions inherited from samchon::templates::external::ExternalSystem | |
ExternalSystem () | |
ExternalSystem (base::ExternalSystemArrayBase *systemArray) | |
ExternalSystem (base::ExternalSystemArrayBase *systemArray, std::shared_ptr< protocol::ClientDriver > driver) | |
virtual | ~ExternalSystem ()=default |
virtual auto | key () const -> std::string |
auto | getName () const -> std::string |
void | close () |
virtual void | sendData (std::shared_ptr< protocol::Invoke > invoke) override |
virtual void | replyData (std::shared_ptr< protocol::Invoke > invoke) override |
virtual auto | CHILD_TAG () const -> std::string override |
A tag name of children. More... | |
Public Member Functions inherited from samchon::protocol::EntityGroup< Container, T, Key > | |
auto | find (const typename child_type::key_type &key) -> typename container_type::iterator |
Get iterator to element. More... | |
auto | find (const typename child_type::key_type &key) const -> typename container_type::const_iterator |
Get const iterator to element. More... | |
auto | has (const typename child_type::key_type &key) const -> bool |
Indicates whether a container has an object having the specified identifier. More... | |
auto | count (const typename child_type::key_type &key) const -> size_t |
Count elements with a specific key. More... | |
auto | get (const typename child_type::key_type &key) -> typename container_type::value_type & |
Access the element by specified identifier(key). More... | |
auto | get (const typename child_type::key_type &key) const -> const typename container_type::value_type & |
Access the const element by specified identifier(key). More... | |
Public Member Functions inherited from samchon::protocol::IProtocol | |
virtual void | replyData (std::shared_ptr< Invoke >)=0 |
virtual void | sendData (std::shared_ptr< Invoke >)=0 |
Additional Inherited Members | |
Protected Member Functions inherited from samchon::protocol::EntityGroup< Container, T, Key > | |
virtual auto | createChild (std::shared_ptr< library::XML >) -> child_type *=0 |
Factory method of a child Entity. More... | |
Protected Attributes inherited from samchon::templates::external::ExternalSystem | |
std::string | name |
A driver for a parallel slave system.
The ParallelSystem is an abstract class represents a slave system in Parallel Processing System, connected with this master system. This ParallelSystem takes full charge of network communication with the remote, parallel slave system has connected.
When a parallel process is requested (by ParallelSystemArray.sendSegementData or ParallelSystemArray.sendPieceData), the number of pieces to be allocated to a ParallelSystem is turn on its performance index. Higher performance index, then more pieces are requested. The performance index is revaluated whenever a parallel process has completed, basic on the execution time and number of pieces. You can sugguest or enforce the performance index with setPerformance or enforcePerformance.
This class ParallelSystem is derived from the ExternalSystem class. Thus, you can take advantage of the Bridge & Proxy Pattern in this ParallelSystem class. If a process to request is not the parallel process (to be distrubted to all slaves), but the exclusive process handled in a system, then it may better to utilizing the Bridge & Proxy Pattern:
The ExternalSystem class can be a bridge for logical proxy. In framework within user, which external system is connected with this system, it's not important. Only interested in user's perspective is which can be done.
By using the logical proxy, user dont't need to know which role is belonged to which system. Just access to a role directly from ExternalSystemArray.getRole. Sends and receives Invoke message via the role.
Definition at line 58 of file ParallelSystem.hpp.
|
inlinevirtual |
Default Destructor.
The ParallelSystem object is destructed when connection with the remote system is closed or this ParallelSystem object is erased from its parent ParallelSystemArray object.
You may think if there're some parallel processes have requested but not completed yet, then it would be a critical problem because the parallel processes will not complete forever. Do not worry. The critical problem does not happen. After the destruction, the remained parallel processes will be shifted to and proceeded in other ParallelSystem objects.
Definition at line 91 of file ParallelSystem.hpp.
|
inlineoverridevirtual |
Construct data of the Entity from an XML object.
Constructs the EntityGroup's own member variables only from the input XML object.
Do not consider about constructing children Entity objects' data in EntityGroup::construct(). Those children Entity objects' data will constructed by their own construct() method. Even insertion of XML objects representing children are done by abstract method of EntityGroup::toXML().
Constructs only data of EntityGroup's own.
Reimplemented from samchon::templates::external::ExternalSystem.
Definition at line 107 of file ParallelSystem.hpp.
References samchon::templates::external::ExternalSystem::construct().
|
inline |
Get performance index.
Get performance index that indicates how much fast the remote system is.
If this parallel system does not have any Invoke message had handled, then the performance index will be 1.0
, which means default and average value between all ParallelSystem instances (that are belonged to a same ParallelSystemArray object).
You can specify this performance index by yourself but notice that, if the performance index is higher than other ParallelSystem objects, then this parallel system will be ordered to handle more processes than other ParallelSystem objects. Otherwise, the performance index is lower than others, of course, less processes will be delivered.
Unless enforcePerformance() is called, This performance index is revaluated whenever user calls one of them below.
Definition at line 144 of file ParallelSystem.hpp.
Referenced by samchon::templates::distributed::DistributedSystemArray< MasterSystem >::construct().
|
inline |
Set performance index.
Set performance index that indicates how much fast the remote system is. This performance index can be revaulated.
Note that, initial and average performance index of ParallelSystem objects are 1.0
. If the performance index is higher than other ParallelSystem objects, then this ParallelSystem will be ordered to handle more processes than other ParallelSystem objects. Otherwise, the performance index is lower than others, of course, less processes will be delivered.
Unlike enforcePerformance, configuring performance index by this setPerformance allows revaluation. This revaluation prevents wrong valuation from user. For example, you mis-valuated the performance index. The remote system is much faster than any other, but you estimated it to the slowest one. It looks like a terrible case that causes entire parallel systems to be slower, however, don't mind. The system will direct to the propriate performance index eventually with the revaluation by following methods.
val | New performance index, but can be revaluated. |
Definition at line 173 of file ParallelSystem.hpp.
Referenced by samchon::templates::distributed::DistributedSystemArray< MasterSystem >::construct().
|
inline |
Enforce performance index.
Enforce performance index that indicates how much fast the remote system is. The performance index will be fixed, never be revaluated.
Note that, initial and average performance index of ParallelSystem objects are 1.0
. If the performance index is higher than other ParallelSystem objects, then this ParallelSystem will be ordered to handle more processes than other ParallelSystem objects. Otherwise, the performance index is lower than others, of course, less processes will be delivered.
The difference between setPerformance and this enforcePerformance is allowing revaluation or not. This enforcePerformance does not allow the revaluation. The performance index is clearly fixed and never be changed by the revaluation. But you've to keep in mind that, you can't avoid the mis-valuation with this enforcePerformance.
For example, there's a remote system much faster than any other, but you mis-estimated it to the slowest. In that case, there's no way. The entire parallel systems will be slower by the mis-valuation. By the reason, using enforcePerformance, it's recommended only when you can clearly certain the performance index. If you can't certain the performance index but want to recommend, then use setPerformance instead.
val | New performance index to be fixed. |
Definition at line 203 of file ParallelSystem.hpp.
References samchon::templates::external::ExternalSystem::name, and samchon::templates::external::ExternalSystem::replyData().
|
inlineoverridevirtual |
Get an XML object represents the EntityGroup.
Archives the EntityGroup's own member variables only to the returned XML object.
Do not consider about archiving children Entity objects' data in EntityGroup::toXML(). Those children Entity objects will converted to XML object by their own toXML() method. The insertion of XML objects representing children are done by abstract method of EntityGroup::toXML().
Archives only data of EntityGroup's own.
Reimplemented from samchon::templates::external::ExternalSystem.
Definition at line 286 of file ParallelSystem.hpp.
References samchon::templates::external::ExternalSystem::toXML().