Skip to content

Commit

Permalink
Merge pull request CEED#1674 from CEED/jeremy/cov-excl
Browse files Browse the repository at this point in the history
Houskeeping
  • Loading branch information
jeremylt authored Sep 26, 2024
2 parents 8f302d0 + 6c10af5 commit 01ecf5b
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 24 deletions.
3 changes: 2 additions & 1 deletion backends/memcheck/ceed-memcheck-vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ static int CeedVectorRestoreArray_Memcheck(CeedVector vec) {
// Check for unset entries after write-only access
if (impl->is_write_only_access) {
for (CeedSize i = 0; i < length; i++) {
if (isnan(impl->array_writable_copy[i]))
if (isnan(impl->array_writable_copy[i])) {
CeedDebug256(ceed, CEED_DEBUG_COLOR_WARNING, "WARNING: Vec entry %" CeedSize_FMT " is NaN after restoring write-only access", i);
}
}
impl->is_write_only_access = false;
}
Expand Down
3 changes: 2 additions & 1 deletion examples/ceed/ex1-volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ int BuildCartesianRestriction(Ceed ceed, CeedInt dim, CeedInt num_xyz[dim], Ceed
}
CeedElemRestrictionCreate(ceed, num_elem, num_nodes, num_comp, scalar_size, num_comp * scalar_size, CEED_MEM_HOST, CEED_COPY_VALUES, elem_nodes,
restriction);
if (q_data_restriction)
if (q_data_restriction) {
CeedElemRestrictionCreateStrided(ceed, num_elem, elem_qpts, num_comp, num_comp * elem_qpts * num_elem, CEED_STRIDES_BACKEND, q_data_restriction);
}
free(elem_nodes);
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion examples/ceed/ex2-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ int BuildCartesianRestriction(Ceed ceed, CeedInt dim, CeedInt num_xyz[3], CeedIn
local_elem_nodes[l_nodes] = g_nodes;
}
}
if (restriction)
if (restriction) {
CeedElemRestrictionCreate(ceed, num_elem, num_nodes, num_comp, scalar_size, num_comp * scalar_size, CEED_MEM_HOST, CEED_COPY_VALUES, el_nodes,
restriction);
}
free(el_nodes);

if (q_data_restriction) {
Expand Down
12 changes: 8 additions & 4 deletions examples/fluids/src/petsc_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,37 @@ PetscErrorCode OperatorApplyContextCreate(DM dm_x, DM dm_y, Ceed ceed, CeedOpera
PetscCall(VecGetLocalSize(X_loc, &X_size));
PetscCheck(X_size == x_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"X_loc (%" PetscInt_FMT ") not correct size for CeedOperator active input size (%" CeedSize_FMT ")", X_size, x_size);
if (dm_x)
if (dm_x) {
PetscCheck(X_size == dm_X_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"X_loc size (%" PetscInt_FMT ") does not match dm_x local vector size (%" PetscInt_FMT ")", X_size, dm_X_size);
}
}
if (Y_loc) {
PetscCall(VecGetLocalSize(Y_loc, &Y_size));
PetscCheck(Y_size == y_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"Y_loc (%" PetscInt_FMT ") not correct size for CeedOperator active output size (%" CeedSize_FMT ")", Y_size, y_size);
if (dm_y)
if (dm_y) {
PetscCheck(Y_size == dm_Y_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"Y_loc size (%" PetscInt_FMT ") does not match dm_y local vector size (%" PetscInt_FMT ")", Y_size, dm_Y_size);
}
}
if (x_ceed && x_ceed != CEED_VECTOR_NONE) {
PetscCallCeed(ceed, CeedVectorGetLength(x_ceed, &x_ceed_size));
PetscCheck(x_size >= 0 ? x_ceed_size == x_size : true, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"x_ceed (%" CeedSize_FMT ") not correct size for CeedOperator active input size (%" CeedSize_FMT ")", x_ceed_size, x_size);
if (dm_x)
if (dm_x) {
PetscCheck(x_ceed_size == dm_X_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"x_ceed size (%" CeedSize_FMT ") does not match dm_x local vector size (%" PetscInt_FMT ")", x_ceed_size, dm_X_size);
}
}
if (y_ceed && y_ceed != CEED_VECTOR_NONE) {
PetscCallCeed(ceed, CeedVectorGetLength(y_ceed, &y_ceed_size));
PetscCheck(y_ceed_size == y_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"y_ceed (%" CeedSize_FMT ") not correct size for CeedOperator active input size (%" CeedSize_FMT ")", y_ceed_size, y_size);
if (dm_y)
if (dm_y) {
PetscCheck(y_ceed_size == dm_Y_size, PETSC_COMM_WORLD, PETSC_ERR_ARG_SIZ,
"y_ceed size (%" CeedSize_FMT ") does not match dm_y local vector size (%" PetscInt_FMT ")", y_ceed_size, dm_Y_size);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion examples/fluids/src/setuplibceed.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ static PetscErrorCode AddBCSubOperator(Ceed ceed, DM dm, CeedData ceed_data, DML
PetscCallCeed(ceed, CeedOperatorSetField(op_apply_bc, "surface qdata", elem_restr_qd_i_sur, CEED_BASIS_NONE, q_data_sur));
PetscCallCeed(ceed, CeedOperatorSetField(op_apply_bc, "x", elem_restr_x_sur, basis_x_sur, ceed_data->x_coord));
PetscCallCeed(ceed, CeedOperatorSetField(op_apply_bc, "v", elem_restr_q_sur, basis_q_sur, CEED_VECTOR_ACTIVE));
if (elem_restr_jd_i_sur)
if (elem_restr_jd_i_sur) {
PetscCallCeed(ceed, CeedOperatorSetField(op_apply_bc, "surface jacobian data", elem_restr_jd_i_sur, CEED_BASIS_NONE, jac_data_sur));
}

if (qf_apply_bc_jacobian && elem_restr_jd_i_sur) {
PetscCallCeed(ceed, CeedOperatorCreate(ceed, qf_apply_bc_jacobian, NULL, NULL, &op_apply_bc_jacobian));
Expand Down
3 changes: 2 additions & 1 deletion examples/petsc/bpsraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,9 @@ int main(int argc, char **argv) {
l_to_g_ind[here] = g_start[ir][jr][kr] + (ii * g_m_nodes[ir][jr][kr][1] + jj) * g_m_nodes[ir][jr][kr][2] + kk;
if ((i_rank[0] == 0 && i == 0) || (i_rank[1] == 0 && j == 0) || (i_rank[2] == 0 && k == 0) ||
(i_rank[0] + 1 == p[0] && i + 1 == l_nodes[0]) || (i_rank[1] + 1 == p[1] && j + 1 == l_nodes[1]) ||
(i_rank[2] + 1 == p[2] && k + 1 == l_nodes[2]))
(i_rank[2] + 1 == p[2] && k + 1 == l_nodes[2])) {
continue;
}
l_to_g_ind_0[l_0_count] = l_to_g_ind[here];
loc_ind[l_0_count++] = here;
}
Expand Down
5 changes: 0 additions & 5 deletions examples/solids/src/setup-libceed.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
#include "../qfunctions/manufactured-force.h" // Manufactured solution forcing
#include "../qfunctions/traction-boundary.h" // Traction boundaries

#if PETSC_VERSION_LT(3, 14, 0)
#define DMPlexGetClosureIndices(a, b, c, d, e, f, g, h, i) DMPlexGetClosureIndices(a, b, c, d, f, g, i)
#define DMPlexRestoreClosureIndices(a, b, c, d, e, f, g, h, i) DMPlexRestoreClosureIndices(a, b, c, d, f, g, i)
#endif

// -----------------------------------------------------------------------------
// Problem options
// -----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion interface/ceed-preconditioning.c
Original file line number Diff line number Diff line change
Expand Up @@ -2848,8 +2848,9 @@ int CeedOperatorCreateFDMElementInverse(CeedOperator op, CeedOperator *fdm_inv,
CeedCall(CeedVectorGetArrayWrite(q_data, CEED_MEM_HOST, &q_data_array));
for (CeedInt e = 0; e < num_elem; e++) {
for (CeedInt c = 0; c < num_comp; c++) {
for (CeedInt n = 0; n < num_nodes; n++)
for (CeedInt n = 0; n < num_nodes; n++) {
q_data_array[(e * num_comp + c) * num_nodes + n] = 1. / (elem_avg[e] * fdm_diagonal[c * num_nodes + n]);
}
}
}
CeedCall(CeedFree(&elem_avg));
Expand Down
5 changes: 3 additions & 2 deletions tests/t217-elemrestriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ int main(int argc, char **argv) {

CeedVectorGetArrayRead(x, CEED_MEM_HOST, &x_array);
for (CeedInt i = 0; i < num_elem + 1; i++) {
if (x_array[i] != (10 + i) * (i > 0 && i < num_elem ? 2.0 : 1.0))
if (x_array[i] != (10 + i) * (i > 0 && i < num_elem ? 2.0 : 1.0)) {
// LCOV_EXCL_START
printf("Error in restricted array x[%" CeedInt_FMT "] = %f\n", i, (CeedScalar)x_array[i]);
// LCOV_EXCL_STOP
// LCOV_EXCL_STOP
}
}
CeedVectorRestoreArrayRead(x, &x_array);
}
Expand Down
10 changes: 8 additions & 2 deletions tests/t319-basis.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,19 @@ int main(int argc, char **argv) {
CeedScalar tol = 100 * CEED_EPSILON;

for (CeedInt i = 0; i < 4 * 8; i++) {
if (fabs(interp_proj[i] - ((CeedScalar *)interp_proj_ref)[i]) > tol)
if (fabs(interp_proj[i] - ((CeedScalar *)interp_proj_ref)[i]) > tol) {
// LCOV_EXCL_START
printf("Mixed Topology Projection: interp[%" CeedInt_FMT "] expected %f, got %f\n", i, interp_proj[i], ((CeedScalar *)interp_proj_ref)[i]);
// LCOV_EXCL_STOP
}
}

for (CeedInt i = 0; i < 3 * 4 * 8; i++) {
if (fabs(grad_proj[i] - ((CeedScalar *)grad_proj_ref)[i]) > tol)
if (fabs(grad_proj[i] - ((CeedScalar *)grad_proj_ref)[i]) > tol) {
// LCOV_EXCL_START
printf("Mixed Topology Projection: grad[%" CeedInt_FMT "] expected %f, got %f\n", i, grad_proj[i], ((CeedScalar *)grad_proj_ref)[i]);
// LCOV_EXCL_STOP
}
}

CeedBasisDestroy(&basis_face);
Expand Down
3 changes: 2 additions & 1 deletion tests/t530-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ int main(int argc, char **argv) {

CeedVectorGetArrayRead(qf_assembled, CEED_MEM_HOST, &assembled_array);
CeedVectorGetArrayRead(q_data, CEED_MEM_HOST, &q_data_array);
for (CeedInt i = 0; i < num_qpts; i++)
for (CeedInt i = 0; i < num_qpts; i++) {
if (fabs(q_data_array[i] - assembled_array[i]) > 1e-9) {
// LCOV_EXCL_START
printf("Error: qf_assembled[%" CeedInt_FMT "] = %f != %f\n", i, assembled_array[i], q_data_array[i]);
// LCOV_EXCL_STOP
}
}
CeedVectorRestoreArrayRead(qf_assembled, &assembled_array);
CeedVectorRestoreArrayRead(q_data, &q_data_array);
}
Expand Down
5 changes: 4 additions & 1 deletion tests/t531-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ int main(int argc, char **argv) {
CeedVectorGetArrayRead(v, CEED_MEM_HOST, &v_array);
CeedVectorGetArrayRead(v_assembled, CEED_MEM_HOST, &v_assembled_array);
for (CeedInt i = 0; i < num_dofs; i++) {
if (fabs(v_array[i] - v_assembled_array[i]) > 100. * CEED_EPSILON)
if (fabs(v_array[i] - v_assembled_array[i]) > 100. * CEED_EPSILON) {
// LCOV_EXCL_START
printf("Error: Linearized operator computed v[i] = %f != %f\n", v_assembled_array[i], v_array[i]);
// LCOV_EXCL_STOP
}
}
CeedVectorRestoreArrayRead(v, &v_array);
CeedVectorRestoreArrayRead(v_assembled, &v_assembled_array);
Expand Down
6 changes: 4 additions & 2 deletions tests/t533-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ int main(int argc, char **argv) {
{
CeedScalar x_array[dim * num_dofs];

for (CeedInt i = 0; i < nx * 2 + 1; i++)
for (CeedInt i = 0; i < nx * 2 + 1; i++) {
for (CeedInt j = 0; j < ny * 2 + 1; j++) {
x_array[i + j * (nx * 2 + 1) + 0 * num_dofs] = (CeedScalar)i / (2 * nx);
x_array[i + j * (nx * 2 + 1) + 1 * num_dofs] = (CeedScalar)j / (2 * ny);
}
}
CeedVectorSetArray(x, CEED_MEM_HOST, CEED_COPY_VALUES, x_array);
}
CeedVectorCreate(ceed, num_dofs, &u);
Expand All @@ -45,8 +46,9 @@ int main(int argc, char **argv) {
col = i % nx;
row = i / nx;
offset = col * (p - 1) + row * (nx * 2 + 1) * (p - 1);
for (CeedInt j = 0; j < p; j++)
for (CeedInt j = 0; j < p; j++) {
for (CeedInt k = 0; k < p; k++) ind_x[p * (p * i + k) + j] = offset + k * (nx * 2 + 1) + j;
}
}
CeedElemRestrictionCreate(ceed, num_elem, p * p, dim, num_dofs, dim * num_dofs, CEED_MEM_HOST, CEED_USE_POINTER, ind_x, &elem_restriction_x);
CeedElemRestrictionCreate(ceed, num_elem, p * p, 1, 1, num_dofs, CEED_MEM_HOST, CEED_USE_POINTER, ind_x, &elem_restriction_u);
Expand Down
3 changes: 2 additions & 1 deletion tests/t592-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ int main(int argc, char **argv) {

CeedVectorGetArrayRead(qf_assembled, CEED_MEM_HOST, &assembled_array);
CeedVectorGetArrayRead(q_data, CEED_MEM_HOST, &q_data_array);
for (CeedInt i = 0; i < num_points; i++)
for (CeedInt i = 0; i < num_points; i++) {
if (fabs(q_data_array[i] - assembled_array[i]) > 1e-9) {
// LCOV_EXCL_START
printf("Error: qf_assembled[%" CeedInt_FMT "] = %f != %f\n", i, assembled_array[i], q_data_array[i]);
// LCOV_EXCL_STOP
}
}
CeedVectorRestoreArrayRead(qf_assembled, &assembled_array);
CeedVectorRestoreArrayRead(q_data, &q_data_array);
}
Expand Down

0 comments on commit 01ecf5b

Please sign in to comment.