Skip to content

Commit

Permalink
cuda - update shared max matrix sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Jan 3, 2025
1 parent 0ff6123 commit 5d36201
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions backends/cuda-shared/ceed-cuda-shared-basis.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ int CeedBasisCreateH1_Cuda_shared(CeedElemTopology topo, CeedInt dim, CeedInt nu
CeedCallBackend(CeedBasisGetCeed(basis, &ceed));
CeedCallBackend(CeedCalloc(1, &data));

// Check max dim
CeedCheck(dim <= 3, ceed, CEED_ERROR_BACKEND, "Backend does not implement nontensor bases with dim > 3");

// Copy basis data to GPU
CeedCallBackend(CeedBasisGetNumQuadratureComponents(basis, CEED_EVAL_INTERP, &q_comp_interp));
CeedCallBackend(CeedBasisGetNumQuadratureComponents(basis, CEED_EVAL_GRAD, &q_comp_grad));
Expand All @@ -651,6 +654,7 @@ int CeedBasisCreateH1_Cuda_shared(CeedElemTopology topo, CeedInt dim, CeedInt nu
if (interp) {
const CeedInt interp_bytes = q_bytes * num_nodes * q_comp_interp;

CeedCheck(interp_bytes < 45 * 45 * 8, ceed, CEED_ERROR_BACKEND, "Backend does not implement nontensor bases with P * Q this large");
CeedCallCuda(ceed, cudaMalloc((void **)&data->d_interp_1d, interp_bytes));
CeedCallCuda(ceed, cudaMemcpy(data->d_interp_1d, interp, interp_bytes, cudaMemcpyHostToDevice));
}
Expand Down
6 changes: 3 additions & 3 deletions backends/cuda-shared/kernels/cuda-shared-basis.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <ceed.h>
#include <cuda.h>

const int sizeMax = 16;
__constant__ CeedScalar c_B[sizeMax * sizeMax];
__constant__ CeedScalar c_G[sizeMax * sizeMax];
const int MAX_SIZE = 45, MAX_DIM = 3;
__constant__ CeedScalar c_B[MAX_SIZE * MAX_SIZE];
__constant__ CeedScalar c_G[MAX_SIZE * MAX_SIZE * MAX_DIM];

//------------------------------------------------------------------------------
// Interp device initialization
Expand Down

0 comments on commit 5d36201

Please sign in to comment.