Peano
Loading...
Searching...
No Matches
TreeEntry.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 TreeEntry;
24}
25}
26
28 public:
30 TreeEntry(int __id, int __master);
31
32 int getId() const;
33 void setId(int value);
34 int getMaster() const;
35 void setMaster(int value);
36 TreeEntry(const TreeEntry& copy) = default;
37
38
39 #ifdef Parallel
45 [[clang::map_mpi_datatype]]
46 static MPI_Datatype getForkDatatype();
47
48 [[clang::map_mpi_datatype]]
49 static MPI_Datatype getJoinDatatype();
50
51 [[clang::map_mpi_datatype]]
52 static MPI_Datatype getBoundaryExchangeDatatype();
53
54 [[clang::map_mpi_datatype]]
55 static MPI_Datatype getMultiscaleDataExchangeDatatype();
56
57 [[clang::map_mpi_datatype]]
58 static MPI_Datatype getGlobalCommunciationDatatype();
59
60 [[clang::map_mpi_datatype]]
61 static void freeForkDatatype();
62
63 [[clang::map_mpi_datatype]]
64 static void freeJoinDatatype();
65
66 [[clang::map_mpi_datatype]]
67 static void freeBoundaryExchangeDatatype();
68
69 [[clang::map_mpi_datatype]]
71
72 [[clang::map_mpi_datatype]]
74
79 int getSenderRank() const;
80
85 static void initDatatype();
86
90 static void shutdownDatatype();
91
100 static void send(const peano4::parallel::TreeEntry& buffer, int destination, int tag, MPI_Comm communicator );
101 static void receive(peano4::parallel::TreeEntry& buffer, int source, int tag, MPI_Comm communicator );
102
109 static void send(const peano4::parallel::TreeEntry& buffer, int destination, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
110 static void receive( peano4::parallel::TreeEntry& buffer, int source, int tag, std::function<void()> startCommunicationFunctor, std::function<void()> waitFunctor, MPI_Comm communicator );
111 #endif
112
113
117
120
121#ifdef Parallel
122 static void sendAndPollDanglingMessages(const peano4::parallel::TreeEntry& message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator());
123 static void receiveAndPollDanglingMessages(peano4::parallel::TreeEntry& message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator() );
124#endif
125
126
127 std::string toString() const;
128
129 private:
130 [[clang::pack_range(0,std::numeric_limits<int>::max())]] int _id;
131 [[clang::pack_range(-1,std::numeric_limits<int>::max())]] int _master;
132
133 #ifdef Parallel
134 private:
136
137 #if !defined(__MPI_ATTRIBUTES_LANGUAGE_EXTENSION__)
144 static MPI_Datatype Datatype;
145 #endif
146 #endif
147};
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 freeBoundaryExchangeDatatype()
static MPI_Datatype getForkDatatype()
Hands out MPI datatype if we work without the LLVM MPI extension.
Definition TreeEntry.cpp:63
TreeEntry(const TreeEntry &copy)=default
static void initDatatype()
Wrapper around getDatatype() to trigger lazy evaluation if we use the lazy initialisation.
static void sendAndPollDanglingMessages(const peano4::parallel::TreeEntry &message, int destination, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
static MPI_Datatype getGlobalCommunciationDatatype()
Definition TreeEntry.cpp:69
static void receiveAndPollDanglingMessages(peano4::parallel::TreeEntry &message, int source, int tag, MPI_Comm communicator=tarch::mpi::Rank::getInstance().getCommunicator())
static void freeMultiscaleDataExchangeDatatype()
static void shutdownDatatype()
Free the underlying MPI datatype.
std::string toString() const
Definition TreeEntry.cpp:17
void setMaster(int value)
Definition TreeEntry.cpp:46
static MPI_Datatype getBoundaryExchangeDatatype()
Definition TreeEntry.cpp:81
static MPI_Datatype getMultiscaleDataExchangeDatatype()
Definition TreeEntry.cpp:87
TreeEntry(ObjectConstruction)
Definition TreeEntry.h:118
static void freeForkDatatype()
Definition TreeEntry.cpp:93
static void send(const peano4::parallel::TreeEntry &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 MPI_Datatype Datatype
Whenever we use LLVM's MPI extension (DaStGe), we rely on lazy initialisation of the datatype.
Definition TreeEntry.h:144
static MPI_Datatype getJoinDatatype()
Definition TreeEntry.cpp:75
static void receive(peano4::parallel::TreeEntry &buffer, int source, int tag, MPI_Comm communicator)
static void freeGlobalCommunciationDatatype()