55#include " openPMD/IO/Access.hpp"
66#include " openPMD/auxiliary/Environment.hpp"
77#include " openPMD/auxiliary/Filesystem.hpp"
8+ #include " openPMD/backend/PatchRecordComponent.hpp"
89#include " openPMD/openPMD.hpp"
910#include < catch2/catch.hpp>
1011
@@ -403,7 +404,7 @@ void available_chunks_test(std::string const &file_ending)
403404 MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
404405 unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
405406 mpi_size{static_cast <unsigned >(r_mpi_size)};
406- std::string name = " ../samples/available_chunks ." + file_ending;
407+ std::string name = " ../samples/parallel_available_chunks ." + file_ending;
407408
408409 /*
409410 * ADIOS2 assigns writerIDs to blocks in a BP file by id of the substream
@@ -416,7 +417,6 @@ void available_chunks_test(std::string const &file_ending)
416417 {
417418 "engine":
418419 {
419- "type": "bp4",
420420 "parameters":
421421 {
422422 "NumAggregators":)END"
@@ -437,6 +437,14 @@ void available_chunks_test(std::string const &file_ending)
437437 E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
438438 E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
439439
440+ /*
441+ * Verify that block decomposition also works in "local value" variable
442+ * shape. That shape instructs the data to participate in ADIOS2
443+ * metadata aggregation, hence there is only one "real" written block,
444+ * the aggregated one. We still need the original logical blocks to be
445+ * present in reading.
446+ */
447+
440448 auto electrons = it0.particles [" e" ].particlePatches ;
441449 auto numParticles = electrons[" numParticles" ];
442450 auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -509,12 +517,40 @@ void available_chunks_test(std::string const &file_ending)
509517 {
510518 REQUIRE (ranks[i] == i);
511519 }
520+
521+ auto electrons = it0.particles [" e" ].particlePatches ;
522+ for (PatchRecordComponent *prc :
523+ {static_cast <PatchRecordComponent *>(&electrons[" numParticles" ]),
524+ static_cast <PatchRecordComponent *>(
525+ &electrons[" numParticlesOffset" ]),
526+ &electrons[" offset" ][" x" ],
527+ &electrons[" offset" ][" y" ],
528+ &electrons[" extent" ][" z" ],
529+ &electrons[" offset" ][" x" ],
530+ &electrons[" extent" ][" y" ],
531+ &electrons[" extent" ][" z" ]})
532+ {
533+ auto available_chunks = prc->availableChunks ();
534+ REQUIRE (size_t (r_mpi_size) == available_chunks.size ());
535+ for (size_t i = 0 ; i < available_chunks.size (); ++i)
536+ {
537+ auto const &chunk = available_chunks[i];
538+ REQUIRE (chunk.extent == Extent{1 });
539+ REQUIRE (chunk.offset == Offset{i});
540+ REQUIRE (chunk.sourceID == i);
541+ }
542+ }
512543 }
513544}
514545
515546TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
516547{
548+ #if HAS_ADIOS_2_9
549+ available_chunks_test (" bp4" );
550+ available_chunks_test (" bp5" );
551+ #else
517552 available_chunks_test (" bp" );
553+ #endif
518554}
519555#endif
520556
0 commit comments