diff --git a/examples/main.c b/examples/main.c index 02ce01776eec309335ad938802428dde9f931f38..532ae973d6c99ddae044862ac12df03efe456edf 100644 --- a/examples/main.c +++ b/examples/main.c @@ -1215,26 +1215,27 @@ int main(int argc, char *argv[]) { #if defined(WITH_MPI) long long N_long[swift_type_count + 1] = {0}; N_long[swift_type_gas] = Ngas; - N_long[swift_type_dark_matter] = - with_gravity ? Ngpart - Ngpart_background - Nbaryons : 0; N_long[swift_type_dark_matter_background] = Ngpart_background; N_long[swift_type_sink] = Nsink; N_long[swift_type_stars] = Nspart; N_long[swift_type_black_hole] = Nbpart; N_long[swift_type_neutrino] = Nnupart; N_long[swift_type_count] = Ngpart; + N_long[swift_type_dark_matter] = + with_gravity ? Ngpart - Ngpart_background - Nbaryons - Nnupart : 0; + MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT, MPI_SUM, MPI_COMM_WORLD); #else N_total[swift_type_gas] = Ngas; - N_total[swift_type_dark_matter] = - with_gravity ? Ngpart - Ngpart_background - Nbaryons : 0; N_total[swift_type_dark_matter_background] = Ngpart_background; N_total[swift_type_sink] = Nsink; N_total[swift_type_stars] = Nspart; N_total[swift_type_black_hole] = Nbpart; N_total[swift_type_neutrino] = Nnupart; N_total[swift_type_count] = Ngpart; + N_total[swift_type_dark_matter] = + with_gravity ? Ngpart - Ngpart_background - Nbaryons - Nnupart : 0; #endif if (myrank == 0) @@ -1431,8 +1432,7 @@ int main(int argc, char *argv[]) { /* Get some info to the user. */ if (myrank == 0) { const long long N_DM = N_total[swift_type_dark_matter] + - N_total[swift_type_dark_matter_background] + - N_total[swift_type_neutrino]; + N_total[swift_type_dark_matter_background]; message( "Running on %lld gas particles, %lld sink particles, %lld stars " "particles %lld black hole particles, %lld neutrino particles, and " diff --git a/examples/main_fof.c b/examples/main_fof.c index a3dcbcc1dea2045bd0b171195412940f4a054c47..3d807da400798b9095ba744a3a307a5367f1cdff 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -652,8 +652,8 @@ int main(int argc, char *argv[]) { /* Get some info to the user. */ if (myrank == 0) { const long long N_DM = N_total[swift_type_dark_matter] + - N_total[swift_type_dark_matter_background] + - N_total[swift_type_neutrino]; + N_total[swift_type_dark_matter_background]; + message( "Running FOF on %lld gas particles, %lld sink particles, %lld stars " "particles %lld black hole particles, %lld neutrino particles, and "