fpmas 1.6
Public Types | Public Member Functions | List of all members
fpmas::api::graph::DistributedGraph< T > Class Template Referenceabstract

#include <distributed_graph.h>

Inheritance diagram for fpmas::api::graph::DistributedGraph< T >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::api::graph::DistributedGraph< T >:
Collaboration graph
[legend]

Public Types

typedef api::utils::EventCallback< SetLocalNodeEvent< T > > SetLocalNodeCallback
 
typedef api::utils::EventCallback< SetDistantNodeEvent< T > > SetDistantNodeCallback
 
- Public Types inherited from fpmas::api::graph::Graph< DistributedNode< T >, DistributedEdge< T > >
typedef NodeType::IdType NodeIdType
 
typedef EdgeType::IdType EdgeIdType
 
typedef fpmas::api::graph::IdHash< typename NodeType::IdType > NodeIdHash
 
typedef fpmas::api::graph::IdHash< typename EdgeType::IdType > EdgeIdHash
 
typedef std::unordered_map< NodeIdType, DistributedNode< T > *, NodeIdHashNodeMap
 
typedef std::unordered_map< EdgeIdType, DistributedEdge< T > *, EdgeIdHashEdgeMap
 

Public Member Functions

virtual api::communication::MpiCommunicatorgetMpiCommunicator ()=0
 
virtual const api::communication::MpiCommunicatorgetMpiCommunicator () const =0
 
virtual LocationManager< T > & getLocationManager ()=0
 
virtual const LocationManager< T > & getLocationManager () const =0
 
virtual DistributedNode< T > * importNode (DistributedNode< T > *node)=0
 
virtual DistributedEdge< T > * importEdge (DistributedEdge< T > *edge)=0
 
virtual std::unordered_set< DistributedNode< T > * > getUnsyncNodes () const =0
 
virtual DistributedId currentNodeId () const =0
 
virtual void setCurrentNodeId (DistributedId id)=0
 
virtual DistributedId currentEdgeId () const =0
 
virtual void setCurrentEdgeId (DistributedId id)=0
 
virtual DistributedNode< T > * buildNode (T &&data)=0
 
virtual DistributedNode< T > * buildNode (const T &data)=0
 
virtual DistributedNode< T > * insertDistant (DistributedNode< T > *node)=0
 
virtual void removeNode (DistributedNode< T > *node)=0
 
virtual void removeNode (DistributedId id)=0
 
virtual void unlink (DistributedEdge< T > *edge)=0
 
virtual void unlink (DistributedId id)=0
 
virtual DistributedEdge< T > * link (DistributedNode< T > *source, DistributedNode< T > *target, LayerId layer_id)=0
 
virtual void switchLayer (DistributedEdge< T > *edge, LayerId layer_id)=0
 
virtual void addCallOnSetLocal (SetLocalNodeCallback *callback)=0
 
virtual std::vector< SetLocalNodeCallback * > onSetLocalCallbacks () const =0
 
virtual void addCallOnSetDistant (SetDistantNodeCallback *callback)=0
 
virtual std::vector< SetDistantNodeCallback * > onSetDistantCallbacks () const =0
 
virtual void balance (LoadBalancing< T > &lb)=0
 
virtual void balance (LoadBalancing< T > &lb, PartitionMode partition_mode)=0
 
virtual void balance (FixedVerticesLoadBalancing< T > &lb, PartitionMap fixed_vertices)=0
 
virtual void balance (FixedVerticesLoadBalancing< T > &lb, PartitionMap fixed_vertices, PartitionMode partition_mode)=0
 
virtual void distribute (PartitionMap partition)=0
 
virtual void synchronize ()=0
 
virtual void synchronize (std::unordered_set< DistributedNode< T > * > nodes, bool synchronize_links=true)=0
 
virtual synchro::SyncMode< T > & synchronizationMode ()=0
 
- Public Member Functions inherited from fpmas::api::graph::Graph< DistributedNode< T >, DistributedEdge< T > >
virtual void insert (DistributedNode< T > *node)=0
 
virtual void insert (DistributedEdge< T > *edge)=0
 
virtual void erase (DistributedNode< T > *node)=0
 
virtual void erase (DistributedEdge< T > *edge)=0
 
