77#include " openPMD/IO/Access.hpp"
88#include " openPMD/auxiliary/Environment.hpp"
99#include " openPMD/auxiliary/Filesystem.hpp"
10+ #include " openPMD/backend/PatchRecordComponent.hpp"
1011#include " openPMD/openPMD.hpp"
1112#include < catch2/catch.hpp>
1213
@@ -387,7 +388,7 @@ void available_chunks_test(std::string const &file_ending)
387388 MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
388389 unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
389390 mpi_size{static_cast <unsigned >(r_mpi_size)};
390- std::string name = " ../samples/available_chunks ." + file_ending;
391+ std::string name = " ../samples/parallel_available_chunks ." + file_ending;
391392
392393 /*
393394 * ADIOS2 assigns writerIDs to blocks in a BP file by id of the substream
@@ -400,7 +401,6 @@ void available_chunks_test(std::string const &file_ending)
400401 {
401402 "engine":
402403 {
403- "type": "bp4",
404404 "parameters":
405405 {
406406 "NumAggregators":)END"
@@ -421,6 +421,14 @@ void available_chunks_test(std::string const &file_ending)
421421 E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
422422 E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
423423
424+ /*
425+ * Verify that block decomposition also works in "local value" variable
426+ * shape. That shape instructs the data to participate in ADIOS2
427+ * metadata aggregation, hence there is only one "real" written block,
428+ * the aggregated one. We still need the original logical blocks to be
429+ * present in reading.
430+ */
431+
424432 auto electrons = it0.particles [" e" ].particlePatches ;
425433 auto numParticles = electrons[" numParticles" ];
426434 auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -493,12 +501,40 @@ void available_chunks_test(std::string const &file_ending)
493501 {
494502 REQUIRE (ranks[i] == i);
495503 }
504+
505+ auto electrons = it0.particles [" e" ].particlePatches ;
506+ for (PatchRecordComponent *prc :
507+ {static_cast <PatchRecordComponent *>(&electrons[" numParticles" ]),
508+ static_cast <PatchRecordComponent *>(
509+ &electrons[" numParticlesOffset" ]),
510+ &electrons[" offset" ][" x" ],
511+ &electrons[" offset" ][" y" ],
512+ &electrons[" extent" ][" z" ],
513+ &electrons[" offset" ][" x" ],
514+ &electrons[" extent" ][" y" ],
515+ &electrons[" extent" ][" z" ]})
516+ {
517+ auto available_chunks = prc->availableChunks ();
518+ REQUIRE (size_t (r_mpi_size) == available_chunks.size ());
519+ for (size_t i = 0 ; i < available_chunks.size (); ++i)
520+ {
521+ auto const &chunk = available_chunks[i];
522+ REQUIRE (chunk.extent == Extent{1 });
523+ REQUIRE (chunk.offset == Offset{i});
524+ REQUIRE (chunk.sourceID == i);
525+ }
526+ }
496527 }
497528}
498529
499530TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
500531{
532+ #if HAS_ADIOS_2_9
533+ available_chunks_test (" bp4" );
534+ available_chunks_test (" bp5" );
535+ #else
501536 available_chunks_test (" bp" );
537+ #endif
502538}
503539#endif
504540
0 commit comments