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
@@ -398,7 +399,7 @@ void available_chunks_test(std::string const &file_ending)
398399 MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
399400 unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
400401 mpi_size{static_cast <unsigned >(r_mpi_size)};
401- std::string name = " ../samples/available_chunks ." + file_ending;
402+ std::string name = " ../samples/parallel_available_chunks ." + file_ending;
402403
403404 /*
404405 * ADIOS2 assigns writerIDs to blocks in a BP file by id of the substream
@@ -411,7 +412,6 @@ void available_chunks_test(std::string const &file_ending)
411412 {
412413 "engine":
413414 {
414- "type": "bp4",
415415 "parameters":
416416 {
417417 "NumAggregators":)END"
@@ -432,6 +432,14 @@ void available_chunks_test(std::string const &file_ending)
432432 E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
433433 E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
434434
435+ /*
436+ * Verify that block decomposition also works in "local value" variable
437+ * shape. That shape instructs the data to participate in ADIOS2
438+ * metadata aggregation, hence there is only one "real" written block,
439+ * the aggregated one. We still need the original logical blocks to be
440+ * present in reading.
441+ */
442+
435443 auto electrons = it0.particles [" e" ].particlePatches ;
436444 auto numParticles = electrons[" numParticles" ];
437445 auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -504,12 +512,40 @@ void available_chunks_test(std::string const &file_ending)
504512 {
505513 REQUIRE (ranks[i] == i);
506514 }
515+
516+ auto electrons = it0.particles [" e" ].particlePatches ;
517+ for (PatchRecordComponent *prc :
518+ {static_cast <PatchRecordComponent *>(&electrons[" numParticles" ]),
519+ static_cast <PatchRecordComponent *>(
520+ &electrons[" numParticlesOffset" ]),
521+ &electrons[" offset" ][" x" ],
522+ &electrons[" offset" ][" y" ],
523+ &electrons[" extent" ][" z" ],
524+ &electrons[" offset" ][" x" ],
525+ &electrons[" extent" ][" y" ],
526+ &electrons[" extent" ][" z" ]})
527+ {
528+ auto available_chunks = prc->availableChunks ();
529+ REQUIRE (size_t (r_mpi_size) == available_chunks.size ());
530+ for (size_t i = 0 ; i < available_chunks.size (); ++i)
531+ {
532+ auto const &chunk = available_chunks[i];
533+ REQUIRE (chunk.extent == Extent{1 });
534+ REQUIRE (chunk.offset == Offset{i});
535+ REQUIRE (chunk.sourceID == i);
536+ }
537+ }
507538 }
508539}
509540
510541TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
511542{
543+ #if HAS_ADIOS_2_9
544+ available_chunks_test (" bp4" );
545+ available_chunks_test (" bp5" );
546+ #else
512547 available_chunks_test (" bp" );
548+ #endif
513549}
514550#endif
515551
0 commit comments