Peano
Loading...
Searching...
No Matches
StartTraversalMessage.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <string>
6
7#ifdef Parallel
8 #include <mpi.h>
9 #include <functional>
10#endif
11
12#include "tarch/la/Vector.h"
13#include "tarch/mpi/Rank.h"
18
19
20
21namespace peano4{
22namespace parallel{
23 struct StartTraversalMessage;
24}
25}
26
28 public:
30 StartTraversalMessage(int __stepIdentifier);
31
32 int getStepIdentifier() const;
33 void setStepIdentifier(int value);
35
36
37 #ifdef Parallel
43 [[clang::map_mpi_datatype]]
44 static MPI_Datatype getForkDatatype();
45
46 [[clang::map_mpi_datatype]]
47 static MPI_Datatype getJoinDatatype();
48
49 [[clang::map_mpi_datatype]]
50 static MPI_Datatype getBoundaryExchangeDatatype();
51
52 [[clang::map_mpi_datatype]]
53 static MPI_Datatype getMultiscaleDataExchangeDatatype();
54
55 [[clang::map_mpi_datatype]]
56 static MPI_Datatype getGlobalCommunciationDatatype();
57
58 [[clang::map_mpi_datatype]]
59 static void freeForkDatatype();
60
61 [[clang::map_mpi_datatype]]
62 static void freeJoinDatatype();
63
64 [[clang::map_mpi_datatype]]
65 static void freeBoundaryExchangeDatatype();
66
67 [[clang::map_mpi_datatype]]
69
70 [[clang::map_mpi_datatype]]
72
77 int getSenderRank() const;
78
83 static void initDatatype();
84
88 static void shutdownDatatype();
89
98 static void send(const peano4::parallel::StartTraversalMessage& buffer, int destination, int tag, MPI_Comm communicator );
99 static void receive(peano4::parallel::StartTraversalMessage& buffer, int source, int tag, MPI_Comm communicator );
100
107 static void send(const peano4::parallel::StartTraversalMessage& buffer, int destination, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
108 static void receive( peano4::parallel::StartTraversalMessage& buffer, int source, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
109 #endif
110
111
115
118
119#ifdef Parallel
120 static void sendAndPollDanglingMessages(const peano4::parallel::StartTraversalMessage& message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator());
121 static void receiveAndPollDanglingMessages(peano4::parallel::StartTraversalMessage& message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator() );
122#endif
123
124
125 std::string toString() const;
126
127 private:
128 [[clang::pack_range(0,std::numeric_limits<int>::max())]] int _stepIdentifier;
129
130 #ifdef Parallel
131 private:
133
134 #if !defined(__MPI_ATTRIBUTES_LANGUAGE_EXTENSION__)
141 static MPI_Datatype Datatype;
142 #endif
143 #endif
144};
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:539
The parallel namespace is Peano's core abstracts from both MPI and multicore parallelisation.
static void receiveAndPollDanglingMessages(peano4::parallel::StartTraversalMessage &message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
static void sendAndPollDanglingMessages(const peano4::parallel::StartTraversalMessage &message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
static void shutdownDatatype()
Free the underlying MPI datatype.
StartTraversalMessage(const StartTraversalMessage &copy)=default
static void send(const peano4::parallel::StartTraversalMessage &buffer, int destination, int tag, MPI_Comm communicator)
In DaStGen (the first version), I had a non-static version of the send as well as the receive.
static void initDatatype()
Wrapper around getDatatype() to trigger lazy evaluation if we use the lazy initialisation.
static void receive(peano4::parallel::StartTraversalMessage &buffer, int source, int tag, MPI_Comm communicator)
static MPI_Datatype Datatype
Whenever we use LLVM's MPI extension (DaStGe), we rely on lazy initialisation of the datatype.
static MPI_Datatype getForkDatatype()
Hands out MPI datatype if we work without the LLVM MPI extension.