Neko  0.9.99
A portable framework for high-order spectral element flow simulations
device_dong_outflow.F90
Go to the documentation of this file.
1 ! Copyright (c) 2021-2022, 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 num_types
35  use utils
36  use, intrinsic :: iso_c_binding
37  implicit none
38  private
39 
40 #ifdef HAVE_HIP
41  interface
42  subroutine hip_dong_outflow_apply_scalar(msk, x, normal_x, normal_y,&
43  normal_z, u, v, w, uinf, delta, m) &
44  bind(c, name='hip_dong_outflow_apply_scalar')
45  use, intrinsic :: iso_c_binding
46  import c_rp
47  implicit none
48  integer(c_int) :: m
49  real(kind=c_rp) :: uinf, delta
50  type(c_ptr), value :: msk, x, u, v, w, normal_x, normal_y, normal_z
51  end subroutine hip_dong_outflow_apply_scalar
52  end interface
53 #elif HAVE_CUDA
54  interface
55  subroutine cuda_dong_outflow_apply_scalar(msk, x, normal_x, normal_y,&
56  normal_z, u, v, w, uinf, delta, m) &
57  bind(c, name='cuda_dong_outflow_apply_scalar')
58  use, intrinsic :: iso_c_binding
59  import c_rp
60  implicit none
61  integer(c_int) :: m
62  real(kind=c_rp) :: uinf, delta
63  type(c_ptr), value :: msk, x, u, v, w, normal_x, normal_y, normal_z
64  end subroutine cuda_dong_outflow_apply_scalar
65  end interface
66 #elif HAVE_OPENCL
67  interface
68  subroutine opencl_dong_outflow_apply_scalar(msk, x, normal_x, normal_y,&
69  normal_z, u, v, w, uinf, delta, m) &
70  bind(c, name='opencl_dong_outflow_apply_scalar')
71  use, intrinsic :: iso_c_binding
72  import c_rp
73  implicit none
74  integer(c_int) :: m
75  real(kind=c_rp) :: uinf, delta
76  type(c_ptr), value :: msk, x, u, v, w, normal_x, normal_y, normal_z
78  end interface
79 #endif
80 
82 
83 contains
84 
85  subroutine device_dong_outflow_apply_scalar(msk, x, normal_x, normal_y,&
86  normal_z, u, v, w, uinf, delta, m)
87  integer(c_int) :: m
88  real(kind=c_rp) :: uinf, delta
89  type(c_ptr) :: msk, x, u, v, w, normal_x, normal_y, normal_z
90 
91 #ifdef HAVE_HIP
92  call hip_dong_outflow_apply_scalar(msk, x, normal_x, normal_y, &
93  normal_z, u, v, w, uinf, delta, m)
94 #elif HAVE_CUDA
95  call cuda_dong_outflow_apply_scalar(msk, x, normal_x, normal_y, &
96  normal_z, u, v, w, uinf, delta, m)
97 #elif HAVE_OPENCL
98  call opencl_dong_outflow_apply_scalar(msk, x, normal_x, normal_y, &
99  normal_z, u, v, w, uinf, delta, m)
100 
101 #else
102  call neko_error('No device backend configured')
103 #endif
104 
105  end subroutine device_dong_outflow_apply_scalar
106 
107 end module device_dong_outflow
void opencl_dong_outflow_apply_scalar(void *msk, void *x, void *normal_x, void *normal_y, void *normal_z, void *u, void *v, void *w, real *uinf, real *delta, int *m)
Definition: dong_outflow.c:52
void cuda_dong_outflow_apply_scalar(void *msk, void *x, void *normal_x, void *normal_y, void *normal_z, void *u, void *v, void *w, real *uinf, real *delta, int *m)
Definition: dong_outflow.cu:44
subroutine, public device_dong_outflow_apply_scalar(msk, x, normal_x, normal_y, normal_z, u, v, w, uinf, delta, m)
integer, parameter, public c_rp
Definition: num_types.f90:13
Utilities.
Definition: utils.f90:35