xref: /libCEED/interface/ceed-hip.c (revision ea61e9ac44808524e4667c1525a05976f536c19c)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, 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>
92b730f8bSJeremy L Thompson #include <ceed/backend.h>
102b730f8bSJeremy L Thompson #include <ceed/ceed.h>
112b730f8bSJeremy L Thompson #include <ceed/hip.h>
12af7ca75eSjeremylt 
13af7ca75eSjeremylt /**
14af7ca75eSjeremylt   @brief Set HIP function pointer to evaluate action at quadrature points
15af7ca75eSjeremylt 
16*ea61e9acSJeremy L Thompson   @param[in,out] qf CeedQFunction to set device pointer
17*ea61e9acSJeremy L Thompson   @param[in]     f  Device function pointer to evaluate action at quadrature points
18af7ca75eSjeremylt 
19af7ca75eSjeremylt   @return An error code: 0 - success, otherwise - failure
20af7ca75eSjeremylt 
21af7ca75eSjeremylt   @ref User
22af7ca75eSjeremylt **/
23af7ca75eSjeremylt int CeedQFunctionSetHIPUserFunction(CeedQFunction qf, hipFunction_t f) {
24af7ca75eSjeremylt   if (!qf->SetHIPUserFunction) {
25af7ca75eSjeremylt     Ceed ceed;
262b730f8bSJeremy L Thompson     CeedCall(CeedQFunctionGetCeed(qf, &ceed));
272b730f8bSJeremy L Thompson     CeedDebug(ceed, "Backend does not support hipFunction_t pointers for QFunctions.");
28af7ca75eSjeremylt   } else {
292b730f8bSJeremy L Thompson     CeedCall(qf->SetHIPUserFunction(qf, f));
30af7ca75eSjeremylt   }
31e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
32af7ca75eSjeremylt }
33