OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
olb::SuperCommunicationTagCoordinator< T > Class Template Reference

Communication-free negotation of unique tags for inter-cuboid communication. More...

#include <superCommunicationTagCoordinator.h>

+ Inheritance diagram for olb::SuperCommunicationTagCoordinator< T >:
+ Collaboration diagram for olb::SuperCommunicationTagCoordinator< T >:

Classes

class  ChannelId
 

Public Member Functions

 SuperCommunicationTagCoordinator (LoadBalancer< T > &loadBalancer)
 
template<unsigned D>
void coordinate (std::vector< std::unique_ptr< BlockCommunicationNeighborhood< T, D > > > &neighborhood)
 Generate unique tags for given block neighborhood system.
 
int get (int iC, int jC, int iGroup=0)
 Returns unique tag for communication between cuboids iC and jC.
 

Detailed Description

template<typename T>
class olb::SuperCommunicationTagCoordinator< T >

Communication-free negotation of unique tags for inter-cuboid communication.

The cuboid IDs themselves can not be used safely as the MPI standard only supports tag sizes up to 32768.

This class provides unique tags for the pair-wise communication of cuboids between their owning ranks, supporting pair-wise neighborhood sizes up to 32768 (depending on number of used groups) and "arbitrarily" large global cuboid counts.

Definition at line 47 of file superCommunicationTagCoordinator.h.

Constructor & Destructor Documentation

◆ SuperCommunicationTagCoordinator()

template<typename T >
olb::SuperCommunicationTagCoordinator< T >::SuperCommunicationTagCoordinator ( LoadBalancer< T > & loadBalancer)

Definition at line 62 of file superCommunicationTagCoordinator.hh.

62 :
63 _loadBalancer(loadBalancer) { }

Member Function Documentation

◆ coordinate()

template<typename T >
template<unsigned D>
void olb::SuperCommunicationTagCoordinator< T >::coordinate ( std::vector< std::unique_ptr< BlockCommunicationNeighborhood< T, D > > > & neighborhood)

Generate unique tags for given block neighborhood system.

Definition at line 67 of file superCommunicationTagCoordinator.hh.

69{
70 for (int iC = 0; iC < _loadBalancer.size(); ++iC) {
71 neighborhood[iC]->forNeighbors([&](int jC) {
72 if (!_loadBalancer.isLocal(jC)) {
73 _tags[_loadBalancer.rank(jC)][{_loadBalancer.glob(iC),jC}] = -1;
74 }
75 });
76 }
77
78 for (auto& [rank, tags] : _tags) {
79 int i=0;
80 for (auto tag=tags.begin(); tag != tags.end(); ++tag, ++i) {
81 (*tag).second = i;
82 }
83 }
84}

◆ get()

template<typename T >
int olb::SuperCommunicationTagCoordinator< T >::get ( int iC,
int jC,
int iGroup = 0 )

Returns unique tag for communication between cuboids iC and jC.

iGroup can be used as a namespace substitute. It simply offsets the tags group-times by the pair-wise neighborhood size, correspondingly reducing said neighborhood's maximum supported size.

Definition at line 87 of file superCommunicationTagCoordinator.hh.

88{
89 if (_loadBalancer.isLocal(iC) && _loadBalancer.isLocal(jC)) {
90 return iGroup*_loadBalancer.size()*_loadBalancer.size()
91 + _loadBalancer.loc(iC)*_loadBalancer.size() + _loadBalancer.loc(jC);
92 } else {
93 int kC = _loadBalancer.isLocal(iC) ? jC : iC;
94 auto& tags = _tags[_loadBalancer.rank(kC)];
95 return iGroup*tags.size() + tags[{iC,jC}];
96 }
97}
+ Here is the caller graph for this function:

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