Skip to content

Commit

Permalink
gpu - fix restr bug I added, need to sum into target
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Dec 15, 2021
1 parent c7df0e5 commit 8b51f80
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion backends/cuda/ceed-cuda-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// libraries and APIs for efficient high-order finite element and spectral
// element discretizations for exascale applications. For more information and
// source code availability see http://github.com/ceed.
//
// The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
// a collaborative effort of two U.S. Department of Energy organizations (Office
// of Science and the National Nuclear Security Administration) responsible for
Expand Down Expand Up @@ -150,6 +149,9 @@ static int CeedOperatorSetupFields_Cuda(CeedQFunction qf, CeedOperator op,
ierr = CeedElemRestrictionCreateVector(Erestrict, NULL,
&evecs[i + starte]);
CeedChkBackend(ierr);
// Allocate array
ierr = CeedVectorSetArray(evecs[i + starte], CEED_MEM_DEVICE, CEED_COPY_VALUES,
NULL); CeedChkBackend(ierr);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/cuda/ceed-cuda-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int CeedElemRestrictionApply_Cuda(CeedElemRestriction r,
const CeedScalar *d_u;
CeedScalar *d_v;
ierr = CeedVectorGetArrayRead(u, CEED_MEM_DEVICE, &d_u); CeedChkBackend(ierr);
ierr = CeedVectorGetArrayWrite(v, CEED_MEM_DEVICE, &d_v); CeedChkBackend(ierr);
ierr = CeedVectorGetArray(v, CEED_MEM_DEVICE, &d_v); CeedChkBackend(ierr);

// Restrict
if (tmode == CEED_NOTRANSPOSE) {
Expand Down
1 change: 1 addition & 0 deletions backends/cuda/ceed-cuda-vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ static int CeedVectorGetArrayWrite_Cuda(const CeedVector vec,

bool has_array_of_type = true;
ierr = CeedVectorHasArrayOfType_Cuda(vec, mtype, &has_array_of_type);
CeedChkBackend(ierr);
if (!has_array_of_type) {
// Allocate if array is not yet allocated
ierr = CeedVectorSetArray(vec, mtype, CEED_COPY_VALUES, NULL);
Expand Down
3 changes: 3 additions & 0 deletions backends/hip/ceed-hip-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ static int CeedOperatorSetupFields_Hip(CeedQFunction qf, CeedOperator op,
ierr = CeedElemRestrictionCreateVector(Erestrict, NULL,
&evecs[i + starte]);
CeedChkBackend(ierr);
// Allocate array
ierr = CeedVectorSetArray(evecs[i + starte], CEED_MEM_DEVICE, CEED_COPY_VALUES,
NULL); CeedChkBackend(ierr);
}
}

Expand Down
2 changes: 1 addition & 1 deletion backends/hip/ceed-hip-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static int CeedElemRestrictionApply_Hip(CeedElemRestriction r,
const CeedScalar *d_u;
CeedScalar *d_v;
ierr = CeedVectorGetArrayRead(u, CEED_MEM_DEVICE, &d_u); CeedChkBackend(ierr);
ierr = CeedVectorGetArrayWrite(v, CEED_MEM_DEVICE, &d_v); CeedChkBackend(ierr);
ierr = CeedVectorGetArray(v, CEED_MEM_DEVICE, &d_v); CeedChkBackend(ierr);

// Restrict
if (tmode == CEED_NOTRANSPOSE) {
Expand Down
4 changes: 2 additions & 2 deletions examples/petsc/area.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ int main(int argc, char **argv) {
// Setup libCEED's objects and apply setup operator
ierr = PetscMalloc1(1, &ceed_data); CHKERRQ(ierr);
ierr = SetupLibceedByDegree(dm, ceed, degree, topo_dim, q_extra, num_comp_x,
num_comp_u,
g_size, xl_size, problem_options[problem_choice], ceed_data,
num_comp_u, g_size, xl_size,
problem_options[problem_choice], ceed_data,
false, (CeedVector)NULL, (CeedVector *)NULL);
CHKERRQ(ierr);

Expand Down

0 comments on commit 8b51f80

Please sign in to comment.