Added progeny_id field of Particle::Bank type to MPI Bank type to fix bug. Also some minor comment/assert cleanups from debugging.

This commit is contained in:
John Tramm 2020-01-17 15:50:19 +00:00
parent 732a780366
commit 1c48584c46
4 changed files with 7 additions and 9 deletions

View file

@ -43,6 +43,7 @@ void free_memory_bank()
simulation::source_bank.clear();
simulation::fission_bank.reset();
simulation::fission_bank_length = 0;
simulation::progeny_per_particle.clear();
}
void init_fission_bank(int64_t max)

View file

@ -101,7 +101,7 @@ void initialize_mpi(MPI_Comm intracomm)
// Create bank datatype
Particle::Bank b;
MPI_Aint disp[7];
MPI_Aint disp[8];
MPI_Get_address(&b.r, &disp[0]);
MPI_Get_address(&b.u, &disp[1]);
MPI_Get_address(&b.E, &disp[2]);
@ -109,11 +109,12 @@ void initialize_mpi(MPI_Comm intracomm)
MPI_Get_address(&b.delayed_group, &disp[4]);
MPI_Get_address(&b.particle, &disp[5]);
MPI_Get_address(&b.parent_id, &disp[6]);
for (int i = 6; i >= 0; --i) disp[i] -= disp[0];
MPI_Get_address(&b.progeny_id, &disp[7]);
for (int i = 7; i >= 0; --i) disp[i] -= disp[0];
int blocks[] {3, 3, 1, 1, 1, 1, 1};
MPI_Datatype types[] {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_LONG};
MPI_Type_create_struct(7, blocks, disp, types, &mpi::bank);
int blocks[] {3, 3, 1, 1, 1, 1, 1, 1};
MPI_Datatype types[] {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_LONG, MPI_LONG};
MPI_Type_create_struct(8, blocks, disp, types, &mpi::bank);
MPI_Type_commit(&mpi::bank);
}
#endif // OPENMC_MPI

View file

@ -395,8 +395,6 @@ Particle::event_death()
// Record the number of progeny created by this particle.
// This data will be used to efficiently sort the fission bank.
int64_t offset = id_ - 1 - simulation::work_index[mpi::rank];
assert(offset >= 0);
assert(offset < simulation::work_per_rank);
simulation::progeny_per_particle[offset] = n_progeny_;
}

View file

@ -397,9 +397,7 @@ void finalize_generation()
// If using shared memory, stable sort the fission bank (by parent IDs)
// so as to allow for reproducibility regardless of which order particles
// are run in.
//#ifdef _OPENMP
sort_fission_bank();
//#endif
// Distribute fission bank across processors evenly
synchronize_bank();