Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use collective writes for VTU files #294

Merged
merged 12 commits into from
Jan 3, 2024

Conversation

tim-griesbach
Copy link
Contributor

In the implementation of the parallel writing of VTU files ForestClaw used MPI_File_write for distributed data, e.g. coordinates. There is the optimized and collective function MPI_File_write_all, which is optimized for writing parallel distributed data.

This PR uses the function MPI_File_write_all in places where we write parallel distributed data. Moreover, we introduce a buffering mechanism for patches during writing VTU files. This is a side effect of ensuring that the collective function MPI_File_write_all is called equally many times on each rank. The buffering mechanism offers the variable patch_threshold in fclaw2d_vtk_state_t. By default patch_threshold is set to -1, i.e. we buffer all patch data for each fclaw2d_vtk_write_field call and then write the data to disk. Alternatively, one can change patch_threshold in the VTK state to a number strictly greater 0 and only patch_threshold many patches are buffered and if the threshold is exceeded the data is written to disk.

Before there was one writing operation per patch. Now this is not generally true anymore since the number of writing operations depends on the patch_threshold.

We appreciate any feedback! In particular concerning the impact on the parallel writing performance.

@cburstedde
Copy link
Member

This seems good to do testing. Before it gets merged, we may want to check whether we may use sc_io_write_all throughout and do not need to rely on the #ifdef P4EST_ENABLE_MPIIO anymore.

@cburstedde
Copy link
Member

Let's just merge this. This code has been tested well by @tim-griesbach.

@tim-griesbach
Copy link
Contributor Author

This seems good to do testing. Before it gets merged, we may want to check whether we may use sc_io_write_all throughout and do not need to rely on the #ifdef P4EST_ENABLE_MPIIO anymore.

Currently, the function sc_io_write_all is not equivalent to MPI_File_write_all. The reason for this was to keep the implementation of the case without MPI I/O but with MPI simple. Therefore, the function is equivalent to call sc_io_write_at_all with the offset 0. The functions sc_io_write_all and sc_io_read_all are currently both unused in our implementation of the first version of the file format.

@scottaiton scottaiton merged commit adb290e into ForestClaw:develop Jan 3, 2024
35 checks passed
@tim-griesbach tim-griesbach deleted the feature-collective-io branch January 8, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants