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"
@@ -430,6 +430,14 @@ void available_chunks_test(std::string const &file_ending)
430430 E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
431431 E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
432432
433+ /*
434+ * Verify that block decomposition also works in "local value" variable
435+ * shape. That shape instructs the data to participate in ADIOS2
436+ * metadata aggregation, hence there is only one "real" written block,
437+ * the aggregated one. We still need the original logical blocks to be
438+ * present in reading.
439+ */
440+
433441 auto electrons = it0.particles [" e" ].particlePatches ;
434442 auto numParticles = electrons[" numParticles" ];
435443 auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -502,12 +510,40 @@ void available_chunks_test(std::string const &file_ending)
502510 {
503511 REQUIRE (ranks[i] == i);
504512 }
513+
514+ auto electrons = it0.particles [" e" ].particlePatches ;
515+ for (PatchRecordComponent *prc :
516+ {static_cast <PatchRecordComponent *>(&electrons[" numParticles" ]),
517+ static_cast <PatchRecordComponent *>(
518+ &electrons[" numParticlesOffset" ]),
519+ &electrons[" offset" ][" x" ],
520+ &electrons[" offset" ][" y" ],
521+ &electrons[" extent" ][" z" ],
522+ &electrons[" offset" ][" x" ],
523+ &electrons[" extent" ][" y" ],
524+ &electrons[" extent" ][" z" ]})
525+ {
526+ auto available_chunks = prc->availableChunks ();
527+ REQUIRE (size_t (r_mpi_size) == available_chunks.size ());
528+ for (size_t i = 0 ; i < available_chunks.size (); ++i)
529+ {
530+ auto const &chunk = available_chunks[i];
531+ REQUIRE (chunk.extent == Extent{1 });
532+ REQUIRE (chunk.offset == Offset{i});
533+ REQUIRE (chunk.sourceID == i);
534+ }
535+ }
505536 }
506537}
507538
508539TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
509540{
541+ #if HAS_ADIOS_2_9
542+ available_chunks_test (" bp4" );
543+ available_chunks_test (" bp5" );
544+ #else
510545 available_chunks_test (" bp" );
546+ #endif
511547}
512548#endif
513549
0 commit comments