xref: /libCEED/rust/libceed-sys/c-src/backends/hip-shared/ceed-hip-shared.h (revision 3d576824e8d990e1f48c6609089904bee9170514)
17d8d0e25Snbeams // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
27d8d0e25Snbeams // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
37d8d0e25Snbeams // All Rights reserved. See files LICENSE and NOTICE for details.
47d8d0e25Snbeams //
57d8d0e25Snbeams // This file is part of CEED, a collection of benchmarks, miniapps, software
67d8d0e25Snbeams // libraries and APIs for efficient high-order finite element and spectral
77d8d0e25Snbeams // element discretizations for exascale applications. For more information and
87d8d0e25Snbeams // source code availability see http://github.com/ceed.
97d8d0e25Snbeams //
107d8d0e25Snbeams // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
117d8d0e25Snbeams // a collaborative effort of two U.S. Department of Energy organizations (Office
127d8d0e25Snbeams // of Science and the National Nuclear Security Administration) responsible for
137d8d0e25Snbeams // the planning and preparation of a capable exascale ecosystem, including
147d8d0e25Snbeams // software, applications, hardware, advanced system engineering and early
157d8d0e25Snbeams // testbed platforms, in support of the nation's exascale computing imperative.
16*3d576824SJeremy L Thompson 
17*3d576824SJeremy L Thompson #ifndef _ceed_hip_shared_h
18*3d576824SJeremy L Thompson #define _ceed_hip_shared_h
19*3d576824SJeremy L Thompson 
20*3d576824SJeremy L Thompson #include <ceed.h>
21*3d576824SJeremy L Thompson #include <ceed-backend.h>
22*3d576824SJeremy L Thompson #include <hip/hip_runtime.h>
237d8d0e25Snbeams #include "../hip/ceed-hip.h"
247d8d0e25Snbeams 
257d8d0e25Snbeams typedef struct {
267d8d0e25Snbeams   hipModule_t module;
277d8d0e25Snbeams   hipFunction_t interp;
287d8d0e25Snbeams   hipFunction_t grad;
297d8d0e25Snbeams   hipFunction_t weight;
309e31c45bSnbeams   CeedInt blksizes[3]; // interp, grad, weight thread block sizes
317d8d0e25Snbeams   CeedScalar *d_interp1d;
327d8d0e25Snbeams   CeedScalar *d_grad1d;
337d8d0e25Snbeams   CeedScalar *d_collograd1d;
347d8d0e25Snbeams   CeedScalar *d_qweight1d;
357d8d0e25Snbeams   CeedScalar *c_B;
367d8d0e25Snbeams   CeedScalar *c_G;
377d8d0e25Snbeams } CeedBasis_Hip_shared;
387d8d0e25Snbeams 
397d8d0e25Snbeams typedef struct {
407d8d0e25Snbeams   Ceed_Hip base;
417d8d0e25Snbeams } Ceed_Hip_shared;
427d8d0e25Snbeams 
437d8d0e25Snbeams CEED_INTERN int CeedBasisCreateTensorH1_Hip_shared(CeedInt dim, CeedInt P1d,
447d8d0e25Snbeams     CeedInt Q1d, const CeedScalar *interp1d, const CeedScalar *grad1d,
457d8d0e25Snbeams     const CeedScalar *qref1d, const CeedScalar *qweight1d, CeedBasis basis);
46526015bcSnbeams 
47526015bcSnbeams CEED_INTERN int CeedHipInitInterp(CeedScalar *d_B, CeedInt P1d, CeedInt Q1d,
48526015bcSnbeams                                   CeedScalar **c_B);
49526015bcSnbeams 
507c2e65d5Snbeams CEED_INTERN int CeedHipInitInterpGrad(CeedScalar *d_B, CeedScalar *d_G,
517c2e65d5Snbeams                                       CeedInt P1d,
52526015bcSnbeams                                       CeedInt Q1d, CeedScalar **c_B_ptr,
53526015bcSnbeams                                       CeedScalar **c_G_ptr);
54*3d576824SJeremy L Thompson 
55*3d576824SJeremy L Thompson #endif // _ceed_hip_shared_h
56