Skip to content

Commit 6dd5d7d

Browse files
authored
Fix recv count and initialize all variables (#642)
1 parent 16140b1 commit 6dd5d7d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/caliper/aggregate_over_mpi.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ void pack_and_send(int dest, CaliperMetadataAccessInterface& db, Aggregator& agg
8181

8282
size_t receive_and_merge_nodes(int source, CaliperMetadataDB& db, IdMap& idmap, MPI_Comm comm)
8383
{
84-
unsigned count;
84+
unsigned count = 0;
8585

8686
MPI_Recv(&count, 1, MPI_UNSIGNED, source, 1, comm, MPI_STATUS_IGNORE);
8787

8888
MPI_Status status;
89-
int size;
89+
int size = 0;
9090

9191
MPI_Probe(source, 2, comm, &status);
9292
MPI_Get_count(&status, MPI_BYTE, &size);
@@ -110,12 +110,12 @@ size_t receive_and_merge_snapshots(
110110
MPI_Comm comm
111111
)
112112
{
113-
unsigned count;
113+
unsigned count = 0;
114114

115-
MPI_Recv(&count, 3, MPI_UNSIGNED, source, 3, comm, MPI_STATUS_IGNORE);
115+
MPI_Recv(&count, 1, MPI_UNSIGNED, source, 3, comm, MPI_STATUS_IGNORE);
116116

117117
MPI_Status status;
118-
int size;
118+
int size = 0;
119119

120120
MPI_Probe(source, 4, comm, &status);
121121
MPI_Get_count(&status, MPI_BYTE, &size);
@@ -161,8 +161,8 @@ namespace cali
161161

162162
void aggregate_over_mpi(CaliperMetadataDB& metadb, Aggregator& aggr, MPI_Comm comm)
163163
{
164-
int commsize;
165-
int rank;
164+
int commsize = 1;
165+
int rank = 0;
166166

167167
MPI_Comm_size(comm, &commsize);
168168
MPI_Comm_rank(comm, &rank);

0 commit comments

Comments
 (0)