Skip to content

Commit ca3a7d9

Browse files
authored
Merge pull request #11537 from cniethammer/example-updates
Example updates
2 parents d98b3a4 + 7489de3 commit ca3a7d9

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ processes:
5050

5151
The `Makefile` in this directory will build as many of the examples as
5252
you have language support (e.g., if you do not have the Fortran `use
53-
mpi` bindings compiled as part of Open MPI, the those examples will be
53+
mpi` bindings compiled as part of Open MPI, those examples will be
5454
skipped).
5555

5656
The `Makefile` assumes that the wrapper compilers `mpicc`, `mpic++`, and

examples/connectivity_c.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
* Test the connectivity between all processes.
77
*/
88

9-
#include <errno.h>
109
#include <mpi.h>
11-
#include <netdb.h>
1210
#include <stdio.h>
13-
#include <stdlib.h>
1411
#include <string.h>
15-
#include <unistd.h>
1612

1713
int main(int argc, char **argv)
1814
{

examples/spc_example.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright (c) 2018-2020 The University of Tennessee and The University
33
* of Tennessee Research Foundation. All rights
44
* reserved.
5+
* Copyright (c) 2023 High Performance Computing Center Stuttgart,
6+
* University of Stuttgart. All rights reserved.
57
*
68
* Simple example usage of SPCs through MPI_T.
79
*/
@@ -20,7 +22,6 @@ void message_exchange(int num_messages, int message_size)
2022
int i, rank;
2123
/* Use calloc to initialize data to 0's */
2224
char *data = (char *) calloc(message_size, sizeof(char));
23-
MPI_Status status;
2425

2526
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
2627

@@ -29,7 +30,7 @@ void message_exchange(int num_messages, int message_size)
2930
MPI_Send(data, message_size, MPI_BYTE, 1, 123, MPI_COMM_WORLD);
3031
} else if (rank == 1) {
3132
for (i = 0; i < num_messages; i++)
32-
MPI_Recv(data, message_size, MPI_BYTE, 0, 123, MPI_COMM_WORLD, &status);
33+
MPI_Recv(data, message_size, MPI_BYTE, 0, 123, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
3334
}
3435

3536
free(data);
@@ -91,19 +92,18 @@ int main(int argc, char **argv)
9192
MPI_Abort(MPI_COMM_WORLD, -1);
9293
}
9394

94-
int ret;
9595
long long value;
9696

9797
MPI_T_pvar_session session;
9898
MPI_T_pvar_handle handle;
9999
/* Create the MPI_T sessions/handles for the counters and start the counters */
100-
ret = MPI_T_pvar_session_create(&session);
101-
ret = MPI_T_pvar_handle_alloc(session, index, NULL, &handle, &count);
102-
ret = MPI_T_pvar_start(session, handle);
100+
MPI_T_pvar_session_create(&session);
101+
MPI_T_pvar_handle_alloc(session, index, NULL, &handle, &count);
102+
MPI_T_pvar_start(session, handle);
103103

104104
message_exchange(num_messages, message_size);
105105

106-
ret = MPI_T_pvar_read(session, handle, &value);
106+
MPI_T_pvar_read(session, handle, &value);
107107
/* Print the counter values in order by rank */
108108
for (i = 0; i < 2; i++) {
109109
if (i == rank) {
@@ -113,9 +113,9 @@ int main(int argc, char **argv)
113113
MPI_Barrier(MPI_COMM_WORLD);
114114
}
115115
/* Stop the MPI_T session, free the handle, and then free the session */
116-
ret = MPI_T_pvar_stop(session, handle);
117-
ret = MPI_T_pvar_handle_free(session, &handle);
118-
ret = MPI_T_pvar_session_free(&session);
116+
MPI_T_pvar_stop(session, handle);
117+
MPI_T_pvar_handle_free(session, &handle);
118+
MPI_T_pvar_session_free(&session);
119119

120120
MPI_T_finalize();
121121
MPI_Finalize();

0 commit comments

Comments
 (0)