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

Feature/sina/hdf5 output support #1480

Merged
merged 63 commits into from
Apr 8, 2025
Merged

Conversation

doutriaux1
Copy link
Contributor

Summary

  • This PR is a feature
  • It does the following (modify list as needed):
    • Adds the capacity to output sina files as hdf5 and opens the door for more formats in the future

message << "The '" << RELATIONSHIPS_KEY
<< "' element of a document must be an array";
throw std::invalid_argument(message.str());
conduit::Node relationship_nodes = asNode[RELATIONSHIPS_KEY];
Copy link
Member

Choose a reason for hiding this comment

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

this should be a ref to avoid a copy

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed as many copies as I could, this one underwent additional changes

conduit::Node modifiedRelationshipsNode;

removeSlashes(relationshipNode, modifiedRelationshipsNode);
relationshipsNode.append() = modifiedRelationshipsNode;
Copy link
Member

Choose a reason for hiding this comment

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

you could pass ref to append result into removeSlashes to avoid one extra copy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy removed

Copy link
Member

@cyrush cyrush Jan 24, 2025

Choose a reason for hiding this comment

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

are the changes pushed? I see:

removeSlashes(relationshipNode, modifiedRelationshipsNode);
        relationshipsNode.append() = modifiedRelationshipsNode;

however, I expect something like:

removeSlashes(relationshipNode, relationshipsNode.append());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cyrush @gwaegner cannot push. I just pushed the changes.

src/spack Outdated
Copy link
Member

Choose a reason for hiding this comment

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

was this sub module add intended?

Copy link
Contributor

Choose a reason for hiding this comment

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

Submodule removed

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the PR is trying to make unintended changes to submodules (blt, data, radiuss-spack-configs)

Copy link
Contributor

Choose a reason for hiding this comment

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

Submodule changes came from develop merges, double checked for intentionality

Copy link
Member

@bgunnar5 bgunnar5 left a comment

Choose a reason for hiding this comment

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

Left some suggestions for you. Also wondering if the fortran changes are tested?

@doutriaux1
Copy link
Contributor Author

@gwaegner please take a look at the failures

@kennyweiss kennyweiss requested a review from bmhan12 January 27, 2025 22:19
Copy link
Contributor

@bmhan12 bmhan12 left a comment

Choose a reason for hiding this comment

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

The updated ReadTheDocs documentation for this PR can be previewed here: https://axom.readthedocs.io/en/feature-sina-hdf5_output_support/axom/sina/docs/sphinx/index.html

conduit::Node &newChild = restoredNode.add_child(restoredKey);

// Leaves empty keys empty but continues recursive call if its a list
if(it.node().dtype().is_string() || it.node().dtype().is_number() ||
Copy link
Member

@white238 white238 Apr 2, 2025

Choose a reason for hiding this comment

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

This could be more readable and possibly more efficent if you stored the type then checked instead of calling the same function again and again.

Something like:

auto dtype = it.node().dtype();
if (dtype.is_string() || dtype.is_number() || dtype.is_object())
{
   newChild.set(it.node());
}
else if(dtype.is_list())
{
   restoreSlashes(it.node(), newChild);  // Handle nested lists
}

Copy link
Contributor

Choose a reason for hiding this comment

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

it.node().dtype() stored as an auto data_type that is now referenced instead of additional calls.

}

} // namespace sina
} // namespace axom
} // namespace axom
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} // namespace axom
} // namespace axom

Copy link
Contributor

Choose a reason for hiding this comment

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

Implemented.


In addition to assembling ``Document`` instances from existing JSON files, it
is possible to generate ``Document`` objects from existing HDF5 files using
conduit.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
conduit.
Conduit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed.

@@ -0,0 +1,55 @@
.. ## Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and
Copy link
Member

Choose a reason for hiding this comment

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

As far as I can tell this is not showing up in the Sphinx documentation. Also the "Records" page is a bad link.

Copy link
Member

Choose a reason for hiding this comment

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

{56E28D8E-E43B-49E2-9D3C-3D49B0D4F49C}

Copy link
Member

Choose a reason for hiding this comment

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

It is probably because of line 6 needing to be unique and also it needs to be added to the toctree probably here:

Copy link
Contributor

Choose a reason for hiding this comment

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

HDF5_vs_JSON nested in the Documents page as a new toctree, broken links on the Documents page are fixed.

Once you have a document, it is easy to save it to a file. To save to a JSON, we
run the saveDocument() with the optional argument Protocol set to JSON or set as
nothing. Alternatively if you wish to save the document to an HDF5 file: Configure
axom for HDF5 support then you can set saveDocument()'s optional Protocol parameter
Copy link
Member

Choose a reason for hiding this comment

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

There is a lot of code in these paragraphs that is not formatted. A lot of it is pre-existing but should be fixed at some point. I would be fine if it happened after this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can look into adjusting this one for my Append MR, it will just need this one merged first.

@white238
Copy link
Member

white238 commented Apr 2, 2025

Some minor changes on my end then it is fine to be merged. The reason for wanting a newline at the end of a file is because it can lead to obscure issues that are very hard to track down.

Copy link
Member

@white238 white238 left a comment

Choose a reason for hiding this comment

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

Fix docs and minor tweaks

@gwaegner gwaegner requested a review from white238 April 3, 2025 18:36
@white238
Copy link
Member

white238 commented Apr 7, 2025

/style

@kennyweiss kennyweiss merged commit 5e0c4b4 into develop Apr 8, 2025
13 checks passed
@kennyweiss kennyweiss deleted the feature/sina/hdf5_output_support branch April 8, 2025 01:18
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.

10 participants