4
4
#include " openPMD/IO/ADIOS/macros.hpp"
5
5
#include " openPMD/auxiliary/Environment.hpp"
6
6
#include " openPMD/auxiliary/Filesystem.hpp"
7
+ #include " openPMD/backend/PatchRecordComponent.hpp"
7
8
#include " openPMD/openPMD.hpp"
8
9
#include < catch2/catch.hpp>
9
10
@@ -397,7 +398,7 @@ void available_chunks_test(std::string const &file_ending)
397
398
MPI_Comm_size (MPI_COMM_WORLD, &r_mpi_size);
398
399
unsigned mpi_rank{static_cast <unsigned >(r_mpi_rank)},
399
400
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;
401
402
402
403
/*
403
404
* 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)
410
411
{
411
412
"engine":
412
413
{
413
- "type": "bp4",
414
414
"parameters":
415
415
{
416
416
"NumAggregators":)END"
@@ -430,6 +430,14 @@ void available_chunks_test(std::string const &file_ending)
430
430
E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
431
431
E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
432
432
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
+
433
441
auto electrons = it0.particles [" e" ].particlePatches ;
434
442
auto numParticles = electrons[" numParticles" ];
435
443
auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -502,12 +510,40 @@ void available_chunks_test(std::string const &file_ending)
502
510
{
503
511
REQUIRE (ranks[i] == i);
504
512
}
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
+ }
505
536
}
506
537
}
507
538
508
539
TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
509
540
{
541
+ #if HAS_ADIOS_2_9
542
+ available_chunks_test (" bp4" );
543
+ available_chunks_test (" bp5" );
544
+ #else
510
545
available_chunks_test (" bp" );
546
+ #endif
511
547
}
512
548
#endif
513
549
0 commit comments