@@ -97,6 +97,7 @@ \section{Advanced Send/Receive API}
97
97
98
98
\begin {frame }{\texttt {MPI\_ Irecv }}
99
99
Non-Blocking Receive function. Initiates a receive operation that returns immediately.
100
+
100
101
\texttt {int MPI\_ Irecv(void *buf, int count, MPI\_ Datatype datatype, int source, int tag, MPI\_ Comm comm, MPI\_ Request *request); }
101
102
102
103
Parameters:
@@ -150,27 +151,113 @@ \section{Synchronization}
150
151
\section {Collective operations }
151
152
152
153
\begin {frame }{Collective operations}
154
+ Operations involving all processes within a communicator.
155
+
156
+ Characteristics:
157
+ \begin {itemize }
158
+ \item Implicit synchronization among processes.
159
+ \item Cannot be initiated between subsets unless a new communicator is created.
160
+ \end {itemize }
161
+
162
+ Examples:
163
+ \begin {itemize }
164
+ \item Data movement operations (e.g., \texttt {MPI\_ Bcast }, \texttt {MPI\_ Gather }).
165
+ \item Reduction operations (e.g., \texttt {MPI\_ Reduce }, \texttt {MPI\_ Allreduce }).
166
+ \end {itemize }
167
+
168
+ Benefits (why use them instead of send/recv?):
169
+ \begin {itemize }
170
+ \item Optimized for underlying hardware and common user scenarios.
171
+ \item Simplifies code and improves readability.
172
+ \end {itemize }
173
+ \end {frame }
174
+
175
+ \begin {frame }{Broadcast (\texttt {MPI\_ Bcast })}
176
+ Send data from one process to all other processes.
177
+
178
+ \texttt {int MPI\_ Bcast(void *buffer, int count, MPI\_ Datatype datatype, int root, MPI\_ Comm comm); }
179
+
180
+ Parameters:
181
+ \begin {itemize }
182
+ \item buffer: Starting address of buffer.
183
+ \item count: Number of entries in buffer.
184
+ \item datatype: Data type of buffer elements.
185
+ \item root: Rank of broadcast root.
186
+ \item comm: Communicator.
187
+ \end {itemize }
153
188
\end {frame }
154
189
155
- \begin {frame }{Broadcast}
190
+ \begin {frame }{Reduction}
191
+ Perform a global reduction operation (e.g., sum, max) across all processes. Calculate the total sum of values distributed across processes.
192
+
193
+ Can be seen as the opposite operation to broadcast.
194
+
195
+ \texttt {int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); }
196
+
197
+ Supported operations:
198
+ \begin {itemize }
199
+ \item \texttt {MPI\_ SUM }
200
+ \item \texttt {MPI\_ PROD }
201
+ \item \texttt {MPI\_ MAX }
202
+ \item \texttt {MPI\_ MIN }
203
+ \end {itemize }
156
204
\end {frame }
157
205
158
206
\begin {frame }{\texttt {MPI\_ Gather }}
207
+ Collect data from all processes to a single root process.
208
+
209
+ \texttt {int MPI\_ Gather(const void *sendbuf, int sendcount, MPI\_ Datatype sendtype, void *recvbuf, int recvcount, MPI\_ Datatype recvtype, int root, MPI\_ Comm comm); }
210
+
211
+ Parameters:
212
+ \begin {itemize }
213
+ \item sendbuf: Starting address of send buffer.
214
+ \item recvbuf: Starting address of receive buffer (significant only at root).
215
+ \end {itemize }
159
216
\end {frame }
160
217
161
218
\begin {frame }{\texttt {MPI\_ Scatter }}
219
+ Distribute distinct chunks of data from root to all processes.
220
+
221
+ \texttt {int MPI\_ Scatter(const void *sendbuf, int sendcount, MPI\_ Datatype sendtype, void *recvbuf, int recvcount, MPI\_ Datatype recvtype, int root, MPI\_ Comm comm); }
222
+
223
+ Parameters:
224
+ \begin {itemize }
225
+ \item \texttt {sendbuf }: Starting address of send buffer (significant only at root).
226
+ \item \texttt {recvbuf }: Starting address of receive buffer.
227
+ \end {itemize }
162
228
\end {frame }
163
229
164
230
\begin {frame }{\texttt {MPI\_ AllGather }}
165
- \end {frame }
231
+ Gather data from all processes and distributes the combined data to all processes.
232
+
233
+ \texttt {int MPI\_ Allgather(const void *sendbuf, int sendcount, MPI\_ Datatype sendtype, void *recvbuf, int recvcount, MPI\_ Datatype recvtype, MPI\_ Comm comm); }
166
234
167
- \begin { frame }{All-to-All}
235
+ Usage of this function reduces the need for separate gather and broadcast operations.
168
236
\end {frame }
169
237
170
- \begin {frame }{Reduction}
238
+ \begin {frame }{All-to-All (\texttt {MPI\_ Alltoall })}
239
+ Description: Each process sends data to and receives data from all other processes. It can be seen as transposing a matrix distributed across processes.
240
+
241
+ \texttt {int MPI\_ Alltoall(const void *sendbuf, int sendcount, MPI\_ Datatype sendtype, void *recvbuf, int recvcount, MPI\_ Datatype recvtype, MPI\_ Comm comm); }
242
+
243
+ Note: This operation is communication-intensive.
171
244
\end {frame }
172
245
173
246
\begin {frame }{All API have not blocking versions}
247
+ Non-Blocking collectives operations allow overlapping communication with computation.
248
+
249
+ Examples:
250
+ \begin {itemize }
251
+ \item \texttt {MPI\_ Ibcast }: Non-blocking broadcast.
252
+ \item \texttt {MPI\_ Ireduce }: Non-blocking reduction.
253
+ \item \texttt {MPI\_ Iallgather }: Non-blocking all-gather.
254
+ \end {itemize }
255
+
256
+ \texttt {int MPI\_ Ibcast(void *buffer, int count, MPI\_ Datatype datatype, int root, MPI\_ Comm comm, MPI\_ Request *request); }
257
+
258
+ \texttt {int MPI\_ Ireduce(const void *sendbuf, void *recvbuf, int count, MPI\_ Datatype datatype, MPI\_ Op op, int root, MPI\_ Comm comm, MPI\_ Request *request); }
259
+
260
+ Usage flow is the same as for \texttt {MPI\_ Isend }/\texttt {MPI\_ Irecv }: Initiate the operation and later wait for its completion using \texttt {MPI\_ Wait } or \texttt {MPI\_ Test }.
174
261
\end {frame }
175
262
176
263
\begin {frame }
@@ -179,6 +266,10 @@ \section{Collective operations}
179
266
\end {frame }
180
267
181
268
\begin {frame }{References}
269
+ \begin {enumerate }
270
+ \item MPI Standard \href {https://www.mpi-forum.org/docs/}{https://www.mpi-forum.org/docs/}
271
+ \item Open MPI v4.0.7 documentation: \href {https://www.open-mpi.org/doc/v4.0/}{https://www.open-mpi.org/doc/v4.0/}
272
+ \end {enumerate }
182
273
\end {frame }
183
274
184
275
\end {document }
0 commit comments