59 data_ =
new DataType[
size];
77 data_ =
new DataType[newSize];
85 void send([[maybe_unused]]
unsigned peerRank)
89 static_cast<int>(mpiDataSize_),
91 static_cast<int>(peerRank),
104 MPI_Wait(&mpiRequest_, &mpiStatus_);
111 void receive([[maybe_unused]]
unsigned peerRank)
115 static_cast<int>(mpiDataSize_),
117 static_cast<int>(peerRank),
130 MPI_Request& request()
131 {
return mpiRequest_; }
137 const MPI_Request& request()
const
138 {
return mpiRequest_; }
146 {
return mpiStatus_; }
152 const MPI_Status& status()
const
153 {
return mpiStatus_; }
160 {
return dataSize_; }
167 assert(i < dataSize_);
176 assert(i < dataSize_);
181 void setMpiDataType_()
185 if (std::is_same<DataType, char>::value)
186 mpiDataType_ = MPI_CHAR;
187 else if (std::is_same<DataType, unsigned char>::value)
188 mpiDataType_ = MPI_UNSIGNED_CHAR;
189 else if (std::is_same<DataType, short>::value)
190 mpiDataType_ = MPI_SHORT;
191 else if (std::is_same<DataType, unsigned short>::value)
192 mpiDataType_ = MPI_UNSIGNED_SHORT;
193 else if (std::is_same<DataType, int>::value)
194 mpiDataType_ = MPI_INT;
195 else if (std::is_same<DataType, unsigned>::value)
196 mpiDataType_ = MPI_UNSIGNED;
197 else if (std::is_same<DataType, long>::value)
198 mpiDataType_ = MPI_LONG;
199 else if (std::is_same<DataType, unsigned long>::value)
200 mpiDataType_ = MPI_UNSIGNED_LONG;
201 else if (std::is_same<DataType, long long>::value)
202 mpiDataType_ = MPI_LONG_LONG;
203 else if (std::is_same<DataType, unsigned long long>::value)
204 mpiDataType_ = MPI_UNSIGNED_LONG_LONG;
205 else if (std::is_same<DataType, float>::value)
206 mpiDataType_ = MPI_FLOAT;
207 else if (std::is_same<DataType, double>::value)
208 mpiDataType_ = MPI_DOUBLE;
209 else if (std::is_same<DataType, long double>::value)
210 mpiDataType_ = MPI_LONG_DOUBLE;
212 mpiDataType_ = MPI_BYTE;
217 void updateMpiDataSize_()
220 mpiDataSize_ = dataSize_;
221 if (mpiDataType_ == MPI_BYTE)
222 mpiDataSize_ *=
sizeof(DataType);
230 MPI_Datatype mpiDataType_;
231 MPI_Request mpiRequest_;
232 MPI_Status mpiStatus_;
void send(unsigned peerRank)
Send the buffer asyncronously to a peer process.
Definition mpibuffer.hh:85