Skip to content

Conversation

@knelli2
Copy link
Contributor

@knelli2 knelli2 commented May 8, 2025

Proposed changes

This is the second of 3 PRs that avoid writing volume data for a common horizon find that fails.

This PR is some miscellaneous changes to VolumeActions.hpp that are needed and also adds what is called a "dependency" to the interpolation framework which the combined common horizon event in #6622 will make use of eventually. Currently, this dependency does nothing.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

Technically depends on #6622, but only for a single test so I didn't include those commits here. Whichever is merged first, I'll just rebase.

const ArrayIndex& array_index,
const TemporalId& temporal_id) {
const TemporalId& temporal_id,
std::optional<std::string>&& dependency) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take by value.

void flag_temporal_id_as_pending(const gsl::not_null<db::DataBox<DbTags>*> box,
const TemporalId& temporal_id) {
const TemporalId& temporal_id,
std::optional<std::string>&& dependency) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take by value.

const typename Metavariables::InterpolatorTargetA::temporal_id::type&
/*temporal_id*/) {
/*temporal_id*/,
std::optional<std::string>&& dependency) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By value.

@knelli2
Copy link
Contributor Author

knelli2 commented May 9, 2025

@wthrowe I squashed directly since it was small

VolumeDataAtObsId received_volume_data) {
// The below gymnastics with pointers is done in order to minimize the
// time spent locking the entire node, which is necessary because the
// DataBox does not allow any functions calls, both get and mutate, during
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code already exists and works, why do this change at all? Moves can be expensive, there's nothing that guarantees they won't. Moves can even fall back to copies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #6624, I add a new threaded action that adds the dependency to the ObserverWriter. Since this can edit/use the same box quantities as ContributeVolumeDataToWriter we have to keep them consistent somehow. The easiest way I saw to do that was to just grab the node lock for both so that everything is guaranteed to be consistent. Along with the likelihood that we aren't writing volume data that often during a simulation compared to the amount of work being done, the simplicity of the node lock seemed a better option than the (comparatively) small performance gain we'd get having all these different locks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, reasonable. If it shows up on profiles we can change it. Thanks for the explanation!

nilsdeppe
nilsdeppe previously approved these changes May 12, 2025
Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do a detailed review.

ping @wthrowe

@wthrowe
Copy link
Member

wthrowe commented May 12, 2025

Needs a rebase.

Also, now that I think of it, if we're not using the volume data lock anymore it would be good to remove it from the initialization action.

@knelli2
Copy link
Contributor Author

knelli2 commented May 13, 2025

@wthrowe Rebased and I removed the tag for the volume lock pointer altogether since that was the only place it was used (squashed into last commit)

@wthrowe
Copy link
Member

wthrowe commented May 13, 2025

Did you forget to add the file? I don't see any changes to src/IO/Observer/Tags.hpp.

@knelli2
Copy link
Contributor Author

knelli2 commented May 13, 2025

Oops, only searched the repo for Tags::VolumeDataLock and so forgot the definition of the tag. Removed it and the test now

@wthrowe wthrowe enabled auto-merge May 13, 2025 03:48
@wthrowe wthrowe disabled auto-merge May 13, 2025 20:38
Copy link
Member

@wthrowe wthrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clang-tidy failure is a reasonable complaint. Either changing it or marking NOLINT would be fine with me.

knelli2 added 3 commits May 13, 2025 15:16
The AddTemporalIdsToInterpolationTarget action now can also pass along
a dependency for each temporal id which is added to a tag in the box.
Currently nothing uses this new tag, and the temporal id is erased
after the interpolation is finished.
We mostly just move volume data around so the complicated pointers
seem pretty unnecessary. Keep the pointer for the H5 file lock
since writing to disk is very slow.
@knelli2
Copy link
Contributor Author

knelli2 commented May 13, 2025

@wthrowe I added a NOLINT

@wthrowe wthrowe merged commit c69d41e into sxs-collaboration:develop May 14, 2025
24 checks passed
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

Successfully merging this pull request may close these issues.

3 participants