virtual void addCallOnInsertNode (api::utils::Callback< DistributedNode< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedNode< T > * > * > onInsertNodeCallbacks () const=0
 
virtual void addCallOnEraseNode (api::utils::Callback< DistributedNode< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedNode< T > * > * > onEraseNodeCallbacks () const=0
 
virtual void addCallOnInsertEdge (api::utils::Callback< DistributedEdge< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedEdge< T > * > * > onInsertEdgeCallbacks () const=0
 
virtual void addCallOnEraseEdge (api::utils::Callback< DistributedEdge< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedEdge< T > * > * > onEraseEdgeCallbacks () const=0
 
virtual DistributedNode< T > * getNode (NodeIdType id)=0
 
virtual const DistributedNode< T > * getNode (NodeIdType id) const=0
 
virtual const NodeMapgetNodes () const=0
 
virtual DistributedEdge< T > * getEdge (EdgeIdType id)=0
 
virtual const DistributedEdge< T > * getEdge (EdgeIdType) const=0
 
virtual const EdgeMapgetEdges () const=0
 
virtual void clear ()=0
 

Detailed Description

template<typename T>
class fpmas::api::graph::DistributedGraph< T >

DistributedGraph API.

The DistributedGraph is an extension of the Graph API, specialized using DistributedNode and DistributedEdge, and introduces some distribution related concepts.

A DistributedGraph is actually a graph distributed across the available MPI processes. The continuity of the graph is ensured thanks to a concept of "distant" nodes representations used to represent the borders of the local graph and allow interactions with nodes located on other processes.

Features are also provided to dynamically distribute and synchronize the graph across processes.

More particularly, the following distant functions are introduced :

Such functions are considered "distant", in the sense that they might involve other processes or at least influence the global state of the graph.

Template Parameters
Tnode data type

Member Typedef Documentation

◆ SetLocalNodeCallback

template<typename T >
typedef api::utils::EventCallback<SetLocalNodeEvent<T> > fpmas::api::graph::DistributedGraph< T >::SetLocalNodeCallback

Callback API to handle SetLocalNodeEvent.

◆ SetDistantNodeCallback

template<typename T >
typedef api::utils::EventCallback<SetDistantNodeEvent<T> > fpmas::api::graph::DistributedGraph< T >::SetDistantNodeCallback

Callback API to handle SetDistantNodeEvent.

Member Function Documentation

◆ getMpiCommunicator() [1/2]

template<typename T >
virtual api::communication::MpiCommunicator & fpmas::api::graph::DistributedGraph< T >::getMpiCommunicator ( )
pure virtual

Reference to the internal MpiCommunicator.

Returns
internal MpiCommunicator

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ getMpiCommunicator() [2/2]

template<typename T >
virtual const api::communication::MpiCommunicator & fpmas::api::graph::DistributedGraph< T >::getMpiCommunicator ( ) const
pure virtual

Reference to the internal MpiCommunicator.

Returns
internal MpiCommunicator

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ getLocationManager() [1/2]

template<typename T >
virtual LocationManager< T > & fpmas::api::graph::DistributedGraph< T >::getLocationManager ( )
pure virtual

Reference to the internal LocationManager.

The LocationManager is notably used to easily access the LOCAL and DISTANT nodes in independent sets, thanks to the LocationManager::getLocalNodes() and LocationManager::getDistantNodes() functions.

Returns
internal LocationManager

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ getLocationManager() [2/2]

template<typename T >
virtual const LocationManager< T > & fpmas::api::graph::DistributedGraph< T >::getLocationManager ( ) const
pure virtual

Reference to the internal LocationManager.

The LocationManager is notably used to easily access the LOCAL and DISTANT nodes in independent sets, thanks to the LocationManager::getLocalNodes() and LocationManager::getDistantNodes() functions.

Returns
internal LocationManager

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ importNode()

template<typename T >
virtual DistributedNode< T > * fpmas::api::graph::DistributedGraph< T >::importNode ( DistributedNode< T > *  node)
pure virtual

Imports a DistributedNode into the local graph instance.

When a node is imported into the graph, two main events occur :

  • the node is inserted into the graph, triggering insert node callbacks, as specified in Graph::insert(NodeType*).
  • the node becomes *LOCAL* to this graph, replacing an eventual outdated *DISTANT* representation of this node.

Finally, the inserted node is returned.

Parameters
nodenode to import
Returns
inserted node

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ importEdge()

template<typename T >
virtual DistributedEdge< T > * fpmas::api::graph::DistributedGraph< T >::importEdge ( DistributedEdge< T > *  edge)
pure virtual

Imports a DistributedEdge into the local graph instance.

The DistributedEdge must comply with the following requirements:

  • dynamically allocated
  • defined getTempSourceNode() and getTempTargetNode()

Moreover, at least the source or the target node of the imported edge must represent a LOCAL node (since edges between two DISTANT nodes are not represented in a DistributedGraph anyway).

Several situations might then occur :

When source or target is DISTANT, the corresponding node might already be represented in the local graph instance. In that case, the imported edge is linked to the existing representation, and the corresponding TemporaryNode is discarded (without a call to the TemporaryNode::build() method).

Else, if no DISTANT representation of the node is available, a DISTANT representation is created into the local graph instance and the edge is linked to this new DISTANT node, built using the TemporaryNode::build() method.

Notice that a DISTANT representation of the imported edge might already exist, notably if the two nodes are LOCAL and at least one of them was imported in the current distribute() operation. In that case, the imported edge can be discarded and the edge already contained in the graph goes LOCAL, without calling insert edge callbacks. Source and target TemporaryNodes are also be discarded.

Parameters
edgeto import
Returns
inserted edge

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ getUnsyncNodes()

template<typename T >
virtual std::unordered_set< DistributedNode< T > * > fpmas::api::graph::DistributedGraph< T >::getUnsyncNodes ( ) const
pure virtual

Returns a buffer containing nodes that have not been synchronized yet using the getDataSync() component.

This set corresponds to nodes that were created while importing an importEdge() or insertDistant() statement.

Nodes are added to the buffer when importEdge() or insertDistant() is called, each node is removed under two conditions:

  1. When its data is synchronized with a call to getDataSync().synchronize() or getDataSync().synchronize(node_set), that are themselves called by synchronize() and synchronize(std::unordered_set nodes).
  2. When it is erased from the graph

Notice that what is called "data synchronization" there is still dependent on the current SyncMode: this does not necessarily mean message exchanges or data import.

Returns
unsynchronized nodes buffer

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ currentNodeId()

template<typename T >
virtual DistributedId fpmas::api::graph::DistributedGraph< T >::currentNodeId ( ) const
pure virtual

Returns the current internal Node ID.

The next node built with buildNode() will have an id equal to currentNodeId()++;

Returns
current Node ID

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ setCurrentNodeId()

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::setCurrentNodeId ( DistributedId  id)
pure virtual

Sets the current internal Node ID to the specified value.

Parameters
idnode id

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ currentEdgeId()

template<typename T >
virtual DistributedId fpmas::api::graph::DistributedGraph< T >::currentEdgeId ( ) const
pure virtual

Returns the current internal Edge ID.

The next edge built with link() will have an id equal to currentEdgeId()++;

Returns
current Edge ID

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ setCurrentEdgeId()

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::setCurrentEdgeId ( DistributedId  id)
pure virtual

Sets the current internal Edge ID to the specified value.

Parameters
idedge id

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ buildNode() [1/2]

template<typename T >
virtual DistributedNode< T > * fpmas::api::graph::DistributedGraph< T >::buildNode ( T &&  data)
pure virtual

Builds a new LOCAL node into the graph.

The specified data is moved into the built node.

The node is inserted into the graph, triggering insert node events as specified in Graph::insert(NodeType*).

Parameters
datanode data
Returns
pointer to built node

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ buildNode() [2/2]

template<typename T >
virtual DistributedNode< T > * fpmas::api::graph::DistributedGraph< T >::buildNode ( const T &  data)
pure virtual

Builds a new LOCAL node into the graph.

The specified data is copied to the built node.

The node is inserted into the graph, triggering insert node events as specified in Graph::insert(NodeType*).

Parameters
datanode data
Returns
pointer to built node

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ insertDistant()

template<typename T >
virtual DistributedNode< T > * fpmas::api::graph::DistributedGraph< T >::insertDistant ( DistributedNode< T > *  node)
pure virtual

Inserts a temporary DISTANT node into the graph.

The node is guaranteed to live at least until the next synchronize() call.

Once inserted, the temporary node can eventually be used as any other DISTANT node, and so can be linked to existing LOCAL and DISTANT nodes or to query data.

However, the DistributedNode::location() must be initialized manually, otherwise operations above might produce unexpected results.

The node must be dynamically allocated, and the DistributedGraph implementation automatically takes its ownership.

If a node with the same ID is already contained in the graph, the node is simply deleted and a pointer to the existing node is returned. Else, a pointer to the inserted node is returned.

This method can notably be used to implement distributed graph initialization algorithms. Indeed, if a node 0 is built on process 0 and node 1 is built on process 1, it is at first glance impossible to create a link from node 0 to node 1.

But, for example knowing that the node 1 is necessarily instanciated on process 1, it is possible to manually insert a DISTANT representation of node 1 using insertDistant() on process 0, what allows to build a link from node 0 to node 1 on process 0. Such link will be committed at the latest at the next synchronize() call and imported on process 1.

Parameters
nodetemporary DISTANT node to manually insert in the graph

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ removeNode() [1/2]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::removeNode ( DistributedNode< T > *  node)
pure virtual

Globally removes the specified node from the graph.

The removed node might be DISTANT or LOCAL. The node is not guaranteed to be effectively removed upon return, since it might be involved in inter-process communications, depending on the synchronization mode.

However, it is guaranteed that upon return of the next synchronize() call, the node (and its connected edges) are completely removed from all the processes.

In any case, Erase node callbacks, as specified in Graph::erase(NodeType*), are called only when the node is effectively erased from the graph.

The node is assumed to belong to the graph, behavior is unspecified otherwise.

Parameters
nodepointer to node to remove

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ removeNode() [2/2]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::removeNode ( DistributedId  id)
pure virtual

Globally removes the node with the specified id from the graph.

Equivalent to

virtual void removeNode(DistributedNode< T > *node)=0
virtual DistributedNode< T > * getNode(NodeIdType id)=0
See also
removeNode(NodeType*)
Parameters
idof the node to remove

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ unlink() [1/2]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::unlink ( DistributedEdge< T > *  edge)
pure virtual

Globally unlinks the specified edge.

The specified edge might be LOCAL or DISTANT.

In consequence the edge is not guaranteed to be effectively unlinked upon return, since it might be involved in inter-process communications, depending on the synchronization mode.

However, it is guaranteed that upon return of the next synchronize() call, the edge is completely removed from all the processes.

In any case, Erase edge callbacks, as specified in Graph::erase(EdgeType*), are called only when the edge is effectively erased from the graph.

Parameters
edgeedge to remove

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ unlink() [2/2]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::unlink ( DistributedId  id)
pure virtual

Globally unlinks the edge with the specified id.

Equivalent to

virtual void unlink(DistributedEdge< T > *edge)=0
virtual DistributedEdge< T > * getEdge(EdgeIdType id)=0
See also
unlink(EdgeType*)
Parameters
idof the edge to unlink

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ link()

template<typename T >
virtual DistributedEdge< T > * fpmas::api::graph::DistributedGraph< T >::link ( DistributedNode< T > *  source,
DistributedNode< T > *  target,
LayerId  layer_id 
)
pure virtual

Links source to target on the specified layer.

The two nodes might be LOCAL, only one of them might be DISTANT, or **both of them might be DISTANT**. In this last case, it is however required that the two DISTANT representations of source and target nodes already exist in the local graph, i.e. each node is already connected to at least one LOCAL node.

In consequence the edge is not guaranteed to be inserted in the graph upon return, since its creation might require inter-process communications, depending on the synchronization mode.

However, it is guaranteed that upon return of the next synchronize() call, the edge is properly inserted in the graphs hosted by the processes that might require it, i.e. the processes that host at least one of its source and target nodes.

In any case, insert edge callbacks, as specified in Graph::insert(EdgeType*), are called only when the edge is effectively inserted into the graph.

Parameters
sourcesource node
targettarget node
layer_idlayer id

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ switchLayer()

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::switchLayer ( DistributedEdge< T > *  edge,
LayerId  layer_id 
)
pure virtual

Switches the edge to the specified layer.

Currently, this operation is only available for LOCAL edges.

The edge is properly re-linked to its source and target node, while the Edge::setLayer() method does not.

Parameters
edgeedge to switch
layer_idnew layer

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ addCallOnSetLocal()

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::addCallOnSetLocal ( SetLocalNodeCallback callback)
pure virtual

Adds a set LOCAL node callback.

A DistributedNode is set LOCAL in the following situations :

Parameters
callbackset local node callback

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ onSetLocalCallbacks()

template<typename T >
virtual std::vector< SetLocalNodeCallback * > fpmas::api::graph::DistributedGraph< T >::onSetLocalCallbacks ( ) const
pure virtual

Current set local callbacks list.

Returns
set local callbacks

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ addCallOnSetDistant()

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::addCallOnSetDistant ( SetDistantNodeCallback callback)
pure virtual

Adds a set DISTANT callback.

A DistributedNode is set DISTANT in the following situations :

  • the node is exported to an other process (i.e. in a distribute() call) AND persist in the graph (i.e. at least one LOCAL node is still connected to this node)
  • the node is created as a missing source or target in the importEdge process
Parameters
callbackset distant node callback

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ onSetDistantCallbacks()

template<typename T >
virtual std::vector< SetDistantNodeCallback * > fpmas::api::graph::DistributedGraph< T >::onSetDistantCallbacks ( ) const
pure virtual

Current set distant callbacks list.

Returns
set distant callbacks

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ balance() [1/4]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::balance ( LoadBalancing< T > &  lb)
pure virtual

◆ balance() [2/4]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::balance ( LoadBalancing< T > &  lb,
PartitionMode  partition_mode 
)
pure virtual

Balances the graph across processors using the specified load balancing algorithm and partitioning strategy.

This function act as a synchronization barrier, so all the process must enter this function to ensure progress.

Parameters
lbload balancing algorithm
partition_modepartitioning strategy

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ balance() [3/4]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::balance ( FixedVerticesLoadBalancing< T > &  lb,
PartitionMap  fixed_vertices 
)
pure virtual

◆ balance() [4/4]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::balance ( FixedVerticesLoadBalancing< T > &  lb,
PartitionMap  fixed_vertices,
PartitionMode  partition_mode 
)
pure virtual

Balances the graph using the specified load balancing algorithm with fixed vertices support.

This function act as a synchronization barrier, so all the process must enter this function to ensure progress.

Parameters
lbload balancing algorithm
fixed_verticesfixed vertices map
partition_modepartitioning strategy

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ distribute()

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::distribute ( PartitionMap  partition)
pure virtual

Distributes the Graph across processors according to the specified partition.

The partition describes nodes to export. In consequence, entries specified for nodes that are not LOCAL to this graph are ignored.

The partition is specified as a {node_id, process_rank} map.

The process then handles node serialization and migrations. Exported nodes becomes DISTANT.

Parameters
partitionexport partition

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ synchronize() [1/2]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::synchronize ( )
pure virtual

Synchronizes the DistributedGraph.

This function acts as a synchronization barrier : all processes blocks until all other perform a synchronize() call.

The synchronization process involves two main steps :

  1. Link and Removed node synchronization (using synchronizationMode().getSyncLinker().synchronize())
  2. Node Data synchronization (using synchronizationMode().getDataSync().synchronize())

Different synchronization modes might define different policies to perform those synchronizations.

In any case, as specified in the corresponding function, it is guaranteed that :

  • links created with link() are committed, i.e. they are properly reported on other processes potentially involved, and added to the local graph if not done yet.
  • links destroyed with unlink() are properly removed from all the processes
  • nodes removed with removeNode() are properly removed from all the processes

Since all nodes are synchronized, the getUnsyncNodes() buffer is cleared.

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ synchronize() [2/2]

template<typename T >
virtual void fpmas::api::graph::DistributedGraph< T >::synchronize ( std::unordered_set< DistributedNode< T > * >  nodes,
bool  synchronize_links = true 
)
pure virtual

Partially synchronizes the graph, as specified in the synchronize() method, except that the synchro::DataSync::synchronize(std::unordered_set<api::graph::DistributedNode<T>*>) method is used with the specified nodes instead.

Links synchronization is regularly performed with synchronizationMode().getSyncLinker().synchronize(), unless synchronize_links is false.

nodes are not required to be contained in getUnsyncNodes(), but are removed from this buffer if they do.

The specified nodes list might contain LOCAL and DISTANT nodes: it is the responsibility of the implemented synchro::DataSync to eventually not do anything with LOCAL nodes.

Parameters
nodesnodes to synchronize
synchronize_linksspecifies if synchro::SyncLinker::synchronize() must be called

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.

◆ synchronizationMode()

template<typename T >
virtual synchro::SyncMode< T > & fpmas::api::graph::DistributedGraph< T >::synchronizationMode ( )
pure virtual

Returns the current synchro::SyncMode instance used to synchronize() the graph.

Directly accessing synchronizationMode().getSyncLinker().synchronize() or synchronizationMode().getDataSync().synchronize() can be used to perform corresponding partial synchronizations (contrary to synchronize()) for performance purpose.

Implemented in fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >, and fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS_SPEC >.


The documentation for this class was generated from the following file: