diff --git a/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp b/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp index 28583b103b..eb8d5ad848 100644 --- a/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp +++ b/backends/cuda-gen/ceed-cuda-gen-operator-build.cpp @@ -777,11 +777,11 @@ extern "C" int CeedOperatorBuildKernel_Cuda_gen(CeedOperator op) { // Initialize constants, and matrices B and G code << "\n // Input field constants and basis data\n"; for (CeedInt i = 0; i < num_input_fields; i++) { - CeedCall(CeedOperatorBuildKernelFieldData_Cuda_gen(code, data, i, op_input_fields[i], qf_input_fields[i], Q_1d, true, use_3d_slices)); + CeedCallBackend(CeedOperatorBuildKernelFieldData_Cuda_gen(code, data, i, op_input_fields[i], qf_input_fields[i], Q_1d, true, use_3d_slices)); } code << "\n // Output field constants and basis data\n"; for (CeedInt i = 0; i < num_output_fields; i++) { - CeedCall(CeedOperatorBuildKernelFieldData_Cuda_gen(code, data, i, op_output_fields[i], qf_output_fields[i], Q_1d, false, use_3d_slices)); + CeedCallBackend(CeedOperatorBuildKernelFieldData_Cuda_gen(code, data, i, op_output_fields[i], qf_output_fields[i], Q_1d, false, use_3d_slices)); } // Loop over all elements diff --git a/backends/cuda-gen/ceed-cuda-gen.c b/backends/cuda-gen/ceed-cuda-gen.c index e1833be2a2..fd4fcef722 100644 --- a/backends/cuda-gen/ceed-cuda-gen.c +++ b/backends/cuda-gen/ceed-cuda-gen.c @@ -31,7 +31,7 @@ static int CeedInit_Cuda_gen(const char *resource, Ceed ceed) { CeedCallBackend(CeedSetData(ceed, data)); CeedCallBackend(CeedInit_Cuda(ceed, resource)); - CeedCall(CeedInit("/gpu/cuda/shared", &ceed_shared)); + CeedCallBackend(CeedInit("/gpu/cuda/shared", &ceed_shared)); CeedCallBackend(CeedSetDelegate(ceed, ceed_shared)); CeedCallBackend(CeedSetOperatorFallbackResource(ceed, fallback_resource)); diff --git a/backends/cuda-ref/ceed-cuda-ref-basis.c b/backends/cuda-ref/ceed-cuda-ref-basis.c index 8cf285cbc8..5efaeee456 100644 --- a/backends/cuda-ref/ceed-cuda-ref-basis.c +++ b/backends/cuda-ref/ceed-cuda-ref-basis.c @@ -123,7 +123,7 @@ static int CeedBasisApplyAtPointsCore_Cuda(CeedBasis basis, bool apply_add, cons // Weight handled separately if (eval_mode == CEED_EVAL_WEIGHT) { - CeedCall(CeedVectorSetValue(v, 1.0)); + CeedCallBackend(CeedVectorSetValue(v, 1.0)); return CEED_ERROR_SUCCESS; } @@ -141,7 +141,7 @@ static int CeedBasisApplyAtPointsCore_Cuda(CeedBasis basis, bool apply_add, cons interp_bytes = P_1d * Q_1d * sizeof(CeedScalar); CeedCallBackend(CeedCalloc(P_1d * Q_1d, &chebyshev_interp_1d)); - CeedCall(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); + CeedCallBackend(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); CeedCallCuda(ceed, cudaMalloc((void **)&data->d_chebyshev_interp_1d, interp_bytes)); CeedCallCuda(ceed, cudaMemcpy(data->d_chebyshev_interp_1d, chebyshev_interp_1d, interp_bytes, cudaMemcpyHostToDevice)); CeedCallBackend(CeedFree(&chebyshev_interp_1d)); diff --git a/backends/cuda-ref/ceed-cuda-ref-restriction.c b/backends/cuda-ref/ceed-cuda-ref-restriction.c index 7e381e77e0..0f20ceca7d 100644 --- a/backends/cuda-ref/ceed-cuda-ref-restriction.c +++ b/backends/cuda-ref/ceed-cuda-ref-restriction.c @@ -112,8 +112,8 @@ static inline int CeedElemRestrictionSetupCompile_Cuda(CeedElemRestriction rstr) CeedCallBackend(CeedGetKernel_Cuda(ceed, impl->module, "OffsetTranspose", &impl->ApplyUnsignedTranspose)); // Cleanup CeedCallBackend(CeedFree(&offset_kernel_path)); - for (CeedInt i = 0; i < num_file_paths; i++) CeedCall(CeedFree(&file_paths[i])); - CeedCall(CeedFree(&file_paths)); + for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i])); + CeedCallBackend(CeedFree(&file_paths)); } break; case CEED_RESTRICTION_CURL_ORIENTED: { const char *offset_kernel_path; @@ -137,8 +137,8 @@ static inline int CeedElemRestrictionSetupCompile_Cuda(CeedElemRestriction rstr) CeedCallBackend(CeedGetKernel_Cuda(ceed, impl->module, "OffsetTranspose", &impl->ApplyUnorientedTranspose)); // Cleanup CeedCallBackend(CeedFree(&offset_kernel_path)); - for (CeedInt i = 0; i < num_file_paths; i++) CeedCall(CeedFree(&file_paths[i])); - CeedCall(CeedFree(&file_paths)); + for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i])); + CeedCallBackend(CeedFree(&file_paths)); } break; } CeedCallBackend(CeedFree(&restriction_kernel_path)); diff --git a/backends/cuda-ref/ceed-cuda-ref-vector.c b/backends/cuda-ref/ceed-cuda-ref-vector.c index e15d44789a..d6622e0e99 100644 --- a/backends/cuda-ref/ceed-cuda-ref-vector.c +++ b/backends/cuda-ref/ceed-cuda-ref-vector.c @@ -247,8 +247,8 @@ static int CeedVectorCopyStrided_Cuda(CeedVector vec, CeedSize start, CeedSize s { CeedSize length_vec, length_copy; - CeedCall(CeedVectorGetLength(vec, &length_vec)); - CeedCall(CeedVectorGetLength(vec_copy, &length_copy)); + CeedCallBackend(CeedVectorGetLength(vec, &length_vec)); + CeedCallBackend(CeedVectorGetLength(vec_copy, &length_copy)); length = length_vec < length_copy ? length_vec : length_copy; } // Set value for synced device/host array diff --git a/backends/cuda-shared/ceed-cuda-shared-basis.c b/backends/cuda-shared/ceed-cuda-shared-basis.c index 4f0901484d..8245149f6d 100644 --- a/backends/cuda-shared/ceed-cuda-shared-basis.c +++ b/backends/cuda-shared/ceed-cuda-shared-basis.c @@ -229,7 +229,7 @@ static int CeedBasisApplyAtPointsCore_Cuda_shared(CeedBasis basis, bool apply_ad // Weight handled separately if (eval_mode == CEED_EVAL_WEIGHT) { - CeedCall(CeedVectorSetValue(v, 1.0)); + CeedCallBackend(CeedVectorSetValue(v, 1.0)); return CEED_ERROR_SUCCESS; } @@ -247,7 +247,7 @@ static int CeedBasisApplyAtPointsCore_Cuda_shared(CeedBasis basis, bool apply_ad interp_bytes = P_1d * Q_1d * sizeof(CeedScalar); CeedCallBackend(CeedCalloc(P_1d * Q_1d, &chebyshev_interp_1d)); - CeedCall(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); + CeedCallBackend(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); CeedCallCuda(ceed, cudaMalloc((void **)&data->d_chebyshev_interp_1d, interp_bytes)); CeedCallCuda(ceed, cudaMemcpy(data->d_chebyshev_interp_1d, chebyshev_interp_1d, interp_bytes, cudaMemcpyHostToDevice)); CeedCallBackend(CeedFree(&chebyshev_interp_1d)); diff --git a/backends/cuda-shared/ceed-cuda-shared.c b/backends/cuda-shared/ceed-cuda-shared.c index ef704f7193..5ab65815cc 100644 --- a/backends/cuda-shared/ceed-cuda-shared.c +++ b/backends/cuda-shared/ceed-cuda-shared.c @@ -24,6 +24,7 @@ static int CeedInit_Cuda_shared(const char *resource, Ceed ceed) { CeedCallBackend(CeedGetResourceRoot(ceed, resource, ":", &resource_root)); CeedCheck(!strcmp(resource_root, "/gpu/cuda/shared"), ceed, CEED_ERROR_BACKEND, "Cuda backend cannot use resource: %s", resource); + CeedCallBackend(CeedFree(&resource_root)); CeedCallBackend(CeedSetDeterministic(ceed, true)); CeedCallBackend(CeedCalloc(1, &data)); diff --git a/backends/hip-gen/ceed-hip-gen-operator-build.cpp b/backends/hip-gen/ceed-hip-gen-operator-build.cpp index 623c3deb9a..6926e6fb4e 100644 --- a/backends/hip-gen/ceed-hip-gen-operator-build.cpp +++ b/backends/hip-gen/ceed-hip-gen-operator-build.cpp @@ -785,11 +785,11 @@ extern "C" int CeedOperatorBuildKernel_Hip_gen(CeedOperator op) { // Initialize constants, and matrices B and G code << "\n // Input field constants and basis data\n"; for (CeedInt i = 0; i < num_input_fields; i++) { - CeedCall(CeedOperatorBuildKernelFieldData_Hip_gen(code, data, i, op_input_fields[i], qf_input_fields[i], Q_1d, true, use_3d_slices)); + CeedCallBackend(CeedOperatorBuildKernelFieldData_Hip_gen(code, data, i, op_input_fields[i], qf_input_fields[i], Q_1d, true, use_3d_slices)); } code << "\n // Output field constants and basis data\n"; for (CeedInt i = 0; i < num_output_fields; i++) { - CeedCall(CeedOperatorBuildKernelFieldData_Hip_gen(code, data, i, op_output_fields[i], qf_output_fields[i], Q_1d, false, use_3d_slices)); + CeedCallBackend(CeedOperatorBuildKernelFieldData_Hip_gen(code, data, i, op_output_fields[i], qf_output_fields[i], Q_1d, false, use_3d_slices)); } // Loop over all elements diff --git a/backends/hip-ref/ceed-hip-ref-basis.c b/backends/hip-ref/ceed-hip-ref-basis.c index 78e27a1a5f..ea3f4e6e3a 100644 --- a/backends/hip-ref/ceed-hip-ref-basis.c +++ b/backends/hip-ref/ceed-hip-ref-basis.c @@ -121,7 +121,7 @@ static int CeedBasisApplyAtPointsCore_Hip(CeedBasis basis, bool apply_add, const // Weight handled separately if (eval_mode == CEED_EVAL_WEIGHT) { - CeedCall(CeedVectorSetValue(v, 1.0)); + CeedCallBackend(CeedVectorSetValue(v, 1.0)); return CEED_ERROR_SUCCESS; } @@ -139,7 +139,7 @@ static int CeedBasisApplyAtPointsCore_Hip(CeedBasis basis, bool apply_add, const interp_bytes = P_1d * Q_1d * sizeof(CeedScalar); CeedCallBackend(CeedCalloc(P_1d * Q_1d, &chebyshev_interp_1d)); - CeedCall(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); + CeedCallBackend(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); CeedCallHip(ceed, hipMalloc((void **)&data->d_chebyshev_interp_1d, interp_bytes)); CeedCallHip(ceed, hipMemcpy(data->d_chebyshev_interp_1d, chebyshev_interp_1d, interp_bytes, hipMemcpyHostToDevice)); CeedCallBackend(CeedFree(&chebyshev_interp_1d)); diff --git a/backends/hip-ref/ceed-hip-ref-restriction.c b/backends/hip-ref/ceed-hip-ref-restriction.c index 0cbdc64c3b..41bba37520 100644 --- a/backends/hip-ref/ceed-hip-ref-restriction.c +++ b/backends/hip-ref/ceed-hip-ref-restriction.c @@ -111,8 +111,8 @@ static inline int CeedElemRestrictionSetupCompile_Hip(CeedElemRestriction rstr) CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "OffsetTranspose", &impl->ApplyUnsignedTranspose)); // Cleanup CeedCallBackend(CeedFree(&offset_kernel_path)); - for (CeedInt i = 0; i < num_file_paths; i++) CeedCall(CeedFree(&file_paths[i])); - CeedCall(CeedFree(&file_paths)); + for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i])); + CeedCallBackend(CeedFree(&file_paths)); } break; case CEED_RESTRICTION_CURL_ORIENTED: { const char *offset_kernel_path; @@ -136,8 +136,8 @@ static inline int CeedElemRestrictionSetupCompile_Hip(CeedElemRestriction rstr) CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "OffsetTranspose", &impl->ApplyUnorientedTranspose)); // Cleanup CeedCallBackend(CeedFree(&offset_kernel_path)); - for (CeedInt i = 0; i < num_file_paths; i++) CeedCall(CeedFree(&file_paths[i])); - CeedCall(CeedFree(&file_paths)); + for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i])); + CeedCallBackend(CeedFree(&file_paths)); } break; } CeedCallBackend(CeedFree(&restriction_kernel_path)); diff --git a/backends/hip-ref/ceed-hip-ref-vector.c b/backends/hip-ref/ceed-hip-ref-vector.c index 2883de9e25..f57d8bcf69 100644 --- a/backends/hip-ref/ceed-hip-ref-vector.c +++ b/backends/hip-ref/ceed-hip-ref-vector.c @@ -247,8 +247,8 @@ static int CeedVectorCopyStrided_Hip(CeedVector vec, CeedSize start, CeedSize st { CeedSize length_vec, length_copy; - CeedCall(CeedVectorGetLength(vec, &length_vec)); - CeedCall(CeedVectorGetLength(vec_copy, &length_copy)); + CeedCallBackend(CeedVectorGetLength(vec, &length_vec)); + CeedCallBackend(CeedVectorGetLength(vec_copy, &length_copy)); length = length_vec < length_copy ? length_vec : length_copy; } // Set value for synced device/host array diff --git a/backends/hip-shared/ceed-hip-shared-basis.c b/backends/hip-shared/ceed-hip-shared-basis.c index bda080ed2d..959078e5b1 100644 --- a/backends/hip-shared/ceed-hip-shared-basis.c +++ b/backends/hip-shared/ceed-hip-shared-basis.c @@ -288,7 +288,7 @@ static int CeedBasisApplyAtPointsCore_Hip_shared(CeedBasis basis, bool apply_add // Weight handled separately if (eval_mode == CEED_EVAL_WEIGHT) { - CeedCall(CeedVectorSetValue(v, 1.0)); + CeedCallBackend(CeedVectorSetValue(v, 1.0)); return CEED_ERROR_SUCCESS; } @@ -306,7 +306,7 @@ static int CeedBasisApplyAtPointsCore_Hip_shared(CeedBasis basis, bool apply_add interp_bytes = P_1d * Q_1d * sizeof(CeedScalar); CeedCallBackend(CeedCalloc(P_1d * Q_1d, &chebyshev_interp_1d)); - CeedCall(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); + CeedCallBackend(CeedBasisGetChebyshevInterp1D(basis, chebyshev_interp_1d)); CeedCallHip(ceed, hipMalloc((void **)&data->d_chebyshev_interp_1d, interp_bytes)); CeedCallHip(ceed, hipMemcpy(data->d_chebyshev_interp_1d, chebyshev_interp_1d, interp_bytes, hipMemcpyHostToDevice)); CeedCallBackend(CeedFree(&chebyshev_interp_1d)); diff --git a/backends/magma/ceed-magma-basis.c b/backends/magma/ceed-magma-basis.c index 71a86d5b8d..6f5fa0a2ca 100644 --- a/backends/magma/ceed-magma-basis.c +++ b/backends/magma/ceed-magma-basis.c @@ -369,8 +369,8 @@ static int CeedBasisApplyNonTensorCore_Magma(CeedBasis basis, bool apply_add, Ce } CeedCallBackend(CeedFree(&basis_kernel_path)); CeedCallBackend(CeedFree(&basis_kernel_source)); - for (CeedInt i = 0; i < num_file_paths; i++) CeedCall(CeedFree(&file_paths[i])); - CeedCall(CeedFree(&file_paths)); + for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i])); + CeedCallBackend(CeedFree(&file_paths)); } } @@ -617,8 +617,8 @@ int CeedBasisCreateTensorH1_Magma(CeedInt dim, CeedInt P_1d, CeedInt Q_1d, const CeedCallBackend(CeedFree(&grad_kernel_path)); CeedCallBackend(CeedFree(&weight_kernel_path)); CeedCallBackend(CeedFree(&basis_kernel_source)); - for (CeedInt i = 0; i < num_file_paths; i++) CeedCall(CeedFree(&file_paths[i])); - CeedCall(CeedFree(&file_paths)); + for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i])); + CeedCallBackend(CeedFree(&file_paths)); CeedCallBackend(CeedBasisSetData(basis, impl)); diff --git a/backends/sycl/ceed-sycl-compile.sycl.cpp b/backends/sycl/ceed-sycl-compile.sycl.cpp index 9615114158..9dc0177401 100644 --- a/backends/sycl/ceed-sycl-compile.sycl.cpp +++ b/backends/sycl/ceed-sycl-compile.sycl.cpp @@ -106,7 +106,7 @@ static int CeedLoadModule_Sycl(Ceed ceed, const sycl::context &sycl_context, con zeModuleBuildLogGetString(lz_log, &log_size, nullptr); - CeedCall(CeedCalloc(log_size, &log_message)); + CeedCallBackend(CeedCalloc(log_size, &log_message)); zeModuleBuildLogGetString(lz_log, &log_size, log_message); return CeedError(ceed, CEED_ERROR_BACKEND, "Failed to compile Level Zero module:\n%s", log_message); diff --git a/interface/ceed.c b/interface/ceed.c index 3bdd471454..b15cba3a51 100644 --- a/interface/ceed.c +++ b/interface/ceed.c @@ -443,7 +443,9 @@ int CeedIsDebug(Ceed ceed, bool *is_debug) { } /** - @brief Get the root of the requested resource + @brief Get the root of the requested resource. + + Note: Caller is responsible for calling @ref CeedFree() on the `resource_root`. @param[in] ceed `Ceed` context to get resource name of @param[in] resource Full user specified resource diff --git a/tests/t593-operator.c b/tests/t593-operator.c index 2a2daceb88..2e0710c7fc 100644 --- a/tests/t593-operator.c +++ b/tests/t593-operator.c @@ -85,13 +85,13 @@ int main(int argc, char **argv) { // Setup geometric scaling CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf_setup); - CeedQFunctionAddInput(qf_setup, "x", dim * dim, CEED_EVAL_GRAD); CeedQFunctionAddInput(qf_setup, "weight", 1, CEED_EVAL_WEIGHT); + CeedQFunctionAddInput(qf_setup, "x", dim * dim, CEED_EVAL_GRAD); CeedQFunctionAddOutput(qf_setup, "rho", 1, CEED_EVAL_NONE); CeedOperatorCreateAtPoints(ceed, qf_setup, CEED_QFUNCTION_NONE, CEED_QFUNCTION_NONE, &op_setup); - CeedOperatorSetField(op_setup, "x", elem_restriction_x, basis_x, CEED_VECTOR_ACTIVE); CeedOperatorSetField(op_setup, "weight", CEED_ELEMRESTRICTION_NONE, basis_x, CEED_VECTOR_NONE); + CeedOperatorSetField(op_setup, "x", elem_restriction_x, basis_x, CEED_VECTOR_ACTIVE); CeedOperatorSetField(op_setup, "rho", elem_restriction_q_data, CEED_BASIS_NONE, CEED_VECTOR_ACTIVE); CeedOperatorAtPointsSetPoints(op_setup, elem_restriction_x_points, x_points); diff --git a/tests/t594-operator.c b/tests/t594-operator.c index 2d4e6d876c..49405e37a4 100644 --- a/tests/t594-operator.c +++ b/tests/t594-operator.c @@ -85,13 +85,13 @@ int main(int argc, char **argv) { // Setup geometric scaling CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf_setup); - CeedQFunctionAddInput(qf_setup, "x", dim * dim, CEED_EVAL_GRAD); CeedQFunctionAddInput(qf_setup, "weight", 1, CEED_EVAL_WEIGHT); + CeedQFunctionAddInput(qf_setup, "x", dim * dim, CEED_EVAL_GRAD); CeedQFunctionAddOutput(qf_setup, "rho", 1, CEED_EVAL_NONE); CeedOperatorCreateAtPoints(ceed, qf_setup, CEED_QFUNCTION_NONE, CEED_QFUNCTION_NONE, &op_setup); - CeedOperatorSetField(op_setup, "x", elem_restriction_x, basis_x, CEED_VECTOR_ACTIVE); CeedOperatorSetField(op_setup, "weight", CEED_ELEMRESTRICTION_NONE, basis_x, CEED_VECTOR_NONE); + CeedOperatorSetField(op_setup, "x", elem_restriction_x, basis_x, CEED_VECTOR_ACTIVE); CeedOperatorSetField(op_setup, "rho", elem_restriction_q_data, CEED_BASIS_NONE, CEED_VECTOR_ACTIVE); CeedOperatorAtPointsSetPoints(op_setup, elem_restriction_x_points, x_points);