Skip to content

Commit

Permalink
fixup: update global particle count for custom
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Dec 20, 2024
1 parent d3b9119 commit 1a907b1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/CabanaPD_Particles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,7 @@ class Particles<MemorySpace, PMB, TemperatureIndependent, BaseOutput, Dimension>
if ( create_frozen )
frozen_offset = size;

// Not using Allreduce because global count is only used for printing.
auto local_offset_mpi =
static_cast<unsigned long long int>( local_offset );
MPI_Reduce( &local_offset_mpi, &num_global, 1, MPI_UNSIGNED_LONG_LONG,
MPI_SUM, 0, MPI_COMM_WORLD );
updateGlobal();
_init_timer.stop();
}

Expand Down Expand Up @@ -379,6 +375,17 @@ class Particles<MemorySpace, PMB, TemperatureIndependent, BaseOutput, Dimension>
nofail( pid ) = 0;
rho( pid ) = 1.0;
} );

updateGlobal();
}

void updateGlobal()
{
// Not using Allreduce because global count is only used for printing.
auto local_offset_mpi =
static_cast<unsigned long long int>( local_offset );
MPI_Reduce( &local_offset_mpi, &num_global, 1, MPI_UNSIGNED_LONG_LONG,
MPI_SUM, 0, MPI_COMM_WORLD );
}

template <class ExecSpace, class FunctorType>
Expand Down

0 comments on commit 1a907b1

Please sign in to comment.