Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_inflow.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, only : c_ptr
37 private
38
39#ifdef HAVE_HIP
40
41 interface
42 subroutine hip_inflow_apply_vector(msk, x, y, z, g, m) &
43 bind(c, name='hip_inflow_apply_vector')
44 use, intrinsic :: iso_c_binding
45 implicit none
46 integer(c_int) :: m
47 type(c_ptr), value :: msk, x, y, z, g
48 end subroutine hip_inflow_apply_vector
49 end interface
50
51#elif HAVE_CUDA
52
53 interface
54 subroutine cuda_inflow_apply_vector(msk, x, y, z, g, m) &
55 bind(c, name='cuda_inflow_apply_vector')
56 use, intrinsic :: iso_c_binding
57 implicit none
58 integer(c_int) :: m
59 type(c_ptr), value :: msk, x, y, z, g
60 end subroutine cuda_inflow_apply_vector
61 end interface
62
63#elif HAVE_OPENCL
64
65 interface
66 subroutine opencl_inflow_apply_vector(msk, x, y, z, g, m) &
67 bind(c, name='opencl_inflow_apply_vector')
68 use, intrinsic :: iso_c_binding
69 implicit none
70 integer(c_int) :: m
71 type(c_ptr), value :: msk, x, y, z, g
72 end subroutine opencl_inflow_apply_vector
73 end interface
74
75#endif
76
78
79contains
80
81 subroutine device_inflow_apply_vector(msk, x, y, z, g, m)
82 integer, intent(in) :: m
83 type(c_ptr) :: msk, x, y, z, g
84
85#ifdef HAVE_HIP
86 call hip_inflow_apply_vector(msk, x, y, z, g, m)
87#elif HAVE_CUDA
88 call cuda_inflow_apply_vector(msk, x, y, z, g, m)
89#elif HAVE_OPENCL
90 call opencl_inflow_apply_vector(msk, x, y, z, g, m)
91#else
92 call neko_error('No device backend configured')
93#endif
94
95 end subroutine device_inflow_apply_vector
96
97end module device_inflow
98
void opencl_inflow_apply_vector(void *msk, void *x, void *y, void *z, void *g, int *m)
Definition inflow.c:52
void cuda_inflow_apply_vector(void *msk, void *x, void *y, void *z, void *g, int *m)
Definition inflow.cu:44
subroutine, public device_inflow_apply_vector(msk, x, y, z, g, m)
Utilities.
Definition utils.f90:35