Skip to content

Commit

Permalink
Merge pull request #995 from aronhelser/hello_reader_selection
Browse files Browse the repository at this point in the history
helloBPReader - add selection so mpirun -n 2 works.
  • Loading branch information
williamfgc committed Nov 12, 2018
2 parents 3a1f142 + 2608e31 commit 8e11d71
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/hello/bpReader/helloBPReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* helloBPReader.cpp: Simple self-descriptive example of how to read a variable
* to a BP File.
*
* Try running like this from the build directory:
* mpirun -np 3 ./bin/hello_bpReader
*
* Created on: Feb 16, 2017
* Author: William F Godoy godoywf@ornl.gov
*/
Expand Down Expand Up @@ -63,6 +66,8 @@ int main(int argc, char *argv[])

if (bpFloats) // means found
{
// read only the chunk corresponding to our rank
bpFloats.SetSelection({{Nx * rank}, {Nx}});
// myFloats.data is pre-allocated
bpReader.Get<float>(bpFloats, myFloats.data(), adios2::Mode::Sync);

Expand All @@ -76,6 +81,8 @@ int main(int argc, char *argv[])

if (bpInts) // means not found
{
// read only the chunk corresponding to our rank
bpInts.SetSelection({{Nx * rank}, {Nx}});
// myInts.data is pre-allocated
bpReader.Get<int>(bpInts, myInts.data(), adios2::Mode::Sync);

Expand Down

0 comments on commit 8e11d71

Please sign in to comment.