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
@@ -398,7 +399,7 @@ void available_chunks_test(std::string const &file_ending)
398
399
MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
399
400
unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
400
401
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;
402
403
403
404
/*
404
405
* 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)
411
412
{
412
413
"engine":
413
414
{
414
- "type": "bp4",
415
415
"parameters":
416
416
{
417
417
"NumAggregators":)END"
@@ -432,6 +432,14 @@ void available_chunks_test(std::string const &file_ending)
432
432
E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
433
433
E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
434
434
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
+
435
443
auto electrons = it0.particles [" e" ].particlePatches ;
436
444
auto numParticles = electrons[" numParticles" ];
437
445
auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -504,12 +512,40 @@ void available_chunks_test(std::string const &file_ending)
504
512
{
505
513
REQUIRE (ranks[i] == i);
506
514
}
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
+ }
507
538
}
508
539
}
509
540
510
541
TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
511
542
{
543
+ #if HAS_ADIOS_2_9
544
+ available_chunks_test (" bp4" );
545
+ available_chunks_test (" bp5" );
546
+ #else
512
547
available_chunks_test (" bp" );
548
+ #endif
513
549
}
514
550
#endif
515
551
0 commit comments