Skip to content
Snippets Groups Projects
Commit 354bf527 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

Merge branch 'bugfix/issue38' into bugfix/particle_subsample

parents 46cf3221 27aaae5d
No related branches found
No related tags found
1 merge request!31particle_subsample
...@@ -96,9 +96,9 @@ protected: ...@@ -96,9 +96,9 @@ protected:
std::array<real_number,3> spatial_box_width; std::array<real_number,3> spatial_box_width;
std::array<real_number,3> spatial_box_offset; std::array<real_number,3> spatial_box_offset;
const real_number cutoff_radius_compute; const long double cutoff_radius_compute;
const int nb_cells_factor; const int nb_cells_factor;
const real_number cutoff_radius; const long double cutoff_radius;
std::array<long int,3> nb_cell_levels; std::array<long int,3> nb_cell_levels;
template <class DataType, int sizeElement> template <class DataType, int sizeElement>
...@@ -291,6 +291,7 @@ public: ...@@ -291,6 +291,7 @@ public:
// Some processes might not be involved // Some processes might not be involved
if(nb_processes_involved <= my_rank){ if(nb_processes_involved <= my_rank){
DEBUG_MSG("warning: nb_processes_involved <= my_rank, and this process is exiting p2p_distr_mpi::compute_distr now.\nHowever, there is a check below which calls an MPI_Gather over MPI_COMM_WORLD.\n");
return; return;
} }
...@@ -492,10 +493,14 @@ public: ...@@ -492,10 +493,14 @@ public:
if(descriptor.isRecv == false){ if(descriptor.isRecv == false){
whatNext.emplace_back(std::pair<Action,int>{NOTHING_TODO, -1}); whatNext.emplace_back(std::pair<Action,int>{NOTHING_TODO, -1});
mpiRequests.emplace_back(); mpiRequests.emplace_back();
AssertMpi(MPI_Isend(const_cast<partsize_t*>(&descriptor.nbParticlesToExchange), AssertMpi(MPI_Isend(
1, particles_utils::GetMpiType(partsize_t()), const_cast<partsize_t*>(&descriptor.nbParticlesToExchange),
descriptor.destProc, TAG_NB_PARTICLES, 1,
current_com, &mpiRequests.back())); particles_utils::GetMpiType(partsize_t()),
descriptor.destProc,
TAG_NB_PARTICLES,
current_com,
&mpiRequests.back()));
#ifndef NDEBUG // Just for assertion #ifndef NDEBUG // Just for assertion
willsend[descriptor.destProc] += 1; willsend[descriptor.destProc] += 1;
#endif #endif
...@@ -570,21 +575,42 @@ public: ...@@ -570,21 +575,42 @@ public:
MPI_INT, MPI_INT,
0, 0,
MPI_COMM_WORLD); MPI_COMM_WORLD);
MPI_Gather(willsend.data(), nb_processes_involved, MPI_INT, willsendall.data(), MPI_Gather(willsend.data(),
nb_processes_involved, MPI_INT, 0, MPI_COMM_WORLD); nb_processes_involved,
MPI_INT,
willsendall.data(),
nb_processes_involved,
MPI_INT,
0,
MPI_COMM_WORLD);
for(int idxproc = 0 ; idxproc < nb_processes_involved ; ++idxproc){ for(int idxproc = 0 ; idxproc < nb_processes_involved ; ++idxproc){
for(int idxtest = 0 ; idxtest < nb_processes_involved ; ++idxtest){ for(int idxtest = 0 ; idxtest < nb_processes_involved ; ++idxtest){
DEBUG_MSG("p2p_distr_mpi::compute_distribution, comparing willsendall(%d, %d)=%d with willrecvall(%d, %d) = %d\n",
idxproc, idxtest, willsendall[idxproc*nb_processes_involved + idxtest],
idxtest, idxproc, willrecvall[idxtest*nb_processes_involved + idxproc]);
assert(willsendall[idxproc*nb_processes_involved + idxtest] assert(willsendall[idxproc*nb_processes_involved + idxtest]
== willrecvall[idxtest*nb_processes_involved + idxproc]); == willrecvall[idxtest*nb_processes_involved + idxproc]);
} }
} }
} }
else{ else{
MPI_Gather(willrecv.data(), nb_processes_involved, MPI_INT, nullptr, MPI_Gather(willrecv.data(),
0, MPI_INT, 0, MPI_COMM_WORLD); nb_processes_involved,
MPI_Gather(willsend.data(), nb_processes_involved, MPI_INT, nullptr, MPI_INT,
0, MPI_INT, 0, MPI_COMM_WORLD); nullptr,
0,
MPI_INT,
0,
MPI_COMM_WORLD);
MPI_Gather(willsend.data(),
nb_processes_involved,
MPI_INT,
nullptr,
0,
MPI_INT,
0,
MPI_COMM_WORLD);
} }
} }
#endif #endif
... ...
......
...@@ -400,11 +400,11 @@ std::vector<real_number> BuildLimitsAllProcesses( ...@@ -400,11 +400,11 @@ std::vector<real_number> BuildLimitsAllProcesses(
template <typename partsize_t, typename rnumber, int size_of_particle> template <typename partsize_t, typename rnumber, int size_of_particle>
int set_particle_data_to_zero( int set_particle_data_to_zero(
rnumber __restrict__ *data, rnumber *data, // TODO: this should be "restrict", but intel can't handle it.
const partsize_t numberParticles) const partsize_t numberParticles)
{ {
// TODO: ensure simd. // TODO: ensure simd.
// don't use openmp here, as this function may be called from within openmp parallel regions // don't use openmp here, as this function WILL be called from within openmp parallel regions
std::fill_n( std::fill_n(
data, data,
numberParticles*size_of_particle, numberParticles*size_of_particle,
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment