1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3af7ca75eSjeremylt // 4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5af7ca75eSjeremylt // 6*3d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7af7ca75eSjeremylt 8e8a49f24SJeremy L Thompson #include <ceed/ceed.h> 9e8a49f24SJeremy L Thompson #include <ceed/backend.h> 10ec3da8bcSJed Brown #include <ceed/cuda.h> 11e8a49f24SJeremy L Thompson #include <ceed-impl.h> 12af7ca75eSjeremylt 13af7ca75eSjeremylt /** 14af7ca75eSjeremylt @brief Set CUDA function pointer to evaluate action at quadrature points 15af7ca75eSjeremylt 16af7ca75eSjeremylt @param qf CeedQFunction to set device pointer 17af7ca75eSjeremylt @param 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 CeedQFunctionSetCUDAUserFunction(CeedQFunction qf, CUfunction f) { 24af7ca75eSjeremylt int ierr; 25af7ca75eSjeremylt if (!qf->SetCUDAUserFunction) { 26af7ca75eSjeremylt Ceed ceed; 27af7ca75eSjeremylt ierr = CeedQFunctionGetCeed(qf, &ceed); CeedChk(ierr); 283f21f6b1SJeremy L Thompson CeedDebug(ceed, "Backend does not support CUfunction pointers for QFunctions."); 29af7ca75eSjeremylt } else { 30af7ca75eSjeremylt ierr = qf->SetCUDAUserFunction(qf, f); CeedChk(ierr); 31af7ca75eSjeremylt } 32e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 33af7ca75eSjeremylt } 34