mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Add n_collision to MPI SourceSite type
The MPI datatype must include all fields in the struct so that collision count is transferred correctly between MPI ranks.
This commit is contained in:
parent
36f98e9b22
commit
e57d5dda6b
1 changed files with 7 additions and 5 deletions
|
|
@ -161,7 +161,7 @@ void initialize_mpi(MPI_Comm intracomm)
|
|||
|
||||
// Create bank datatype
|
||||
SourceSite b;
|
||||
MPI_Aint disp[14];
|
||||
MPI_Aint disp[15];
|
||||
MPI_Get_address(&b.r, &disp[0]);
|
||||
MPI_Get_address(&b.u, &disp[1]);
|
||||
MPI_Get_address(&b.E, &disp[2]);
|
||||
|
|
@ -176,12 +176,13 @@ void initialize_mpi(MPI_Comm intracomm)
|
|||
MPI_Get_address(&b.wgt_born, &disp[11]);
|
||||
MPI_Get_address(&b.wgt_ww_born, &disp[12]);
|
||||
MPI_Get_address(&b.n_split, &disp[13]);
|
||||
for (int i = 13; i >= 0; --i) {
|
||||
MPI_Get_address(&b.n_collision, &disp[14]);
|
||||
for (int i = 14; i >= 0; --i) {
|
||||
disp[i] -= disp[0];
|
||||
}
|
||||
|
||||
// Block counts for each field
|
||||
int blocks[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
int blocks[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
|
||||
// Types for each field
|
||||
MPI_Datatype types[] = {
|
||||
|
|
@ -198,10 +199,11 @@ void initialize_mpi(MPI_Comm intracomm)
|
|||
MPI_INT64_T, // progeny_id
|
||||
MPI_DOUBLE, // wgt_born
|
||||
MPI_DOUBLE, // wgt_ww_born
|
||||
MPI_INT64_T // n_split
|
||||
MPI_INT64_T, // n_split
|
||||
MPI_INT // n_collision
|
||||
};
|
||||
|
||||
MPI_Type_create_struct(14, blocks, disp, types, &mpi::source_site);
|
||||
MPI_Type_create_struct(15, blocks, disp, types, &mpi::source_site);
|
||||
MPI_Type_commit(&mpi::source_site);
|
||||
|
||||
CollisionTrackSite bc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue