-
Notifications
You must be signed in to change notification settings - Fork 73
cuda: Remove compile-time dependence on maximum number of points per elements #1990
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,17 +174,20 @@ static int CeedOperatorApplyAddCore_Cuda_gen(CeedOperator op, CUstream stream, c | |
| CeedCallBackend(CeedOperatorIsAtPoints(op, &is_at_points)); | ||
| if (is_at_points) { | ||
| // Coords | ||
| CeedVector vec; | ||
| CeedVector vec; | ||
| CeedElemRestriction rstr_points = NULL; | ||
|
|
||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, NULL, &vec)); | ||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, &rstr_points, &vec)); | ||
| CeedCallBackend(CeedVectorGetArrayRead(vec, CEED_MEM_DEVICE, &data->points.coords)); | ||
| CeedCallBackend(CeedElemRestrictionGetMaxPointsInElement(rstr_points, &data->points.max_num_points)); | ||
| CeedCallBackend(CeedElemRestrictionGetCompStride(rstr_points, &data->points.coords_comp_stride)); | ||
|
Member
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. ... should this be allowed to change?
Collaborator
Author
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'm relatively sure that is usually also max num points, see the shared basis functions.
Member
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. hmm, if that's the case this a separate duplicate value shouldn't exist
Member
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. hmm, if that's the case this a separate duplicate value shouldn't exist
Collaborator
Author
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, i think that it's because of the different striding between CPU and GPU, but we know what the striding will be so we can reduce the complexity. |
||
| CeedCallBackend(CeedVectorDestroy(&vec)); | ||
| CeedCallBackend(CeedElemRestrictionDestroy(&rstr_points)); | ||
|
|
||
| // Points per elem | ||
| if (num_elem != data->points.num_elem) { | ||
| CeedInt *points_per_elem; | ||
| const CeedInt num_bytes = num_elem * sizeof(CeedInt); | ||
| CeedElemRestriction rstr_points = NULL; | ||
| CeedInt *points_per_elem; | ||
| const CeedInt num_bytes = num_elem * sizeof(CeedInt); | ||
|
|
||
| data->points.num_elem = num_elem; | ||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, &rstr_points, NULL)); | ||
|
|
@@ -608,11 +611,15 @@ static int CeedOperatorLinearAssembleAddDiagonalAtPoints_Cuda_gen(CeedOperator o | |
|
|
||
| // Point coordinates | ||
| { | ||
| CeedVector vec; | ||
| CeedVector vec; | ||
| CeedElemRestriction rstr_points = NULL; | ||
|
|
||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, NULL, &vec)); | ||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, &rstr_points, &vec)); | ||
| CeedCallBackend(CeedVectorGetArrayRead(vec, CEED_MEM_DEVICE, &data->points.coords)); | ||
| CeedCallBackend(CeedElemRestrictionGetMaxPointsInElement(rstr_points, &data->points.max_num_points)); | ||
| CeedCallBackend(CeedElemRestrictionGetCompStride(rstr_points, &data->points.coords_comp_stride)); | ||
| CeedCallBackend(CeedVectorDestroy(&vec)); | ||
| CeedCallBackend(CeedElemRestrictionDestroy(&rstr_points)); | ||
|
|
||
| // Points per elem | ||
| if (num_elem != data->points.num_elem) { | ||
|
|
@@ -774,11 +781,15 @@ static int CeedOperatorAssembleSingleAtPoints_Cuda_gen(CeedOperator op, CeedInt | |
|
|
||
| // Point coordinates | ||
| { | ||
| CeedVector vec; | ||
| CeedVector vec; | ||
| CeedElemRestriction rstr_points = NULL; | ||
|
|
||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, NULL, &vec)); | ||
| CeedCallBackend(CeedOperatorAtPointsGetPoints(op, &rstr_points, &vec)); | ||
| CeedCallBackend(CeedVectorGetArrayRead(vec, CEED_MEM_DEVICE, &data->points.coords)); | ||
| CeedCallBackend(CeedElemRestrictionGetMaxPointsInElement(rstr_points, &data->points.max_num_points)); | ||
|
Member
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. same here - should only re-compute if the rstr changed (really, should be something we can query if we create an interface to update the points rstr, which we should only allow if the number of elements does not change)
Collaborator
Author
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. does that function not cache the result? if not, we should cache and invalidate when updating the points
Member
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. The function could cache yea. But the restriction should never update it because you would need a new restriction |
||
| CeedCallBackend(CeedElemRestrictionGetCompStride(rstr_points, &data->points.coords_comp_stride)); | ||
| CeedCallBackend(CeedVectorDestroy(&vec)); | ||
| CeedCallBackend(CeedElemRestrictionDestroy(&rstr_points)); | ||
|
|
||
| // Points per elem | ||
| if (num_elem != data->points.num_elem) { | ||
|
|
||
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.
this should only change if the restriction changes, see the other comment about avoiding re-computing