xref: /libCEED/rust/libceed-sys/c-src/backends/cuda/ceed-cuda-compile.h (revision 5aed82e4fa97acf4ba24a7f10a35f5303a6798e0)
1*5aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, 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
76d69246aSJeremy L Thompson 
894b7b29bSJeremy L Thompson #ifndef CEED_CUDA_COMPILE_H
994b7b29bSJeremy L Thompson #define CEED_CUDA_COMPILE_H
106d69246aSJeremy L Thompson 
1149aac155SJeremy L Thompson #include <ceed.h>
122b730f8bSJeremy L Thompson #include <ceed/backend.h>
136d69246aSJeremy L Thompson #include <cuda.h>
146d69246aSJeremy L Thompson 
152b730f8bSJeremy L Thompson static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) { return (numerator + denominator - 1) / denominator; }
160d0321e0SJeremy L Thompson 
17eb7e6cafSJeremy L Thompson CEED_INTERN int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const CeedInt num_defines, ...);
186d69246aSJeremy L Thompson 
19eb7e6cafSJeremy L Thompson CEED_INTERN int CeedGetKernel_Cuda(Ceed ceed, CUmodule module, const char *name, CUfunction *kernel);
206d69246aSJeremy L Thompson 
21eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernel_Cuda(Ceed ceed, CUfunction kernel, int grid_size, int block_size, void **args);
226d69246aSJeremy L Thompson 
236574a04fSJeremy L Thompson CEED_INTERN int CeedRunKernelAutoblockCuda(Ceed ceed, CUfunction kernel, size_t points, void **args);
246d69246aSJeremy L Thompson 
25eb7e6cafSJeremy 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);
266d69246aSJeremy L Thompson 
27eb7e6cafSJeremy L Thompson CEED_INTERN int CeedRunKernelDimShared_Cuda(Ceed ceed, CUfunction kernel, int grid_size, int block_size_x, int block_size_y, int block_size_z,
2851475c7cSJeremy L Thompson                                             int shared_mem_size, void **args);
296d69246aSJeremy L Thompson 
3094b7b29bSJeremy L Thompson #endif  // CEED_CUDA_COMPILE_H
31