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

fixes for builds with no raja or umpire #1270

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

ebchin
Copy link
Member

@ebchin ebchin commented Nov 12, 2024

I tried building serac without RAJA or Umpire and found some code that needs some #ifdef macros around it. This PR adds them.

@ebchin ebchin self-assigned this Nov 12, 2024
@@ -267,17 +271,29 @@ axom::Array<DoF, 2, axom::MemorySpace::Host> GetElementRestriction(const mfem::F
}

if (n == 0) {
#ifdef SERAC_USE_RAJA
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be SERAC_USE_UMPIRE

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah makes sense, basically all of the axom::MemorySpace::Host stuff needs to be fixed.

@ebchin ebchin changed the title fixes for builds with no raja fixes for builds with no raja or umpire Nov 12, 2024
@ebchin ebchin requested a review from white238 November 12, 2024 19:04
void write_to_file(axom::Array<T, 2, axom::MemorySpace::Host> arr, std::string filename)
#else
Copy link
Member

Choose a reason for hiding this comment

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

You would think that Host would always be there but its guarded in axom and Dynamic is the one unguarded....

https://github.com/LLNL/axom/blob/2244835b3389c427c337b5df782982d2ae609bfe/src/axom/core/memory_management.hpp#L37-L47

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like host should be safe to unguard in addition to dynamic? Regardless, we could use dynamic + umpire allocator IDs to achieve the same without the clunky #ifdef blocks. Though we would lose the explicit typing of the memory. Thoughts?

Copy link
Member

@white238 white238 Nov 12, 2024

Choose a reason for hiding this comment

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

I say go with Dynamic for now to avoid the ifdef's... but this really needs to be revisited. Might need to chat with Axom about this.

Copy link
Member

Choose a reason for hiding this comment

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

@white238 and I spoke -- it makes sense to go with (the default) Dynamic

Copy link
Member Author

@ebchin ebchin Nov 14, 2024

Choose a reason for hiding this comment

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

It's not clear to me Dynamic will give the desired result when the original axom::Array is on device. It seems like this copy constructor will be called: https://github.com/LLNL/axom/blob/develop/src/axom/core/Array.hpp#L1180-L1190 which copies the allocator ID from the existing array. The result will be an array on device and the operator() call on L88 will fail. Is there a different copy constructor being called by this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Implemented a fix suggested by @kennyweiss

@chapman39
Copy link
Contributor

Should we test this in CI? Maybe in Azure?

Copy link
Contributor

@chapman39 chapman39 left a comment

Choose a reason for hiding this comment

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

thanks @ebchin !

@ebchin
Copy link
Member Author

ebchin commented Nov 12, 2024

Should we test this in CI? Maybe in Azure?

We probably don't want to get into all of the combinatorics, but I see the value in adding a CI test with minimal TPLs, just to check stuff like this.

@ebchin ebchin requested a review from white238 November 15, 2024 00:11
}
outfile << "}\n";
}
} else if constexpr(ArrayT::Dims == 3) {
Copy link
Member

Choose a reason for hiding this comment

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

We got compiler errors when we have else if constexpr before. Can you remove the else and make it just two if constexpr blocks?

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.

4 participants