Commit 8b98d65a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fix typo in the MPI reduction calls in the serial and parallel i/o routines.

parent a61064c2
......@@ -1419,13 +1419,13 @@ void write_output_parallel(struct engine* e, const char* baseName,
Nstars_written, Nblackholes_written};
long long N_total[swift_type_count] = {0};
long long offset[swift_type_count] = {0};
MPI_Exscan(&N, &offset, swift_type_count, MPI_LONG_LONG_INT, MPI_SUM, comm);
MPI_Exscan(N, offset, swift_type_count, MPI_LONG_LONG_INT, MPI_SUM, comm);
for (int ptype = 0; ptype < swift_type_count; ++ptype)
N_total[ptype] = offset[ptype] + N[ptype];
/* The last rank now has the correct N_total. Let's
* broadcast from there */
MPI_Bcast(&N_total, 6, MPI_LONG_LONG_INT, mpi_size - 1, comm);
MPI_Bcast(N_total, 6, MPI_LONG_LONG_INT, mpi_size - 1, comm);
/* Now everybody konws its offset and the total number of
* particles of each type */
......
......@@ -648,7 +648,7 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
/* Now need to broadcast that information to all ranks. */
MPI_Bcast(flag_entropy, 1, MPI_INT, 0, comm);
MPI_Bcast(&N_total, swift_type_count, MPI_LONG_LONG_INT, 0, comm);
MPI_Bcast(N_total, swift_type_count, MPI_LONG_LONG_INT, 0, comm);
MPI_Bcast(dim, 3, MPI_DOUBLE, 0, comm);
MPI_Bcast(ic_units, sizeof(struct unit_system), MPI_BYTE, 0, comm);
......@@ -932,12 +932,12 @@ void write_output_serial(struct engine* e, const char* baseName,
Nstars_written, Nblackholes_written};
long long N_total[swift_type_count] = {0};
long long offset[swift_type_count] = {0};
MPI_Exscan(&N, &offset, swift_type_count, MPI_LONG_LONG_INT, MPI_SUM, comm);
MPI_Exscan(N, offset, swift_type_count, MPI_LONG_LONG_INT, MPI_SUM, comm);
for (int ptype = 0; ptype < swift_type_count; ++ptype)
N_total[ptype] = offset[ptype] + N[ptype];
/* The last rank now has the correct N_total. Let's broadcast from there */
MPI_Bcast(&N_total, 6, MPI_LONG_LONG_INT, mpi_size - 1, comm);
MPI_Bcast(N_total, 6, MPI_LONG_LONG_INT, mpi_size - 1, comm);
/* Now everybody konws its offset and the total number of particles of each
* type */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment