Commit 3af022f3 authored by Berenger Bramas's avatar Berenger Bramas
Browse files

Debug -- add default value for cutoff and options -- use different tag values...

Debug -- add default value for cutoff and options -- use different tag values to be idle if missmatch
parent 56b77c03
Pipeline #20244 passed with stage
in 10 minutes and 11 seconds
...@@ -73,7 +73,7 @@ class NSVEparticlesP2P: public NSVE<rnumber> ...@@ -73,7 +73,7 @@ class NSVEparticlesP2P: public NSVE<rnumber>
NSVE<rnumber>( NSVE<rnumber>(
COMMUNICATOR, COMMUNICATOR,
simulation_name), simulation_name),
cutoff(std::numeric_limits<double>::max()){} cutoff(10), inner_v0(1), enable_p2p(true), enable_inner(true), enable_vorticity_omega(true){}
~NSVEparticlesP2P(){} ~NSVEparticlesP2P(){}
int initialize(void); int initialize(void);
......
...@@ -32,7 +32,6 @@ protected: ...@@ -32,7 +32,6 @@ protected:
int destProc; int destProc;
int nbLevelsToExchange; int nbLevelsToExchange;
bool isRecv; bool isRecv;
bool positionsReceived;
std::unique_ptr<real_number[]> toRecvAndMerge; std::unique_ptr<real_number[]> toRecvAndMerge;
std::unique_ptr<real_number[]> toCompute; std::unique_ptr<real_number[]> toCompute;
...@@ -40,17 +39,11 @@ protected: ...@@ -40,17 +39,11 @@ protected:
}; };
enum Action{ enum Action{
NOTHING_TODO, NOTHING_TODO = 512,
RECV_PARTICLES, RECV_PARTICLES,
COMPUTE_PARTICLES, COMPUTE_PARTICLES,
CHECK_PARTICLES,
RELEASE_BUFFER_PARTICLES, RELEASE_BUFFER_PARTICLES,
MERGE_PARTICLES, MERGE_PARTICLES
RECV_MOVE_NB_LOW,
RECV_MOVE_NB_UP,
RECV_MOVE_LOW,
RECV_MOVE_UP
}; };
MPI_Comm current_com; MPI_Comm current_com;
...@@ -392,7 +385,6 @@ public: ...@@ -392,7 +385,6 @@ public:
descriptor.nbLevelsToExchange = nb_levels_to_send; descriptor.nbLevelsToExchange = nb_levels_to_send;
descriptor.nbParticlesToExchange = particles_offset_layers[my_nb_cell_levels] - particles_offset_layers[my_nb_cell_levels-nb_levels_to_send]; descriptor.nbParticlesToExchange = particles_offset_layers[my_nb_cell_levels] - particles_offset_layers[my_nb_cell_levels-nb_levels_to_send];
descriptor.isRecv = false; descriptor.isRecv = false;
descriptor.positionsReceived = false;
neigDescriptors.emplace_back(std::move(descriptor)); neigDescriptors.emplace_back(std::move(descriptor));
...@@ -415,7 +407,6 @@ public: ...@@ -415,7 +407,6 @@ public:
descriptor.nbLevelsToExchange = nb_levels_to_recv; descriptor.nbLevelsToExchange = nb_levels_to_recv;
descriptor.nbParticlesToExchange = -1; descriptor.nbParticlesToExchange = -1;
descriptor.isRecv = true; descriptor.isRecv = true;
descriptor.positionsReceived = false;
neigDescriptors.emplace_back(std::move(descriptor)); neigDescriptors.emplace_back(std::move(descriptor));
...@@ -507,7 +498,7 @@ public: ...@@ -507,7 +498,7 @@ public:
if(NbParticlesToReceive){ if(NbParticlesToReceive){
descriptor.toCompute.reset(new real_number[NbParticlesToReceive*size_particle_positions]); descriptor.toCompute.reset(new real_number[NbParticlesToReceive*size_particle_positions]);
whatNext.emplace_back(std::pair<Action,int>{CHECK_PARTICLES, releasedAction.second}); whatNext.emplace_back(std::pair<Action,int>{COMPUTE_PARTICLES, releasedAction.second});
mpiRequests.emplace_back(); mpiRequests.emplace_back();
assert(NbParticlesToReceive*size_particle_positions < std::numeric_limits<int>::max()); assert(NbParticlesToReceive*size_particle_positions < std::numeric_limits<int>::max());
AssertMpi(MPI_Irecv(descriptor.toCompute.get(), int(NbParticlesToReceive*size_particle_positions), AssertMpi(MPI_Irecv(descriptor.toCompute.get(), int(NbParticlesToReceive*size_particle_positions),
...@@ -526,7 +517,6 @@ public: ...@@ -526,7 +517,6 @@ public:
const partsize_t NbParticlesToReceive = descriptor.nbParticlesToExchange; const partsize_t NbParticlesToReceive = descriptor.nbParticlesToExchange;
assert(descriptor.toCompute != nullptr); assert(descriptor.toCompute != nullptr);
assert(descriptor.positionsReceived == true);
descriptor.results.reset(new real_number[NbParticlesToReceive*size_particle_rhs]); descriptor.results.reset(new real_number[NbParticlesToReceive*size_particle_rhs]);
in_computer.template init_result_array<size_particle_rhs>(descriptor.results.get(), NbParticlesToReceive); in_computer.template init_result_array<size_particle_rhs>(descriptor.results.get(), NbParticlesToReceive);
...@@ -594,24 +584,16 @@ public: ...@@ -594,24 +584,16 @@ public:
AssertMpi(MPI_Isend(descriptor.results.get(), int(NbParticlesToReceive*size_particle_rhs), AssertMpi(MPI_Isend(descriptor.results.get(), int(NbParticlesToReceive*size_particle_rhs),
particles_utils::GetMpiType(real_number()), destProc, TAG_RESULT_PARTICLES, particles_utils::GetMpiType(real_number()), destProc, TAG_RESULT_PARTICLES,
current_com, &mpiRequests.back())); current_com, &mpiRequests.back()));
descriptor.toCompute.release();
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/// Computation /// Release memory that was sent back
//////////////////////////////////////////////////////////////////////
if(releasedAction.first == CHECK_PARTICLES){
NeighborDescriptor& descriptor = neigDescriptors[releasedAction.second];
assert(descriptor.toCompute != nullptr);
assert(descriptor.isRecv);
descriptor.positionsReceived = true;
}
//////////////////////////////////////////////////////////////////////
/// Computation
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
if(releasedAction.first == RELEASE_BUFFER_PARTICLES){ if(releasedAction.first == RELEASE_BUFFER_PARTICLES){
NeighborDescriptor& descriptor = neigDescriptors[releasedAction.second]; NeighborDescriptor& descriptor = neigDescriptors[releasedAction.second];
assert(descriptor.toCompute != nullptr); assert(descriptor.results != nullptr);
assert(descriptor.isRecv); assert(descriptor.isRecv);
descriptor.toCompute.release(); descriptor.results.release();
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/// Merge /// Merge
......
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