xref: /libCEED/rust/libceed-sys/c-src/backends/hip/ceed-hip-compile.h (revision 0d0321e0e600f17fbb9528732fcb5c1d5c63fc0f)
130f4f45fSnbeams // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
230f4f45fSnbeams // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
330f4f45fSnbeams // All Rights reserved. See files LICENSE and NOTICE for details.
430f4f45fSnbeams //
530f4f45fSnbeams // This file is part of CEED, a collection of benchmarks, miniapps, software
630f4f45fSnbeams // libraries and APIs for efficient high-order finite element and spectral
730f4f45fSnbeams // element discretizations for exascale applications. For more information and
830f4f45fSnbeams // source code availability see http://github.com/ceed.
930f4f45fSnbeams //
1030f4f45fSnbeams // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
1130f4f45fSnbeams // a collaborative effort of two U.S. Department of Energy organizations (Office
1230f4f45fSnbeams // of Science and the National Nuclear Security Administration) responsible for
1330f4f45fSnbeams // the planning and preparation of a capable exascale ecosystem, including
1430f4f45fSnbeams // software, applications, hardware, advanced system engineering and early
1530f4f45fSnbeams // testbed platforms, in support of the nation's exascale computing imperative.
163d576824SJeremy L Thompson 
1730f4f45fSnbeams #ifndef _ceed_hip_compile_h
1830f4f45fSnbeams #define _ceed_hip_compile_h
1930f4f45fSnbeams 
20ec3da8bcSJed Brown #include <ceed/ceed.h>
2130f4f45fSnbeams #include <hip/hip_runtime.h>
2230f4f45fSnbeams 
23*0d0321e0SJeremy L Thompson static inline CeedInt CeedDivUpInt(CeedInt numerator, CeedInt denominator) {
24*0d0321e0SJeremy L Thompson   return (numerator + denominator - 1) / denominator;
25*0d0321e0SJeremy L Thompson }
26*0d0321e0SJeremy L Thompson 
27cf7477b8Snbeams CEED_INTERN int CeedCompileHip(Ceed ceed, const char *source,
28*0d0321e0SJeremy L Thompson                                hipModule_t *module, const CeedInt numopts, ...);
2930f4f45fSnbeams 
30cf7477b8Snbeams CEED_INTERN int CeedGetKernelHip(Ceed ceed, hipModule_t module,
31*0d0321e0SJeremy L Thompson                                  const char *name, hipFunction_t *kernel);
3230f4f45fSnbeams 
3330f4f45fSnbeams CEED_INTERN int CeedRunKernelHip(Ceed ceed, hipFunction_t kernel,
34*0d0321e0SJeremy L Thompson                                  const int grid_size,
35*0d0321e0SJeremy L Thompson                                  const int block_size, void **args);
3630f4f45fSnbeams 
3730f4f45fSnbeams CEED_INTERN int CeedRunKernelDimHip(Ceed ceed, hipFunction_t kernel,
38*0d0321e0SJeremy L Thompson                                     const int grid_size,
39*0d0321e0SJeremy L Thompson                                     const int block_size_x, const int block_size_y,
40*0d0321e0SJeremy L Thompson                                     const int block_size_z, void **args);
4130f4f45fSnbeams 
4230f4f45fSnbeams CEED_INTERN int CeedRunKernelDimSharedHip(Ceed ceed, hipFunction_t kernel,
43*0d0321e0SJeremy L Thompson     const int grid_size, const int block_size_x, const int block_size_y,
44*0d0321e0SJeremy L Thompson     const int block_size_z, const int shared_mem_size, void **args);
4530f4f45fSnbeams 
463d576824SJeremy L Thompson #endif // _ceed_hip_compile_h
47