Neko  0.8.99
A portable framework for high-order spectral element flow simulations
device_inhom_dirichlet.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, only : rp, c_rp
35  use utils, only : neko_error
36  use, intrinsic :: iso_c_binding
37  implicit none
38 
39 #ifdef HAVE_HIP
40  interface
41  subroutine hip_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m) &
42  bind(c, name='hip_inhom_dirichlet_apply_vector')
43  use, intrinsic :: iso_c_binding
44  import c_rp
45  implicit none
46  integer(c_int) :: m
47  type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z
49  end interface
50 #elif HAVE_CUDA
51  interface
52  subroutine cuda_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m) &
53  bind(c, name='cuda_inhom_dirichlet_apply_vector')
54  use, intrinsic :: iso_c_binding
55  import c_rp
56  implicit none
57  integer(c_int) :: m
58  type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z
60  end interface
61 #elif HAVE_OPENCL
62  interface
63  subroutine opencl_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m) &
64  bind(c, name='opencl_inhom_dirichlet_apply_vector')
65  use, intrinsic :: iso_c_binding
66  import c_rp
67  implicit none
68  integer(c_int) :: m
69  type(c_ptr), value :: msk, x, y, z, bla_x, bla_y, bla_z
71  end interface
72 
73 #endif
74 
75 #ifdef HAVE_HIP
76  interface
77  subroutine hip_inhom_dirichlet_apply_scalar(msk, x, bla_x, m) &
78  bind(c, name='hip_inhom_dirichlet_apply_scalar')
79  use, intrinsic :: iso_c_binding
80  import c_rp
81  implicit none
82  integer(c_int) :: m
83  type(c_ptr), value :: msk, x, bla_x
85  end interface
86 #elif HAVE_CUDA
87  interface
88  subroutine cuda_inhom_dirichlet_apply_scalar(msk, x, bla_x, m) &
89  bind(c, name='cuda_inhom_dirichlet_apply_scalar')
90  use, intrinsic :: iso_c_binding
91  import c_rp
92  implicit none
93  integer(c_int) :: m
94  type(c_ptr), value :: msk, x, bla_x
96  end interface
97 #elif HAVE_OPENCL
98  interface
99  subroutine opencl_inhom_dirichlet_apply_scalar(msk, x, bla_x, m) &
100  bind(c, name='opencl_inhom_dirichlet_apply_scalar')
101  use, intrinsic :: iso_c_binding
102  import c_rp
103  implicit none
104  integer(c_int) :: m
105  type(c_ptr), value :: msk, x, bla_x
107  end interface
108 #endif
109 
110 contains
111 
112  subroutine device_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m)
113  integer, intent(in) :: m
114  type(c_ptr) :: msk, x, y, z, bla_x, bla_y, bla_z
115 
116 #ifdef HAVE_HIP
117  call hip_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m)
118 #elif HAVE_CUDA
119  call cuda_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m)
120 #elif HAVE_OPENCL
121  call opencl_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m)
122 #else
123  call neko_error('No device backend configured')
124 #endif
125 
127 
128  subroutine device_inhom_dirichlet_apply_scalar(msk, x, bla_x, m)
129  integer, intent(in) :: m
130  type(c_ptr) :: msk, x, bla_x
131 
132 #ifdef HAVE_HIP
133  call hip_inhom_dirichlet_apply_scalar(msk, x, bla_x, m)
134 #elif HAVE_CUDA
135  call cuda_inhom_dirichlet_apply_scalar(msk, x, bla_x, m)
136 #elif HAVE_OPENCL
137  call opencl_inhom_dirichlet_apply_scalar(msk, x, bla_x, m)
138 #else
139  call neko_error('No device backend configured')
140 #endif
141 
143 
144 end module device_inhom_dirichlet
void opencl_inhom_dirichlet_apply_scalar(void *msk, void *x, void *bla_x, int *m)
void opencl_inhom_dirichlet_apply_vector(void *msk, void *x, void *y, void *z, void *bla_x, void *bla_y, void *bla_z, int *m)
void cuda_inhom_dirichlet_apply_vector(void *msk, void *x, void *y, void *z, void *bla_x, void *bla_y, void *bla_z, int *m)
void cuda_inhom_dirichlet_apply_scalar(void *msk, void *x, void *bla_x, int *m)
subroutine device_inhom_dirichlet_apply_vector(msk, x, y, z, bla_x, bla_y, bla_z, m)
subroutine device_inhom_dirichlet_apply_scalar(msk, x, bla_x, m)
integer, parameter, public c_rp
Definition: num_types.f90:13
integer, parameter, public rp
Global precision used in computations.
Definition: num_types.f90:12
Utilities.
Definition: utils.f90:35