Neko  0.8.99
A portable framework for high-order spectral element flow simulations
device_facet_normal.F90
Go to the documentation of this file.
1 ! Copyright (c) 2021-2023, The Neko Authors
2 ! All rights reserved.
3 !
4 ! Redistribution and use in source and binary forms, with or without
5 ! modification, are permitted provided that the following conditions
6 ! are met:
7 !
8 ! * Redistributions of source code must retain the above copyright
9 ! notice, this list of conditions and the following disclaimer.
10 !
11 ! * Redistributions in binary form must reproduce the above
12 ! copyright notice, this list of conditions and the following
13 ! disclaimer in the documentation and/or other materials provided
14 ! with the distribution.
15 !
16 ! * Neither the name of the authors nor the names of its
17 ! contributors may be used to endorse or promote products derived
18 ! from this software without specific prior written permission.
19 !
20 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 ! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 ! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 ! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 ! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 ! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 ! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 ! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 ! POSSIBILITY OF SUCH DAMAGE.
32 !
34  use utils, only : neko_error
35  use, intrinsic :: iso_c_binding, only : c_int, c_ptr
36  implicit none
37  private
38 
39 #ifdef HAVE_HIP
40  interface
41  subroutine hip_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
42  nx, ny, nz, area, lx, m) &
43  bind(c, name='hip_facet_normal_apply_surfvec')
44  use, intrinsic :: iso_c_binding
45  implicit none
46  integer(c_int) :: m, lx
47  type(c_ptr), value :: msk, facet, x, y, z, u, v, w, nx, ny, nz, area
48  end subroutine hip_facet_normal_apply_surfvec
49  end interface
50 #elif HAVE_CUDA
51  interface
52  subroutine cuda_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
53  nx, ny, nz, area, lx, m) &
54  bind(c, name='cuda_facet_normal_apply_surfvec')
55  use, intrinsic :: iso_c_binding
56  implicit none
57  integer(c_int) :: m, lx
58  type(c_ptr), value :: msk, facet, x, y, z, u, v, w, nx, ny, nz, area
59  end subroutine cuda_facet_normal_apply_surfvec
60  end interface
61 #elif HAVE_OPENCL
62  interface
63  subroutine opencl_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
64  nx, ny, nz, area, lx, m) &
65  bind(c, name='opencl_facet_normal_apply_surfvec')
66  use, intrinsic :: iso_c_binding
67  implicit none
68  integer(c_int) :: m, lx
69  type(c_ptr), value :: msk, facet, x, y, z, u, v, w, nx, ny, nz, area
71  end interface
72 #endif
73 
75 
76 contains
77 
78  subroutine device_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
79  nx, ny, nz, area, lx, m)
80  integer, intent(in) :: m, lx
81  type(c_ptr) :: msk, facet, x, y, z, u, v, w, nx, ny, nz, area
82 
83 #ifdef HAVE_HIP
84  call hip_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
85  nx, ny, nz, area, lx, m)
86 #elif HAVE_CUDA
87  call cuda_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
88  nx, ny, nz, area, lx, m)
89 #elif HAVE_OPENCL
90  call opencl_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, &
91  nx, ny, nz, area, lx, m)
92 #else
93  call neko_error('No device backend configured')
94 #endif
95 
97 
98 end module device_facet_normal
void opencl_facet_normal_apply_surfvec(void *msk, void *facet, void *x, void *y, void *z, void *u, void *v, void *w, void *nx, void *ny, void *nz, void *area, int *lx, int *m)
Definition: facet_normal.c:52
void cuda_facet_normal_apply_surfvec(void *msk, void *facet, void *x, void *y, void *z, void *u, void *v, void *w, void *nx, void *ny, void *nz, void *area, int *lx, int *m)
Definition: facet_normal.cu:44
subroutine, public device_facet_normal_apply_surfvec(msk, facet, x, y, z, u, v, w, nx, ny, nz, area, lx, m)
Utilities.
Definition: utils.f90:35