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 17*e8a49f24SJeremy L Thompson #include <ceed/ceed.h> 18*e8a49f24SJeremy L Thompson #include <ceed/backend.h> 19ec3da8bcSJed Brown #include <ceed/hip.h> 20*e8a49f24SJeremy L Thompson #include <ceed-impl.h> 21af7ca75eSjeremylt 22af7ca75eSjeremylt /** 23af7ca75eSjeremylt @brief Set HIP function pointer to evaluate action at quadrature points 24af7ca75eSjeremylt 25af7ca75eSjeremylt @param qf CeedQFunction to set device pointer 26af7ca75eSjeremylt @param f Device function pointer to evaluate action at quadrature points 27af7ca75eSjeremylt 28af7ca75eSjeremylt @return An error code: 0 - success, otherwise - failure 29af7ca75eSjeremylt 30af7ca75eSjeremylt @ref User 31af7ca75eSjeremylt **/ 32af7ca75eSjeremylt int CeedQFunctionSetHIPUserFunction(CeedQFunction qf, hipFunction_t f) { 33af7ca75eSjeremylt int ierr; 34af7ca75eSjeremylt if (!qf->SetHIPUserFunction) { 35af7ca75eSjeremylt Ceed ceed; 36af7ca75eSjeremylt ierr = CeedQFunctionGetCeed(qf, &ceed); CeedChk(ierr); 373f21f6b1SJeremy L Thompson CeedDebug(ceed, 383f21f6b1SJeremy L Thompson "Backend does not support hipFunction_t pointers for QFunctions."); 39af7ca75eSjeremylt } else { 40af7ca75eSjeremylt ierr = qf->SetHIPUserFunction(qf, f); CeedChk(ierr); 41af7ca75eSjeremylt } 42e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 43af7ca75eSjeremylt } 44