TABLE OF CONTENTS


ABINIT/m_manage_kokkos [ Modules ]

[ Top ] [ Modules ]

NAME

  m_manage_kokkos

FUNCTION

 This module provides iso_c_binding wrappers to kernels written using kokkos.
 computational routines located in m_xg

COPYRIGHT

  Copyright (C) 2016-2024 ABINIT group
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

NOTES

SOURCE

 19 #if defined HAVE_CONFIG_H
 20 #include "config.h"
 21 #endif
 22 
 23 #include "abi_common.h"
 24 
 25 module m_manage_kokkos
 26 
 27  use, intrinsic :: iso_c_binding
 28 
 29  implicit none
 30 
 31  interface
 32 
 33    ! ========================================================================
 34    ! ========================================================================
 35 
 36    subroutine opernlc_ylm_allwf_kokkos(cplex, cplex_enl, cplex_fac, &
 37      &                                 dimenl1, dimenl2, dimekbq, &
 38      &                                 iatm, itypat, ntypat, nprojs, &
 39      &                                 natom, nincat, nspinor, &
 40      &                                 nspinortot, paw_opt, &
 41      &                                 nlmn, lmnmax, &
 42      &                                 enl_gpu, &
 43      &                                 gx_gpu, &
 44      &                                 gxfac_gpu, &
 45      &                                 gxfac2_gpu, &
 46      &                                 gxfac_sij_gpu, &
 47      &                                 shift_spinor, ndat, &
 48      &                                 atindx1_gpu, &
 49      &                                 indlmn_gpu, &
 50      &                                 lambda_gpu, &
 51      &                                 sij_typ_gpu, &
 52      &                                 shift_proj, &
 53      &                                 nattyp_max) &
 54      & bind(c, name='opernlc_ylm_allwf_kokkos_cpp')
 55      use, intrinsic :: iso_c_binding
 56      implicit none
 57      integer(kind=c_int32_t), value, intent(in)    :: cplex, cplex_enl, cplex_fac
 58      integer(kind=c_int32_t), value, intent(in)    :: dimenl1, dimenl2, dimekbq
 59      integer(kind=c_int32_t), value, intent(in)    :: iatm, itypat, ntypat, nprojs
 60      integer(kind=c_int32_t), value, intent(in)    :: natom, nincat, nspinor
 61      integer(kind=c_int32_t), value, intent(in)    :: nspinortot, paw_opt
 62      integer(kind=c_int32_t), value, intent(in)    :: nlmn, lmnmax
 63      type(c_ptr),             value                :: enl_gpu ! (dimenl1, dimenl2, nspinortot**2, dimekbq)
 64      type(c_ptr),             value                :: gx_gpu ! (cplex,nlmn,nincat,nspinor*ndat)
 65      type(c_ptr),             value                :: gxfac_gpu ! (cplex_fac,nlmn,nincat,nspinor*ndat)
 66      type(c_ptr),             value                :: gxfac2_gpu ! (cplex_fac,nlmn,nincat,nspinor*ndat)
 67      type(c_ptr),             value                :: gxfac_sij_gpu !(cplex,nlmn,nincat,nspinor*ndat*(paw_opt/3))
 68      integer(kind=c_int32_t), value, intent(in)    :: shift_spinor, ndat
 69      type(c_ptr),             value                :: atindx1_gpu ! (natom)
 70      type(c_ptr),             value                :: indlmn_gpu  ! (6,nlmn)
 71      type(c_ptr),             value                :: lambda_gpu ! (ndat)
 72      type(c_ptr),             value                :: sij_typ_gpu ! (((paw_opt+1)/3)*nlmn*(nlmn+1)/2)
 73      integer(kind=c_int32_t), value, intent(in)    :: shift_proj, nattyp_max
 74    end subroutine opernlc_ylm_allwf_kokkos
 75 
 76    ! ========================================================================
 77    ! ========================================================================
 78 
 79    !> add arrays on GPU, array already on device (managed memory)
 80    subroutine add_array_kokkos(array1_ptr, array2_ptr, array_size) &
 81      & bind(c, name='add_array_kokkos_cpp')
 82      use, intrinsic :: iso_c_binding
 83      implicit none
 84      type(c_ptr)            , value             :: array1_ptr
 85      type(c_ptr)            , value             :: array2_ptr
 86      integer(kind=c_int32_t), value, intent(in) :: array_size
 87    end subroutine add_array_kokkos
 88 
 89    ! ========================================================================
 90    ! ========================================================================
 91 
 92    !> assemble energy contributions into ghc / gsc array
 93    subroutine assemble_energy_contribution_kokkos(ghc_ptr, &
 94      &                                            gsc_ptr, &
 95      &                                            kinpw_k2_ptr, &
 96      &                                            cwavef_ptr, &
 97      &                                            gvnlxc_ptr, &
 98      &                                            ndat, &
 99      &                                            my_nspinor, &
100      &                                            npw_k2, &
101      &                                            sij_opt, &
102      &                                            k1_eq_k2, &
103      &                                            hugevalue) &
104      & bind(c, name='assemble_energy_contribution_kokkos_cpp')
105      use, intrinsic :: iso_c_binding
106      implicit none
107      type(c_ptr)            , value             :: ghc_ptr
108      type(c_ptr)            , value             :: gsc_ptr
109      type(c_ptr)            , value             :: kinpw_k2_ptr
110      type(c_ptr)            , value             :: cwavef_ptr
111      type(c_ptr)            , value             :: gvnlxc_ptr
112      integer(kind=c_int32_t), value, intent(in) :: ndat
113      integer(kind=c_int32_t), value, intent(in) :: my_nspinor
114      integer(kind=c_int32_t), value, intent(in) :: npw_k2
115      integer(kind=c_int32_t), value, intent(in) :: sij_opt
116      logical(kind=c_bool),    value, intent(in) :: k1_eq_k2
117      real(kind=c_double),     value, intent(in) :: hugevalue
118    end subroutine assemble_energy_contribution_kokkos
119 
120 
121  end interface
122 
123 contains