OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
olb::ConcreteBlockCommunicator< BLOCK > Class Template Referencefinal

#include <blockCommunicator.h>

+ Inheritance diagram for olb::ConcreteBlockCommunicator< BLOCK >:
+ Collaboration diagram for olb::ConcreteBlockCommunicator< BLOCK >:

Classes

class  RecvTask
 Wrapper for a non-blocking block propagation receive request. More...
 
class  SendTask
 Wrapper for a non-blocking block propagation send request. More...
 

Public Member Functions

template<typename T , typename SUPER >
 ConcreteBlockCommunicator (SUPER &super, LoadBalancer< T > &loadBalancer, SuperCommunicationTagCoordinator< T > &tagCoordinator, MPI_Comm comm, int iC, const BlockCommunicationNeighborhood< T, SUPER::d > &neighborhood)
 
void receive () override
 
void send () override
 
void unpack () override
 
void wait () override
 
- Public Member Functions inherited from olb::BlockCommunicator
virtual ~BlockCommunicator ()
 

Detailed Description

template<typename BLOCK>
class olb::ConcreteBlockCommunicator< BLOCK >

Definition at line 62 of file blockCommunicator.h.

Constructor & Destructor Documentation

◆ ConcreteBlockCommunicator()

template<typename BLOCK >
template<typename T , typename SUPER >
olb::ConcreteBlockCommunicator< BLOCK >::ConcreteBlockCommunicator ( SUPER & super,
LoadBalancer< T > & loadBalancer,
SuperCommunicationTagCoordinator< T > & tagCoordinator,
MPI_Comm comm,
int iC,
const BlockCommunicationNeighborhood< T, SUPER::d > & neighborhood )

Definition at line 189 of file blockCommunicator.hh.

197 :
198 _iC(iC)
199#ifdef PARALLEL_MODE_MPI
200, _mpiCommunicator(comm)
201#endif
202{
203#ifdef PARALLEL_MODE_MPI
204 neighborhood.forNeighbors([&](int remoteC) {
205 if (loadBalancer.isLocal(remoteC) && loadBalancer.platform(loadBalancer.loc(remoteC)) == Platform::GPU_CUDA) {
206 if constexpr (std::is_same_v<SUPER, SuperGeometry<T,SUPER::d>>) {
207 if (!neighborhood.getCellsOutboundTo(remoteC).empty()) {
208 _sendTasks.emplace_back(_mpiCommunicator, tagCoordinator.get(loadBalancer.glob(_iC), remoteC),
209 loadBalancer.rank(remoteC),
210 neighborhood.getFieldsCommonWith(remoteC),
211 neighborhood.getCellsOutboundTo(remoteC),
212 super.template getBlock<BLOCK>(_iC));
213 }
214 }
215 if (!neighborhood.getCellsInboundFrom(remoteC).empty()) {
216 _recvTasks.emplace_back(_mpiCommunicator, tagCoordinator.get(remoteC, loadBalancer.glob(_iC)),
217 loadBalancer.rank(remoteC),
218 neighborhood.getFieldsCommonWith(remoteC),
219 neighborhood.getCellsInboundFrom(remoteC),
220 super.template getBlock<BLOCK>(_iC));
221 }
222 } else {
223 if (!neighborhood.getCellsOutboundTo(remoteC).empty()) {
224 _sendTasks.emplace_back(_mpiCommunicator, tagCoordinator.get(loadBalancer.glob(_iC), remoteC),
225 loadBalancer.rank(remoteC),
226 neighborhood.getFieldsCommonWith(remoteC),
227 neighborhood.getCellsOutboundTo(remoteC),
228 super.template getBlock<BLOCK>(_iC));
229 }
230 if (!neighborhood.getCellsInboundFrom(remoteC).empty()) {
231 _recvTasks.emplace_back(_mpiCommunicator, tagCoordinator.get(remoteC, loadBalancer.glob(_iC)),
232 loadBalancer.rank(remoteC),
233 neighborhood.getFieldsCommonWith(remoteC),
234 neighborhood.getCellsInboundFrom(remoteC),
235 super.template getBlock<BLOCK>(_iC));
236 }
237 }
238 });
239
240#else // not using PARALLEL_MODE_MPI
241 neighborhood.forNeighbors([&](int localC) {
242 if (!neighborhood.getCellsInboundFrom(localC).empty()) {
243 _copyTasks.emplace_back(neighborhood.getFieldsCommonWith(localC),
244 neighborhood.getCellsInboundFrom(localC), super.template getBlock<BLOCK>(_iC),
245 neighborhood.getCellsRequestedFrom(localC), super.template getBlock<BLOCK>(loadBalancer.loc(localC)));
246 }
247 });
248#endif
249}
@ GPU_CUDA
Vector CPU (AVX2 / AVX-512 collision)

References olb::BlockCommunicationNeighborhood< T, D >::forNeighbors(), olb::BlockCommunicationNeighborhood< T, D >::getCellsInboundFrom(), olb::BlockCommunicationNeighborhood< T, D >::getCellsOutboundTo(), olb::GPU_CUDA, olb::LoadBalancer< T >::isLocal(), olb::LoadBalancer< T >::loc(), and olb::LoadBalancer< T >::platform().

+ Here is the call graph for this function:

Member Function Documentation

◆ receive()

template<typename BLOCK >
void olb::ConcreteBlockCommunicator< BLOCK >::receive ( )
overridevirtual

Implements olb::BlockCommunicator.

Definition at line 254 of file blockCommunicator.hh.

255{
256 for (auto& task : _recvTasks) {
257 task.receive();
258 }
259}

References olb::ConcreteBlockCommunicator< BLOCK >::receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

template<typename BLOCK >
void olb::ConcreteBlockCommunicator< BLOCK >::send ( )
overridevirtual

Implements olb::BlockCommunicator.

Definition at line 262 of file blockCommunicator.hh.

263{
264 for (auto& task : _sendTasks) {
265 task.send();
266 }
267}

References olb::ConcreteBlockCommunicator< BLOCK >::send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unpack()

template<typename BLOCK >
void olb::ConcreteBlockCommunicator< BLOCK >::unpack ( )
overridevirtual

Implements olb::BlockCommunicator.

Definition at line 270 of file blockCommunicator.hh.

271{
272 std::set<typename RecvTask::ref> pending(_recvTasks.begin(), _recvTasks.end());
273 while (!pending.empty()) {
274 auto task_iterator = pending.begin();
275 while (task_iterator != pending.end()) {
276 auto& task = *task_iterator;
277 if (task->isDone()) {
278 task->unpack();
279 task_iterator = pending.erase(task_iterator);
280 }
281 else {
282 ++task_iterator;
283 }
284 }
285 }
286}

◆ wait()

template<typename BLOCK >
void olb::ConcreteBlockCommunicator< BLOCK >::wait ( )
overridevirtual

Implements olb::BlockCommunicator.

Definition at line 289 of file blockCommunicator.hh.

290{
291 for (auto& task : _sendTasks) {
292 task.wait();
293 }
294}

References olb::ConcreteBlockCommunicator< BLOCK >::wait().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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