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"
@@ -429,6 +429,14 @@ void available_chunks_test(std::string const &file_ending)
429
429
E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
430
430
E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
431
431
432
+ /*
433
+ * Verify that block decomposition also works in "local value" variable
434
+ * shape. That shape instructs the data to participate in ADIOS2
435
+ * metadata aggregation, hence there is only one "real" written block,
436
+ * the aggregated one. We still need the original logical blocks to be
437
+ * present in reading.
438
+ */
439
+
432
440
auto electrons = it0.particles [" e" ].particlePatches ;
433
441
auto numParticles = electrons[" numParticles" ];
434
442
auto numParticlesOffset = electrons[" numParticlesOffset" ];
@@ -501,12 +509,40 @@ void available_chunks_test(std::string const &file_ending)
501
509
{
502
510
REQUIRE (ranks[i] == i);
503
511
}
512
+
513
+ auto electrons = it0.particles [" e" ].particlePatches ;
514
+ for (PatchRecordComponent *prc :
515
+ {static_cast <PatchRecordComponent *>(&electrons[" numParticles" ]),
516
+ static_cast <PatchRecordComponent *>(
517
+ &electrons[" numParticlesOffset" ]),
518
+ &electrons[" offset" ][" x" ],
519
+ &electrons[" offset" ][" y" ],
520
+ &electrons[" extent" ][" z" ],
521
+ &electrons[" offset" ][" x" ],
522
+ &electrons[" extent" ][" y" ],
523
+ &electrons[" extent" ][" z" ]})
524
+ {
525
+ auto available_chunks = prc->availableChunks ();
526
+ REQUIRE (size_t (r_mpi_size) == available_chunks.size ());
527
+ for (size_t i = 0 ; i < available_chunks.size (); ++i)
528
+ {
529
+ auto const &chunk = available_chunks[i];
530
+ REQUIRE (chunk.extent == Extent{1 });
531
+ REQUIRE (chunk.offset == Offset{i});
532
+ REQUIRE (chunk.sourceID == i);
533
+ }
534
+ }
504
535
}
505
536
}
506
537
507
538
TEST_CASE (" available_chunks_test" , " [parallel][adios]" )
508
539
{
540
+ #if HAS_ADIOS_2_9
541
+ available_chunks_test (" bp4" );
542
+ available_chunks_test (" bp5" );
543
+ #else
509
544
available_chunks_test (" bp" );
545
+ #endif
510
546
}
511
547
#endif
512
548
0 commit comments