-
Notifications
You must be signed in to change notification settings - Fork 33
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
ebchin
wants to merge
7
commits into
develop
Choose a base branch
from
bugfix/chin23/build_no_raja
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
55816b5
fixes for builds with no raja
ebchin 12debca
change raja to umpire where appropriate
ebchin a07d20c
use dynamic memory for all
ebchin 1ccf12d
Merge branch 'develop' into bugfix/chin23/build_no_raja
ebchin b132020
copy arr if needed
ebchin 2a9a146
Merge branch 'develop' into bugfix/chin23/build_no_raja
ebchin 3028760
separate if statements
ebchin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,8 +213,12 @@ std::vector<Array2D<int> > geom_local_face_dofs(int p) | |
return output; | ||
} | ||
|
||
axom::Array<DoF, 2, axom::MemorySpace::Host> GetElementRestriction(const mfem::FiniteElementSpace* fes, | ||
mfem::Geometry::Type geom) | ||
#ifdef SERAC_USE_RAJA | ||
axom::Array<DoF, 2, axom::MemorySpace::Host> | ||
#else | ||
axom::Array<DoF, 2> | ||
#endif | ||
GetElementRestriction(const mfem::FiniteElementSpace* fes, mfem::Geometry::Type geom) | ||
{ | ||
std::vector<DoF> elem_dofs{}; | ||
mfem::Mesh* mesh = fes->GetMesh(); | ||
|
@@ -267,17 +271,29 @@ axom::Array<DoF, 2, axom::MemorySpace::Host> GetElementRestriction(const mfem::F | |
} | ||
|
||
if (n == 0) { | ||
#ifdef SERAC_USE_RAJA | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah makes sense, basically all of the |
||
return axom::Array<DoF, 2, axom::MemorySpace::Host>{}; | ||
#else | ||
return axom::Array<DoF, 2>{}; | ||
#endif | ||
} else { | ||
uint64_t dofs_per_elem = elem_dofs.size() / n; | ||
uint64_t dofs_per_elem = elem_dofs.size() / n; | ||
#ifdef SERAC_USE_RAJA | ||
axom::Array<DoF, 2, axom::MemorySpace::Host> output(n, dofs_per_elem); | ||
#else | ||
axom::Array<DoF, 2> output(n, dofs_per_elem); | ||
#endif | ||
std::memcpy(output.data(), elem_dofs.data(), sizeof(DoF) * n * dofs_per_elem); | ||
return output; | ||
} | ||
} | ||
|
||
axom::Array<DoF, 2, axom::MemorySpace::Host> GetFaceDofs(const mfem::FiniteElementSpace* fes, | ||
mfem::Geometry::Type face_geom, FaceType type) | ||
#ifdef SERAC_USE_RAJA | ||
axom::Array<DoF, 2, axom::MemorySpace::Host> | ||
#else | ||
axom::Array<DoF, 2> | ||
#endif | ||
GetFaceDofs(const mfem::FiniteElementSpace* fes, mfem::Geometry::Type face_geom, FaceType type) | ||
{ | ||
std::vector<DoF> face_dofs; | ||
mfem::Mesh* mesh = fes->GetMesh(); | ||
|
@@ -378,10 +394,18 @@ axom::Array<DoF, 2, axom::MemorySpace::Host> GetFaceDofs(const mfem::FiniteEleme | |
delete face_to_elem; | ||
|
||
if (n == 0) { | ||
#ifdef SERAC_USE_RAJA | ||
return axom::Array<DoF, 2, axom::MemorySpace::Host>{}; | ||
#else | ||
return axom::Array<DoF, 2>{}; | ||
#endif | ||
} else { | ||
uint64_t dofs_per_face = face_dofs.size() / n; | ||
uint64_t dofs_per_face = face_dofs.size() / n; | ||
#ifdef SERAC_USE_RAJA | ||
axom::Array<DoF, 2, axom::MemorySpace::Host> output(n, dofs_per_face); | ||
#else | ||
axom::Array<DoF, 2> output(n, dofs_per_face); | ||
#endif | ||
std::memcpy(output.data(), face_dofs.data(), sizeof(DoF) * n * dofs_per_face); | ||
return output; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 andDynamic
is the one unguarded....https://github.com/LLNL/axom/blob/2244835b3389c427c337b5df782982d2ae609bfe/src/axom/core/memory_management.hpp#L37-L47
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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