Skip to content

Commit

Permalink
Merge pull request #14110 from tjhei/parallel-intermediate-out
Browse files Browse the repository at this point in the history
Implement parallel intermediate output
  • Loading branch information
bangerth committed Jul 10, 2022
2 parents daa3c87 + b885101 commit 05b61d7
Show file tree
Hide file tree
Showing 6 changed files with 529 additions and 4 deletions.
6 changes: 6 additions & 0 deletions doc/news/changes/minor/20220707tjhei
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
New: Implement `DataOut::write_deal_II_intermediate_in_parallel()`
that writes a combined file from all MPI ranks using MPI I/O of the
internal patches and a corresponding
`DataOutReader::read_whole_parallel_file()` to read them back in.
<br>
(Timo Heister, 2022/07/07)
44 changes: 44 additions & 0 deletions include/deal.II/base/data_out_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,30 @@ namespace DataOutBase
const Deal_II_IntermediateFlags &flags,
std::ostream & out);

/**
* Like write_deal_II_intermediate() but write all patches from all ranks
* using MPI I/O
* into a single file with name @p name. Compression using zlib is optional and controlled
* by the @p compression argument.
*
* The files typically have the extension <tt>.pd2</tt>.
*/
template <int dim, int spacedim>
void
write_deal_II_intermediate_in_parallel(
const std::vector<Patch<dim, spacedim>> &patches,
const std::vector<std::string> & data_names,
const std::vector<
std::tuple<unsigned int,
unsigned int,
std::string,
DataComponentInterpretation::DataComponentInterpretation>>
& nonscalar_data_ranges,
const Deal_II_IntermediateFlags & flags,
const std::string & filename,
const MPI_Comm & comm,
const VtkFlags::ZlibCompressionLevel compression);

/**
* Write the data in @p data_filter to a single HDF5 file containing both the
* mesh and solution values.
Expand Down Expand Up @@ -2826,6 +2850,18 @@ class DataOutInterface
void
write_deal_II_intermediate(std::ostream &out) const;

/**
* Obtain data through get_patches() and write it using MPI I/O in parallel
* to the file @p filename in the parallel
* deal.II intermediate format. See
* DataOutBase::write_deal_II_intermediate_in_parallel().
*/
void
write_deal_II_intermediate_in_parallel(
const std::string & filename,
const MPI_Comm & comm,
const DataOutBase::VtkFlags::ZlibCompressionLevel compression) const;

/**
* Create an XDMFEntry based on the data in the data_filter. This assumes
* the mesh and solution data were written to a single file. See
Expand Down Expand Up @@ -3185,6 +3221,14 @@ class DataOutReader : public DataOutInterface<dim, spacedim>
void
read(std::istream &in);

/**
* Read all data previously written using
* DataOutBase::write_deal_II_intermediate_in_parallel() from all
* MPI ranks into this data structure.
*/
void
read_whole_parallel_file(std::istream &in);

/**
* This function can be used to merge the patches read by the other object
* into the patches that this present object stores. This is sometimes handy
Expand Down

0 comments on commit 05b61d7

Please sign in to comment.