1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, 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. 36d69246aSJeremy L Thompson // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 56d69246aSJeremy L Thompson // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7509d4af6SJeremy L Thompson #pragma once 86d69246aSJeremy L Thompson 949aac155SJeremy L Thompson #include <ceed.h> 102b730f8bSJeremy L Thompson #include <ceed/backend.h> 116d69246aSJeremy L Thompson #include <cuda.h> 126d69246aSJeremy L Thompson 132b730f8bSJeremy L Thompson static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) { return (numerator + denominator - 1) / denominator; } 140d0321e0SJeremy L Thompson 15eb7e6cafSJeremy L Thompson CEED_INTERN int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const CeedInt num_defines, ...); 16ddae5012SJeremy L Thompson CEED_INTERN int CeedTryCompile_Cuda(Ceed ceed, const char *source, bool *is_compile_good, CUmodule *module, const CeedInt num_defines, ...); 176d69246aSJeremy L Thompson 18eb7e6cafSJeremy L Thompson CEED_INTERN int CeedGetKernel_Cuda(Ceed ceed, CUmodule module, const char *name, CUfunction *kernel); 196d69246aSJeremy L Thompson 20eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernel_Cuda(Ceed ceed, CUfunction kernel, int grid_size, int block_size, void **args); 216d69246aSJeremy L Thompson 226574a04fSJeremy L Thompson CEED_INTERN int CeedRunKernelAutoblockCuda(Ceed ceed, CUfunction kernel, size_t points, void **args); 236d69246aSJeremy L Thompson 24eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernelDim_Cuda(Ceed ceed, CUfunction kernel, int grid_size, int block_size_x, int block_size_y, int block_size_z, void **args); 256d69246aSJeremy L Thompson 26e9c76bddSJeremy L Thompson CEED_INTERN int CeedRunKernelDimShared_Cuda(Ceed ceed, CUfunction kernel, CUstream stream, int grid_size, int block_size_x, int block_size_y, 27e9c76bddSJeremy L Thompson int block_size_z, int shared_mem_size, void **args); 28e9c76bddSJeremy L Thompson CEED_INTERN int CeedTryRunKernelDimShared_Cuda(Ceed ceed, CUfunction kernel, CUstream stream, int grid_size, int block_size_x, int block_size_y, 29e9c76bddSJeremy L Thompson int block_size_z, int shared_mem_size, bool *is_good_run, void **args); 30