xref: /libCEED/interface/ceed-cuda.c (revision 9ba83ac0e4b1fca39d6fa6737a318a9f0cbc172d)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3af7ca75eSjeremylt //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5af7ca75eSjeremylt //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7af7ca75eSjeremylt 
8e8a49f24SJeremy L Thompson #include <ceed-impl.h>
949aac155SJeremy L Thompson #include <ceed.h>
102b730f8bSJeremy L Thompson #include <ceed/backend.h>
112b730f8bSJeremy L Thompson #include <ceed/cuda.h>
1249aac155SJeremy L Thompson #include <cuda.h>
13af7ca75eSjeremylt 
14af7ca75eSjeremylt /**
15af7ca75eSjeremylt   @brief Set CUDA function pointer to evaluate action at quadrature points
16af7ca75eSjeremylt 
17ca94c3ddSJeremy L Thompson   @param[in,out] qf `CeedQFunction` to set device pointer
18ea61e9acSJeremy L Thompson   @param[in]     f  Device function pointer to evaluate action at quadrature points
19af7ca75eSjeremylt 
20af7ca75eSjeremylt   @return An error code: 0 - success, otherwise - failure
21af7ca75eSjeremylt 
22af7ca75eSjeremylt   @ref User
23af7ca75eSjeremylt **/
24af7ca75eSjeremylt int CeedQFunctionSetCUDAUserFunction(CeedQFunction qf, CUfunction f) {
25af7ca75eSjeremylt   if (!qf->SetCUDAUserFunction) {
269bc66399SJeremy L Thompson     CeedDebug(CeedQFunctionReturnCeed(qf), "Backend does not support CUfunction pointers for QFunctions.");
27af7ca75eSjeremylt   } else {
282b730f8bSJeremy L Thompson     CeedCall(qf->SetCUDAUserFunction(qf, f));
29af7ca75eSjeremylt   }
30e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
31af7ca75eSjeremylt }
32