xref: /libCEED/interface/ceed-hip.c (revision 3f21f6b10abeb5d85d3454ea5cd38498737dc88a)
1af7ca75eSjeremylt // Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2af7ca75eSjeremylt // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3af7ca75eSjeremylt // reserved. See files LICENSE and NOTICE for details.
4af7ca75eSjeremylt //
5af7ca75eSjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software
6af7ca75eSjeremylt // libraries and APIs for efficient high-order finite element and spectral
7af7ca75eSjeremylt // element discretizations for exascale applications. For more information and
8af7ca75eSjeremylt // source code availability see http://github.com/ceed.
9af7ca75eSjeremylt //
10af7ca75eSjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11af7ca75eSjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office
12af7ca75eSjeremylt // of Science and the National Nuclear Security Administration) responsible for
13af7ca75eSjeremylt // the planning and preparation of a capable exascale ecosystem, including
14af7ca75eSjeremylt // software, applications, hardware, advanced system engineering and early
15af7ca75eSjeremylt // testbed platforms, in support of the nation's exascale computing imperative.
16af7ca75eSjeremylt 
17af7ca75eSjeremylt #include <ceed-impl.h>
18ec3da8bcSJed Brown #include <ceed/hip.h>
19af7ca75eSjeremylt 
20af7ca75eSjeremylt /**
21af7ca75eSjeremylt   @brief Set HIP function pointer to evaluate action at quadrature points
22af7ca75eSjeremylt 
23af7ca75eSjeremylt   @param qf  CeedQFunction to set device pointer
24af7ca75eSjeremylt   @param f   Device function pointer to evaluate action at quadrature points
25af7ca75eSjeremylt 
26af7ca75eSjeremylt   @return An error code: 0 - success, otherwise - failure
27af7ca75eSjeremylt 
28af7ca75eSjeremylt   @ref User
29af7ca75eSjeremylt **/
30af7ca75eSjeremylt int CeedQFunctionSetHIPUserFunction(CeedQFunction qf, hipFunction_t f) {
31af7ca75eSjeremylt   int ierr;
32af7ca75eSjeremylt   if (!qf->SetHIPUserFunction) {
33af7ca75eSjeremylt     Ceed ceed;
34af7ca75eSjeremylt     ierr = CeedQFunctionGetCeed(qf, &ceed); CeedChk(ierr);
35*3f21f6b1SJeremy L Thompson     CeedDebug(ceed,
36*3f21f6b1SJeremy L Thompson               "Backend does not support hipFunction_t pointers for QFunctions.");
37af7ca75eSjeremylt   } else {
38af7ca75eSjeremylt     ierr = qf->SetHIPUserFunction(qf, f); CeedChk(ierr);
39af7ca75eSjeremylt   }
40e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
41af7ca75eSjeremylt }
42