@@ -413,13 +413,42 @@ void available_chunks_test(std::string const &file_ending)
413413}
414414)END" ;
415415
416- std::vector<int > data{2 , 4 , 6 , 8 };
416+ std::vector<int > xdata{2 , 4 , 6 , 8 };
417+ std::vector<int > ydata{0 , 0 , 0 , 0 , 0 , //
418+ 0 , 1 , 2 , 3 , 0 , //
419+ 0 , 4 , 5 , 6 , 0 , //
420+ 0 , 7 , 8 , 9 , 0 , //
421+ 0 , 0 , 0 , 0 , 0 };
422+ std::vector<int > ydata_firstandlastrow{-1 , -1 , -1 };
417423 {
418424 Series write (name, Access::CREATE, MPI_COMM_WORLD, parameters.str ());
419425 Iteration it0 = write.iterations [0 ];
420426 auto E_x = it0.meshes [" E" ][" x" ];
421427 E_x.resetDataset ({Datatype::INT, {mpi_size, 4 }});
422- E_x.storeChunk (data, {mpi_rank, 0 }, {1 , 4 });
428+ E_x.storeChunk (xdata, {mpi_rank, 0 }, {1 , 4 });
429+ auto E_y = it0.meshes [" E" ][" y" ];
430+ E_y.resetDataset ({Datatype::INT, {5 , 3ul * mpi_size}});
431+ E_y.prepareLoadStore ()
432+ .withContiguousContainer (ydata_firstandlastrow)
433+ .offset ({0 , 3ul * mpi_rank})
434+ .extent ({1 , 3 })
435+ .enqueueStore ();
436+ E_y.prepareLoadStore ()
437+ .offset ({1 , 3ul * mpi_rank})
438+ .extent ({3 , 3 })
439+ .withContiguousContainer (ydata)
440+ .memorySelection ({{1 , 1 }, {5 , 5 }})
441+ .enqueueStore ();
442+ // if condition checks if this PR is available in ADIOS2:
443+ // https://github.com/ornladios/ADIOS2/pull/4169
444+ if constexpr (CanTheMemorySelectionBeReset)
445+ {
446+ E_y.prepareLoadStore ()
447+ .withContiguousContainer (ydata_firstandlastrow)
448+ .offset ({4 , 3ul * mpi_rank})
449+ .extent ({1 , 3 })
450+ .enqueueStore ();
451+ }
423452 it0.close ();
424453 }
425454
@@ -451,6 +480,42 @@ void available_chunks_test(std::string const &file_ending)
451480 {
452481 REQUIRE (ranks[i] == i);
453482 }
483+
484+ auto E_y = it0.meshes [" E" ][" y" ];
485+ auto width = E_y.getExtent ()[1 ];
486+ auto first_row =
487+ E_y.prepareLoadStore ().extent ({1 , width}).enqueueLoad <int >().get ();
488+ auto middle_rows = E_y.prepareLoadStore ()
489+ .offset ({1 , 0 })
490+ .extent ({3 , width})
491+ .enqueueLoad <int >()
492+ .get ();
493+ auto last_row =
494+ E_y.prepareLoadStore ().offset ({4 , 0 }).enqueueLoad <int >().get ();
495+ read.flush ();
496+
497+ for (auto row : [&]() -> std::vector<std::shared_ptr<int > *> {
498+ if constexpr (CanTheMemorySelectionBeReset)
499+ {
500+ return {&first_row, &last_row};
501+ }
502+ else
503+ {
504+ return {&first_row};
505+ }
506+ }())
507+ {
508+ for (size_t i = 0 ; i < width; ++i)
509+ {
510+ REQUIRE (row->get ()[i] == -1 );
511+ }
512+ }
513+ for (size_t i = 0 ; i < width * 3 ; ++i)
514+ {
515+ size_t row = i / width;
516+ int required_value = row * 3 + (i % 3 ) + 1 ;
517+ REQUIRE (middle_rows.get ()[i] == required_value);
518+ }
454519 }
455520}
456521
0 commit comments