diff --git a/cpp/particles/p2p_distr_mpi.hpp b/cpp/particles/p2p_distr_mpi.hpp index 41f68f3ec8a9cab8ca7b1fabd6cf7c87752b0175..e06dc894901f21b98fd8024d39d825adbceefe1f 100644 --- a/cpp/particles/p2p_distr_mpi.hpp +++ b/cpp/particles/p2p_distr_mpi.hpp @@ -277,7 +277,7 @@ public: void compute_distr(computer_class& in_computer, const partsize_t current_my_nb_particles_per_partition[], real_number particles_positions[], - real_number particles_current_rhs[], + std::unique_ptr<real_number[]> particles_current_rhs[], const int nb_rhs, partsize_t inout_index_particles[]){ TIMEZONE("compute_distr"); @@ -341,12 +341,14 @@ public: part_to_sort.data(), particles_positions, &buffer); - permute_copy<real_number, size_particle_rhs>( - current_offset_particles_for_partition[idxPartition], - current_my_nb_particles_per_partition[idxPartition], - part_to_sort.data(), - particles_current_rhs, - &buffer); + for(int idx_rhs = 0 ; idx_rhs < nb_rhs ; ++idx_rhs){ + permute_copy<real_number, size_particle_rhs>( + current_offset_particles_for_partition[idxPartition], + current_my_nb_particles_per_partition[idxPartition], + part_to_sort.data(), + particles_current_rhs[idx_rhs].get(), + &buffer); + } permute_copy<partsize_t, 1>( current_offset_particles_for_partition[idxPartition], current_my_nb_particles_per_partition[idxPartition], @@ -681,7 +683,7 @@ public: &descriptor.results[(idxPart+idx_p1)*size_particle_rhs], inout_index_particles[((*neighbors[idx_neighbor])[idx_2].first+idx_p2)], &particles_positions[((*neighbors[idx_neighbor])[idx_2].first+idx_p2)*size_particle_positions], - &particles_current_rhs[((*neighbors[idx_neighbor])[idx_2].first+idx_p2)*size_particle_rhs], + &particles_current_rhs[0][((*neighbors[idx_neighbor])[idx_2].first+idx_p2)*size_particle_rhs], dist_r2, cutoff_radius_compute, shift[idx_neighbor][IDXC_X], @@ -730,7 +732,7 @@ public: NeighborDescriptor& descriptor = neigDescriptors[releasedAction.second]; assert(descriptor.isRecv == false); assert(descriptor.toRecvAndMerge != nullptr); - computer_thread.template reduce_particles_rhs<size_particle_rhs>(&particles_current_rhs[particles_offset_layers[my_nb_cell_levels-descriptor.nbLevelsToExchange]*size_particle_rhs], + computer_thread.template reduce_particles_rhs<size_particle_rhs>(&particles_current_rhs[0][particles_offset_layers[my_nb_cell_levels-descriptor.nbLevelsToExchange]*size_particle_rhs], descriptor.toRecvAndMerge.get(), descriptor.nbParticlesToExchange); delete[] descriptor.toRecvAndMerge.release(); } @@ -770,10 +772,10 @@ public: computer_thread.template compute_interaction<size_particle_positions,size_particle_rhs>( inout_index_particles[(intervals[idx_1].first+idx_p1)], &particles_positions[(intervals[idx_1].first+idx_p1)*size_particle_positions], - &particles_current_rhs[(intervals[idx_1].first+idx_p1)*size_particle_rhs], + &particles_current_rhs[0][(intervals[idx_1].first+idx_p1)*size_particle_rhs], inout_index_particles[(intervals[idx_1].first+idx_p2)], &particles_positions[(intervals[idx_1].first+idx_p2)*size_particle_positions], - &particles_current_rhs[(intervals[idx_1].first+idx_p2)*size_particle_rhs], + &particles_current_rhs[0][(intervals[idx_1].first+idx_p2)*size_particle_rhs], dist_r2, cutoff_radius_compute, 0, 0, 0); } } @@ -794,10 +796,10 @@ public: computer_thread.template compute_interaction<size_particle_positions,size_particle_rhs>( inout_index_particles[(intervals[idx_1].first+idx_p1)], &particles_positions[(intervals[idx_1].first+idx_p1)*size_particle_positions], - &particles_current_rhs[(intervals[idx_1].first+idx_p1)*size_particle_rhs], + &particles_current_rhs[0][(intervals[idx_1].first+idx_p1)*size_particle_rhs], inout_index_particles[(intervals[idx_2].first+idx_p2)], &particles_positions[(intervals[idx_2].first+idx_p2)*size_particle_positions], - &particles_current_rhs[(intervals[idx_2].first+idx_p2)*size_particle_rhs], + &particles_current_rhs[0][(intervals[idx_2].first+idx_p2)*size_particle_rhs], dist_r2, cutoff_radius_compute, 0, 0, 0); } } @@ -830,10 +832,10 @@ public: computer_thread.template compute_interaction<size_particle_positions,size_particle_rhs>( inout_index_particles[(intervals[idx_1].first+idx_p1)], &particles_positions[(intervals[idx_1].first+idx_p1)*size_particle_positions], - &particles_current_rhs[(intervals[idx_1].first+idx_p1)*size_particle_rhs], + &particles_current_rhs[0][(intervals[idx_1].first+idx_p1)*size_particle_rhs], inout_index_particles[((*neighbors[idx_neighbor])[idx_2].first+idx_p2)], &particles_positions[((*neighbors[idx_neighbor])[idx_2].first+idx_p2)*size_particle_positions], - &particles_current_rhs[((*neighbors[idx_neighbor])[idx_2].first+idx_p2)*size_particle_rhs], + &particles_current_rhs[0][((*neighbors[idx_neighbor])[idx_2].first+idx_p2)*size_particle_rhs], dist_r2, cutoff_radius_compute, shift[idx_neighbor][IDXC_X], shift[idx_neighbor][IDXC_Y], shift[idx_neighbor][IDXC_Z]); } } diff --git a/cpp/particles/particles_system.hpp b/cpp/particles/particles_system.hpp index c5230f41d7267c1a8aaefc5e629d9535f5eb4268..dd0608d3973d69aab33df5b902b495e59520722d 100644 --- a/cpp/particles/particles_system.hpp +++ b/cpp/particles/particles_system.hpp @@ -279,7 +279,7 @@ public: TIMEZONE("particles_system::compute_p2p"); distr_p2p.template compute_distr<p2p_computer_class, size_particle_positions, size_particle_rhs>( computer_p2p, current_my_nb_particles_per_partition.get(), - my_particles_positions.get(), my_particles_rhs.front().get(), + my_particles_positions.get(), my_particles_rhs.data(), int(my_particles_rhs.size()), my_particles_positions_indexes.get()); } }