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/cuda.h> 12af7ca75eSjeremylt 13af7ca75eSjeremylt /** 14af7ca75eSjeremylt @brief Set CUDA 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 CeedQFunctionSetCUDAUserFunction(CeedQFunction qf, CUfunction f) { 24af7ca75eSjeremylt if (!qf->SetCUDAUserFunction) { 25af7ca75eSjeremylt Ceed ceed; 262b730f8bSJeremy L Thompson CeedCall(CeedQFunctionGetCeed(qf, &ceed)); 273f21f6b1SJeremy L Thompson CeedDebug(ceed, "Backend does not support CUfunction pointers for QFunctions."); 28af7ca75eSjeremylt } else { 292b730f8bSJeremy L Thompson CeedCall(qf->SetCUDAUserFunction(qf, f)); 30af7ca75eSjeremylt } 31e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 32af7ca75eSjeremylt } 33