1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3 // 4 // SPDX-License-Identifier: BSD-2-Clause 5 // 6 // This file is part of CEED: http://github.com/ceed 7 8 #ifndef _ceed_cuda_compile_h 9 #define _ceed_cuda_compile_h 10 11 #include <ceed/ceed.h> 12 #include <cuda.h> 13 #include <nvrtc.h> 14 15 static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) { 16 return (numerator + denominator - 1) / denominator; 17 } 18 19 CEED_INTERN int CeedCompileCuda(Ceed ceed, const char *source, CUmodule *module, 20 const CeedInt num_opts, ...); 21 22 CEED_INTERN int CeedGetKernelCuda(Ceed ceed, CUmodule module, const char *name, 23 CUfunction *kernel); 24 25 CEED_INTERN int CeedRunKernelCuda(Ceed ceed, CUfunction kernel, 26 const int grid_size, 27 const int block_size, void **args); 28 29 CEED_INTERN int CeedRunKernelAutoblockCuda(Ceed ceed, CUfunction kernel, 30 size_t size, void **args); 31 32 CEED_INTERN int CeedRunKernelDimCuda(Ceed ceed, CUfunction kernel, 33 const int grid_size, 34 const int block_size_x, const int block_size_y, 35 const int block_size_z, void **args); 36 37 CEED_INTERN int CeedRunKernelDimSharedCuda(Ceed ceed, CUfunction kernel, 38 const int grid_size, const int block_size_x, const int block_size_y, 39 const int block_size_z, const int shared_mem_size, void **args); 40 41 #endif // _ceed_cuda_compile_h 42