Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BP5 Shape Resize without Empty Put #3455

Open
ax3l opened this issue Jan 31, 2023 · 6 comments
Open

BP5 Shape Resize without Empty Put #3455

ax3l opened this issue Jan 31, 2023 · 6 comments

Comments

@ax3l
Copy link
Contributor

ax3l commented Jan 31, 2023

We discussed on January 30th, 2023 in our ADIOS2-PIC development meeting the following idea to improve meta-data for particle tracking in BP5.

In BP5, global info for all blocks is stored in the meta-data once, at EndStep.

Currently, this requires a Put to be called, which is hard for MPI-parallel API contracts to convey, because Put is a non-collective API call. SetShape on the other hand is clearly collective.

What could be done is use the info from SetShape in EndStep, instead of needing an empty Put from MPI ranks that do not add to the newly resized variable.

Implementation:

  • in EndStep, go through all variables and take their shape.

Downside: none; seems it cannot be fixed in BP4 the same way.

Pro: SetShape is collective and Put a truly independent and side-effect free in API contracts.

Related issue:

@ax3l
Copy link
Contributor Author

ax3l commented Jan 31, 2023

attn @pnorbert @guj @franzpoeschel

@eisenhauer
Copy link
Member

You might think that SetShape would be collective because it seems like something that the ranks would have to agree upon, but nothing actually enforces that in BP5. As you've observed, we only snag Shape on Put(), but we could, at least with the current implementation, stop doing that and instead walk the set of Put() variables in EndStep and put the final Shape in the metadata. But in the context of that let me ask a question. In BP5 we implicitly rely upon the idea that the writer ranks have agreed upon a Shape. Unlike BP4, we don't "merge" metadata from different ranks at any point, instead readers rely upon the Shape value that we get from writer rank 0 (or from the lowest rank that actually had a Put() for that variable). Does that cause you any problem? (I'd worry about doing something more complex than this on the reader size, like requiring BP5 to scan all the writer ranks to pick the biggest shape that it finds, because that would add overhead to all read-side metadata processing to accommodate the presumably rare circumstance when the application ranks don't agree on the Shape.)

@ax3l
Copy link
Contributor Author

ax3l commented Feb 1, 2023

Thanks for the feedback & questions, Greg!

As you've observed, we only snag Shape on Put(), but we could, at least with the current implementation, stop doing that and instead walk the set of Put() variables in EndStep and put the final Shape in the metadata.

yes, that would be our preferred solution.

In BP5 we implicitly rely upon the idea that the writer ranks have agreed upon a Shape. Unlike BP4, we don't "merge" metadata from different ranks at any point, instead readers rely upon the Shape value that we get from writer rank 0 (or from the lowest rank that actually had a Put() for that variable). Does that cause you any problem?

No, that is fine. We know the new (resized) global shape on all ranks, even if a rank does not contribute new particles during a resize with a Put.

To be more precise, we collect this costly All2All info just for I/O #3452, but yes, we know it and can guarantee all ranks tell you the same info.

@ax3l
Copy link
Contributor Author

ax3l commented Feb 1, 2023

I have a question for you, since we often default to BP4 in our production workflows.

Unlike BP4, we don't "merge" metadata from different ranks at any point

Do you think there is a way to fix this also in BP4? The need for an empty Put from every rank for every variable is really unpleasant to code and keep book of. This is a super common I/O pattern for mesh-refinement simulations, particle tracking, etc. even if the concept of resizing a global shape is relatively new in ADIOS.

Unrelated but just a note: HDF5 does also not need such extra empty-write calls to update the global shape. It just needs the guarantee that the shape meta-data is updated collectively.

@eisenhauer
Copy link
Member

Maybe theoretically possible, but it might well be of huge practical difficulty. I'm less familiar with the details of BP4 metadata processing. I believe that in EndStep it's all encoded, pulled to rank 0, decoded and then re-encoded as a more unified thing. (BP5 does the first two things, but not the decode/re-encode.) The last re-encode might be where you could put something like that in BP4, but it might not be reasonable depending upon the structure of the code, what data structures it builds up during the process, etc.

I'll see about making these changes in BP5 and putting together a test for updating Shape during a timestep...

@eisenhauer
Copy link
Member

Hey Axel! Just curious, is this functionality was still necessary (or at least useful), or does the implementation of Joined Arrays covers the use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants