xref: /libCEED/rust/libceed-sys/c-src/backends/cuda/ceed-cuda-compile.h (revision 49aac155e7a09736f56fb3abac0f57dab29f7cbf)
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.
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 
86d69246aSJeremy L Thompson #ifndef _ceed_cuda_compile_h
96d69246aSJeremy L Thompson #define _ceed_cuda_compile_h
106d69246aSJeremy L Thompson 
11*49aac155SJeremy L Thompson #include <ceed.h>
122b730f8bSJeremy L Thompson #include <ceed/backend.h>
136d69246aSJeremy L Thompson #include <cuda.h>
146d69246aSJeremy L Thompson #include <nvrtc.h>
156d69246aSJeremy L Thompson 
162b730f8bSJeremy L Thompson static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) { return (numerator + denominator - 1) / denominator; }
170d0321e0SJeremy L Thompson 
182b730f8bSJeremy L Thompson CEED_INTERN int CeedCompileCuda(Ceed ceed, const char *source, CUmodule *module, const CeedInt num_defines, ...);
196d69246aSJeremy L Thompson 
202b730f8bSJeremy L Thompson CEED_INTERN int CeedGetKernelCuda(Ceed ceed, CUmodule module, const char *name, CUfunction *kernel);
216d69246aSJeremy L Thompson 
222b730f8bSJeremy L Thompson CEED_INTERN int CeedRunKernelCuda(Ceed ceed, CUfunction kernel, const int grid_size, const int block_size, void **args);
236d69246aSJeremy L Thompson 
242b730f8bSJeremy L Thompson CEED_INTERN int CeedRunKernelAutoblockCuda(Ceed ceed, CUfunction kernel, size_t size, void **args);
256d69246aSJeremy L Thompson 
262b730f8bSJeremy L Thompson CEED_INTERN int CeedRunKernelDimCuda(Ceed ceed, CUfunction kernel, const int grid_size, const int block_size_x, const int block_size_y,
270d0321e0SJeremy L Thompson                                      const int block_size_z, void **args);
286d69246aSJeremy L Thompson 
292b730f8bSJeremy L Thompson CEED_INTERN int CeedRunKernelDimSharedCuda(Ceed ceed, CUfunction kernel, const int grid_size, const int block_size_x, const int block_size_y,
300d0321e0SJeremy L Thompson                                            const int block_size_z, const int shared_mem_size, void **args);
316d69246aSJeremy L Thompson 
326d69246aSJeremy L Thompson #endif  // _ceed_cuda_compile_h
33