Neko  0.9.99
A portable framework for high-order spectral element flow simulations
device_wall.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 utils, only : neko_error
35  use, intrinsic :: iso_c_binding, only : c_ptr, c_int
36  private
37 
38 #ifdef HAVE_HIP
39  interface
40  subroutine hip_no_slip_wall_apply_scalar(msk, x, m) &
41  bind(c, name='hip_no_slip_wall_apply_scalar')
42  use, intrinsic :: iso_c_binding
43  implicit none
44  integer(c_int) :: m
45  type(c_ptr), value :: msk, x
46  end subroutine hip_no_slip_wall_apply_scalar
47  end interface
48 
49  interface
50  subroutine hip_no_slip_wall_apply_vector(msk, x, y, z, m) &
51  bind(c, name='hip_no_slip_wall_apply_vector')
52  use, intrinsic :: iso_c_binding
53  implicit none
54  integer(c_int) :: m
55  type(c_ptr), value :: msk, x, y, z
56  end subroutine hip_no_slip_wall_apply_vector
57  end interface
58 #elif HAVE_CUDA
59  interface
60  subroutine cuda_no_slip_wall_apply_scalar(msk, x, m) &
61  bind(c, name='cuda_no_slip_wall_apply_scalar')
62  use, intrinsic :: iso_c_binding
63  implicit none
64  integer(c_int) :: m
65  type(c_ptr), value :: msk, x
66  end subroutine cuda_no_slip_wall_apply_scalar
67  end interface
68 
69  interface
70  subroutine cuda_no_slip_wall_apply_vector(msk, x, y, z, m) &
71  bind(c, name='cuda_no_slip_wall_apply_vector')
72  use, intrinsic :: iso_c_binding
73  implicit none
74  integer(c_int) :: m
75  type(c_ptr), value :: msk, x, y, z
76  end subroutine cuda_no_slip_wall_apply_vector
77  end interface
78 #elif HAVE_OPENCL
79  interface
80  subroutine opencl_no_slip_wall_apply_scalar(msk, x, m) &
81  bind(c, name='opencl_no_slip_wall_apply_scalar')
82  use, intrinsic :: iso_c_binding
83  implicit none
84  integer(c_int) :: m
85  type(c_ptr), value :: msk, x
87  end interface
88 
89  interface
90  subroutine opencl_no_slip_wall_apply_vector(msk, x, y, z, m) &
91  bind(c, name='opencl_no_slip_wall_apply_vector')
92  use, intrinsic :: iso_c_binding
93  implicit none
94  integer(c_int) :: m
95  type(c_ptr), value :: msk, x, y, z
97  end interface
98 #endif
99 
101 
102 contains
103 
104  subroutine device_no_slip_wall_apply_scalar(msk, x, m)
105  integer, intent(in) :: m
106  type(c_ptr) :: msk, x
107 
108 #ifdef HAVE_HIP
109  call hip_no_slip_wall_apply_scalar(msk, x, m)
110 #elif HAVE_CUDA
111  call cuda_no_slip_wall_apply_scalar(msk, x, m)
112 #elif HAVE_OPENCL
113  call opencl_no_slip_wall_apply_scalar(msk, x, m)
114 #else
115  call neko_error('No device backend configured')
116 #endif
117 
118  end subroutine device_no_slip_wall_apply_scalar
119 
120  subroutine device_no_slip_wall_apply_vector(msk, x, y, z, m)
121  integer, intent(in) :: m
122  type(c_ptr) :: msk, x, y, z
123 
124 #ifdef HAVE_HIP
125  call hip_no_slip_wall_apply_vector(msk, x, y, z, m)
126 #elif HAVE_CUDA
127  call cuda_no_slip_wall_apply_vector(msk, x, y, z, m)
128 #elif HAVE_OPENCL
129  call opencl_no_slip_wall_apply_vector(msk, x, y, z, m)
130 #else
131  call neko_error('No device backend configured')
132 #endif
133 
134  end subroutine device_no_slip_wall_apply_vector
135 
136 end module device_wall
subroutine, public device_no_slip_wall_apply_vector(msk, x, y, z, m)
subroutine, public device_no_slip_wall_apply_scalar(msk, x, m)
Utilities.
Definition: utils.f90:35
void opencl_no_slip_wall_apply_vector(void *msk, void *x, void *y, void *z, int *m)
Definition: no_slip_wall.c:79
void opencl_no_slip_wall_apply_scalar(void *msk, void *x, int *m)
Definition: no_slip_wall.c:52
void cuda_no_slip_wall_apply_scalar(void *msk, void *x, int *m)
Definition: no_slip_wall.cu:44
void cuda_no_slip_wall_apply_vector(void *msk, void *x, void *y, void *z, int *m)
Definition: no_slip_wall.cu:59