Skip to content

Commit

Permalink
Merge pull request #1654 from CEED/jeremy/counting-is-hard
Browse files Browse the repository at this point in the history
gpu - counting points correctly
  • Loading branch information
jeremylt committed Sep 3, 2024
2 parents ac1dfe3 + 2e88d31 commit f04c500
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backends/cuda-ref/ceed-cuda-ref-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ int CeedElemRestrictionCreate_Cuda(CeedMemType mem_type, CeedCopyMode copy_mode,
// -- Use padded offsets for the rest of the setup
offsets = (const CeedInt *)offsets_padded;
copy_mode = CEED_OWN_POINTER;
CeedCallBackend(CeedElemRestrictionSetAtPointsEVectorSize(rstr, at_points_size * num_comp));
CeedCallBackend(CeedElemRestrictionSetAtPointsEVectorSize(rstr, elem_size * num_elem * num_comp));

// -- Points per element
CeedCallBackend(CeedSetHostCeedIntArray(points_per_elem, CEED_OWN_POINTER, num_elem, &impl->h_points_per_elem_owned,
Expand Down
2 changes: 1 addition & 1 deletion backends/hip-ref/ceed-hip-ref-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ int CeedElemRestrictionCreate_Hip(CeedMemType mem_type, CeedCopyMode copy_mode,
// -- Use padded offsets for the rest of the setup
offsets = (const CeedInt *)offsets_padded;
copy_mode = CEED_OWN_POINTER;
CeedCallBackend(CeedElemRestrictionSetAtPointsEVectorSize(rstr, at_points_size * num_comp));
CeedCallBackend(CeedElemRestrictionSetAtPointsEVectorSize(rstr, elem_size * num_elem * num_comp));

// -- Points per element
CeedCallBackend(CeedSetHostCeedIntArray(points_per_elem, CEED_OWN_POINTER, num_elem, &impl->h_points_per_elem_owned,
Expand Down
6 changes: 4 additions & 2 deletions interface/ceed-basis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,14 +1640,16 @@ static int CeedBasisApplyAtPointsCheckDims(CeedBasis basis, CeedInt num_elem, co
if (u != CEED_VECTOR_NONE) CeedCall(CeedVectorGetLength(u, &u_length));

// Check compatibility of topological and geometrical dimensions
for (CeedInt i = 0; i < num_elem; i++) total_num_points += num_points[i];
CeedCheck((t_mode == CEED_TRANSPOSE && v_length % num_nodes == 0) || (t_mode == CEED_NOTRANSPOSE && u_length % num_nodes == 0) ||
(eval_mode == CEED_EVAL_WEIGHT),
ceed, CEED_ERROR_DIMENSION, "Length of input/output vectors incompatible with basis dimensions and number of points");

// Check compatibility coordinates vector
for (CeedInt i = 0; i < num_elem; i++) total_num_points += num_points[i];
CeedCheck((x_length >= total_num_points * dim) || (eval_mode == CEED_EVAL_WEIGHT), ceed, CEED_ERROR_DIMENSION,
"Length of reference coordinate vector incompatible with basis dimension and number of points");
"Length of reference coordinate vector incompatible with basis dimension and number of points."
" Found reference coordinate vector of length %" CeedSize_FMT ", not of length %" CeedSize_FMT ".",
x_length, total_num_points * dim);

// Check CEED_EVAL_WEIGHT only on CEED_NOTRANSPOSE
CeedCheck(eval_mode != CEED_EVAL_WEIGHT || t_mode == CEED_NOTRANSPOSE, ceed, CEED_ERROR_UNSUPPORTED,
Expand Down

0 comments on commit f04c500

Please sign in to comment.