Graybat  1.1
Graph Approach for Highly Generic Communication Schemes Based on Adaptive Topologies
Communication Policy

The communication policy is a class which implements the communication interface of its host class (cage).

Communication in graybat is modeled in the way, that an instance that takes part on whatever communication is called a peer. All peers that want to communicate in some way with each other need to group up in a context. Therefore, a context is a set of peers that are able to communicate with each other.

By communication is meant the exchange of arbitrary data between peers or even within one peer. Thus, communication can mean sending a message over the internet, copying data between two memories, or distributing data with the help of MPI. Therefore, a communication policy need to implement the required interface but can interpret the term communication on its own. See the code example below or consider the preimplemented communication policies.

The communication policy interface is separated into core and collective api. The core api provides the context type definition, the event type definition, point-to-point communication methods and context management methods, while the collective api contains collective communication methods. The communication policy needs to implement at least the core api, the collective api based on the core api can be derived from the communication policy graybat::communicationPolicy::Base class. Thus, it is possible to provide a communication policy implementation that does not implement all interface (core + collective) methods.

The following source code provides a basic skeleton of a communication policy:

namespace graybat {
namespace communicationPolicy {
namespace traits {
template<>
struct ContextType<CommunicationPolicySkeleton> {
using type = ...;
};
template<>
struct EventType<CommunicationPolicySkeleton> {
using type = ...;
};
template<>
struct ConfigType<CommunicationPolicySkeleton> {
using type = ...;
};
}
struct CommunicationPolicySkeleton : public graybat::communicationPolicy::Base<CommunicationPolicySkeleton> {
/*******************************************************************
COMMUNICATION POLICY CONSTRUCTIOn
******************************************************************/
ZMQ(Config const config) {...}
/*******************************************************************
POINT TO POINT COMMUNICATION INTERFACE
******************************************************************/
void send(const VAddr destVAddr, const Tag tag, const Context context, const T_Send& sendData) {...}
Event asyncSend(const VAddr destVAddr, const Tag tag, const Context context, T_Send& sendData) {...}
void recv(const VAddr srcVAddr, const Tag tag, const Context context, T_Recv& recvData) {...}
Event recv(const Context context, T_Recv& recvData) {...}
/*******************************************************************
CONTEXT MANAGEMENT INTERFACE
******************************************************************/
Context splitContext(const bool isMember, const Context oldContext) {...}
Context getGlobalContext(){...}
};
} /* namespace communicationPolicy*/
} /* namespace graybat */

Further Links