5
5
#include " openPMD/IO/Access.hpp"
6
6
#include " openPMD/auxiliary/Environment.hpp"
7
7
#include " openPMD/auxiliary/Filesystem.hpp"
8
+ #include " openPMD/backend/PatchRecordComponent.hpp"
8
9
#include " openPMD/openPMD.hpp"
9
10
#include < catch2/catch.hpp>
10
11
@@ -403,7 +404,7 @@ void available_chunks_test(std::string const &file_ending)
403
404
MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
404
405
unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
405
406
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;
407
408
408
409
/*
409
410
* 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)
416
417
{
417
418
"engine":
418
419
{
419
- "type": "bp4",
420
420
"parameters":
421
421
{
422
422
"NumAggregators":)END"
@@ -437,6 +437,14 @@ void available_chunks_test(std::string const &file_ending)
437
437
E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
438
438
E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
439
439
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
+
440
448
auto electrons = it0.particles [" e" ].particlePatches ;
441
449
auto numParticles = electrons[" numParticles" ];
442
450
auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -509,12 +517,40 @@ void available_chunks_test(std::string const &file_ending)
509
517
{
510
518
REQUIRE (ranks[i] == i);
511
519
}
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
+ }
512
543
}
513
544
}
514
545
515
546
TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
516
547
{
548
+ #if HAS_ADIOS_2_9
549
+ available_chunks_test (" bp4" );
550
+ available_chunks_test (" bp5" );
551
+ #else
517
552
available_chunks_test (" bp" );
553
+ #endif
518
554
}
519
555
#endif
520
556
0 commit comments