Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
0178a299
Commit
0178a299
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Change the reduction in io_write_cell_offsets() to make sure all ranks have the full information.
parent
514740f2
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!990
Distributed snapshots
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common_io.c
+24
-79
24 additions, 79 deletions
src/common_io.c
src/distributed_io.c
+2
-2
2 additions, 2 deletions
src/distributed_io.c
with
26 additions
and
81 deletions
src/common_io.c
+
24
−
79
View file @
0178a299
...
@@ -689,91 +689,36 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3], const double dim[3],
...
@@ -689,91 +689,36 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3], const double dim[3],
#ifdef WITH_MPI
#ifdef WITH_MPI
/* Now, reduce all the arrays. Note that we use a bit-wise OR here. This
/* Now, reduce all the arrays. Note that we use a bit-wise OR here. This
is safe as we made sure only local cells have non-zero values. */
is safe as we made sure only local cells have non-zero values. */
if
(
nodeID
==
0
)
{
MPI_Allreduce
(
MPI_IN_PLACE
,
count_part
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
MPI_Reduce
(
MPI_IN_PLACE
,
count_part
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
0
,
MPI_COMM_WORLD
);
MPI_Allreduce
(
MPI_IN_PLACE
,
count_gpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
}
else
{
0
,
MPI_COMM_WORLD
);
MPI_Reduce
(
count_part
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_Allreduce
(
MPI_IN_PLACE
,
count_background_gpart
,
nr_cells
,
MPI_COMM_WORLD
);
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
MPI_Allreduce
(
MPI_IN_PLACE
,
count_spart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
if
(
nodeID
==
0
)
{
0
,
MPI_COMM_WORLD
);
MPI_Reduce
(
MPI_IN_PLACE
,
count_gpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
MPI_Allreduce
(
MPI_IN_PLACE
,
count_bpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
count_gpart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_Allreduce
(
MPI_IN_PLACE
,
offset_part
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
MPI_COMM_WORLD
);
0
,
MPI_COMM_WORLD
);
}
MPI_Allreduce
(
MPI_IN_PLACE
,
offset_gpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
if
(
nodeID
==
0
)
{
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
MPI_Reduce
(
MPI_IN_PLACE
,
count_background_gpart
,
nr_cells
,
MPI_Allreduce
(
MPI_IN_PLACE
,
offset_background_gpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Allreduce
(
MPI_IN_PLACE
,
offset_spart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_Reduce
(
count_background_gpart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
MPI_Allreduce
(
MPI_IN_PLACE
,
offset_bpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
}
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
count_spart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
count_spart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
count_bpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
count_bpart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
offset_part
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
offset_part
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
offset_gpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
offset_gpart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
offset_background_gpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
offset_background_gpart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
offset_spart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
offset_spart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
if
(
nodeID
==
0
)
{
MPI_Reduce
(
MPI_IN_PLACE
,
offset_bpart
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
offset_bpart
,
NULL
,
nr_cells
,
MPI_LONG_LONG_INT
,
MPI_BOR
,
0
,
MPI_COMM_WORLD
);
}
/* For the centres we use a sum as MPI does not like bit-wise operations
/* For the centres we use a sum as MPI does not like bit-wise operations
on floating point numbers */
on floating point numbers */
if
(
nodeID
==
0
)
{
MPI_Allreduce
(
MPI_IN_PLACE
,
centres
,
3
*
nr_cells
,
MPI_DOUBLE
,
MPI_SUM
,
0
,
MPI_Reduce
(
MPI_IN_PLACE
,
centres
,
3
*
nr_cells
,
MPI_DOUBLE
,
MPI_SUM
,
0
,
MPI_COMM_WORLD
);
MPI_COMM_WORLD
);
}
else
{
MPI_Reduce
(
centres
,
NULL
,
3
*
nr_cells
,
MPI_DOUBLE
,
MPI_SUM
,
0
,
MPI_COMM_WORLD
);
}
#endif
#endif
/* When writing a single file, only rank 0 writes the meta-data */
/* When writing a single file, only rank 0 writes the meta-data */
if
(
!
distributed
&&
nodeID
==
0
)
{
if
((
distributed
)
||
(
!
distributed
&&
nodeID
==
0
)
)
{
/* Unit conversion if necessary */
/* Unit conversion if necessary */
const
double
factor
=
units_conversion_factor
(
const
double
factor
=
units_conversion_factor
(
...
...
This diff is collapsed.
Click to expand it.
src/distributed_io.c
+
2
−
2
View file @
0178a299
...
@@ -437,8 +437,8 @@ void write_output_distributed(struct engine* e, const char* baseName,
...
@@ -437,8 +437,8 @@ void write_output_distributed(struct engine* e, const char* baseName,
/* Write the location of the particles in the arrays */
/* Write the location of the particles in the arrays */
io_write_cell_offsets
(
h_grp
,
e
->
s
->
cdim
,
e
->
s
->
dim
,
e
->
s
->
pos_dithering
,
io_write_cell_offsets
(
h_grp
,
e
->
s
->
cdim
,
e
->
s
->
dim
,
e
->
s
->
pos_dithering
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
e
->
s
->
width
,
mpi_rank
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
e
->
s
->
width
,
mpi_rank
,
/*distributed=*/
1
,
N_total
,
global_offsets
,
internal_units
,
/*distributed=*/
1
,
N_total
,
global_offsets
,
snapshot_units
);
internal_units
,
snapshot_units
);
H5Gclose
(
h_grp
);
H5Gclose
(
h_grp
);
/* Tell the user if a conversion will be needed */
/* Tell the user if a conversion will be needed */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment