44#include " openPMD/IO/ADIOS/macros.hpp"
55#include " openPMD/auxiliary/Environment.hpp"
66#include " openPMD/auxiliary/Filesystem.hpp"
7+ #include " openPMD/backend/PatchRecordComponent.hpp"
78#include " openPMD/openPMD.hpp"
89#include < catch2/catch.hpp>
910
@@ -397,7 +398,7 @@ void available_chunks_test(std::string const &file_ending)
397398 MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
398399 unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
399400 mpi_size{static_cast <unsigned >(r_mpi_size)};
400- std::string name = " ../samples/available_chunks ." + file_ending;
401+ std::string name = " ../samples/parallel_available_chunks ." + file_ending;
401402
402403 /*
403404 * ADIOS2 assigns writerIDs to blocks in a BP file by id of the substream
@@ -410,7 +411,6 @@ void available_chunks_test(std::string const &file_ending)
410411 {
411412 "engine":
412413 {
413- "type": "bp4",
414414 "parameters":
415415 {
416416 "NumAggregators":)END"
@@ -429,6 +429,14 @@ void available_chunks_test(std::string const &file_ending)
429429 E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
430430 E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
431431
432+ /*
433+ * Verify that block decomposition also works in "local value" variable
434+ * shape. That shape instructs the data to participate in ADIOS2
435+ * metadata aggregation, hence there is only one "real" written block,
436+ * the aggregated one. We still need the original logical blocks to be
437+ * present in reading.
438+ */
439+
432440 auto electrons = it0.particles [" e" ].particlePatches ;
433441 auto numParticles = electrons[" numParticles" ];
434442 auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -501,12 +509,40 @@ void available_chunks_test(std::string const &file_ending)
501509 {
502510 REQUIRE (ranks[i] == i);
503511 }
512+
513+ auto electrons = it0.particles [" e" ].particlePatches ;
514+ for (PatchRecordComponent *prc :
515+ {static_cast <PatchRecordComponent *>(&electrons[" numParticles" ]),
516+ static_cast <PatchRecordComponent *>(
517+ &electrons[" numParticlesOffset" ]),
518+ &electrons[" offset" ][" x" ],
519+ &electrons[" offset" ][" y" ],
520+ &electrons[" extent" ][" z" ],
521+ &electrons[" offset" ][" x" ],
522+ &electrons[" extent" ][" y" ],
523+ &electrons[" extent" ][" z" ]})
524+ {
525+ auto available_chunks = prc->availableChunks ();
526+ REQUIRE (size_t (r_mpi_size) == available_chunks.size ());
527+ for (size_t i = 0 ; i < available_chunks.size (); ++i)
528+ {
529+ auto const &chunk = available_chunks[i];
530+ REQUIRE (chunk.extent == Extent{1 });
531+ REQUIRE (chunk.offset == Offset{i});
532+ REQUIRE (chunk.sourceID == i);
533+ }
534+ }
504535 }
505536}
506537
507538TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
508539{
540+ #if HAS_ADIOS_2_9
541+ available_chunks_test (" bp4" );
542+ available_chunks_test (" bp5" );
543+ #else
509544 available_chunks_test (" bp" );
545+ #endif
510546}
511547#endif
512548
0 commit comments