Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_symmetry.F90
Go to the documentation of this file.
1! Copyright (c) 2021-2025, 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
39#ifdef HAVE_HIP
40 interface
41 subroutine hip_symmetry_apply_vector(xmsk, ymsk, zmsk, &
42 x, y, z, m, n, l, strm) &
43 bind(c, name='hip_symmetry_apply_vector')
44 use, intrinsic :: iso_c_binding
45 implicit none
46 integer(c_int) :: m, n, l
47 type(c_ptr), value :: xmsk, ymsk, zmsk, x, y, z, strm
48 end subroutine hip_symmetry_apply_vector
49 end interface
50#elif HAVE_CUDA
51 interface
52 subroutine cuda_symmetry_apply_vector(xmsk, ymsk, zmsk, &
53 x, y, z, m, n, l, strm) &
54 bind(c, name='cuda_symmetry_apply_vector')
55 use, intrinsic :: iso_c_binding
56 implicit none
57 integer(c_int) :: m, n, l
58 type(c_ptr), value :: xmsk, ymsk, zmsk, x, y, z, strm
59 end subroutine cuda_symmetry_apply_vector
60 end interface
61#elif HAVE_OPENCL
62 interface
63 subroutine opencl_symmetry_apply_vector(xmsk, ymsk, zmsk, &
64 x, y, z, m, n, l, strm) &
65 bind(c, name='opencl_symmetry_apply_vector')
66 use, intrinsic :: iso_c_binding
67 implicit none
68 integer(c_int) :: m, n, l
69 type(c_ptr), value :: xmsk, ymsk, zmsk, x, y, z, strm
70 end subroutine opencl_symmetry_apply_vector
71 end interface
72#endif
73
74contains
75
76 subroutine device_symmetry_apply_vector(xmsk, ymsk, zmsk, &
77 x, y, z, m, n, l, strm)
78 integer, intent(in) :: m, n, l
79 type(c_ptr) :: xmsk, ymsk, zmsk, x, y, z, strm
80
81#ifdef HAVE_HIP
82 call hip_symmetry_apply_vector(xmsk, ymsk, zmsk, x, y, z, m, n, l, strm)
83#elif HAVE_CUDA
84 call cuda_symmetry_apply_vector(xmsk, ymsk, zmsk, x, y, z, m, n, l, strm)
85#elif HAVE_OPENCL
86 call opencl_symmetry_apply_vector(xmsk, ymsk, zmsk, x, y, z, m, n, l, strm)
87#else
88 call neko_error('No device backend configured')
89#endif
90
91 end subroutine device_symmetry_apply_vector
92
93end module device_symmetry
subroutine device_symmetry_apply_vector(xmsk, ymsk, zmsk, x, y, z, m, n, l, strm)
Utilities.
Definition utils.f90:35
void opencl_symmetry_apply_vector(void *xmsk, void *ymsk, void *zmsk, void *x, void *y, void *z, int *m, int *n, int *l, cl_command_queue cmd_queue)
Definition symmetry.c:54
void cuda_symmetry_apply_vector(void *xmsk, void *ymsk, void *zmsk, void *x, void *y, void *z, int *m, int *n, int *l, cudaStream_t strm)
Definition symmetry.cu:47