Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_gradient_jump_penalty.F90
Go to the documentation of this file.
1! Copyright (c) 2024, 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 : c_rp, rp
35 use utils, only : neko_error
36 use device, only : glb_cmd_queue
37 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
38 implicit none
39 private
40
41#ifdef HAVE_HIP
42 interface
43 subroutine hip_pick_facet_value_hex(b_d, a_d, nx, nelv) &
44 bind(c, name = 'hip_pick_facet_value_hex')
45 use, intrinsic :: iso_c_binding
46 import c_rp
47 implicit none
48 type(c_ptr), value :: a_d, b_d
49 integer(c_int) :: nx, nelv
50 end subroutine hip_pick_facet_value_hex
51 end interface
52 interface
53 subroutine hip_gradient_jump_penalty_finalize(penalty_d, &
54 penalty_facet_d, &
55 dphidxi_d, &
56 nx, nelv) &
57 bind(c, name = 'hip_gradient_jump_penalty_finalize')
58 use, intrinsic :: iso_c_binding
59 import c_rp
60 implicit none
61 type(c_ptr), value :: penalty_d, &
62 penalty_facet_d, dphidxi_d
63 integer(c_int) :: nx, nelv
65 end interface
66#elif HAVE_CUDA
67 interface
68 subroutine cuda_pick_facet_value_hex(b_d, a_d, nx, nelv) &
69 bind(c, name = 'cuda_pick_facet_value_hex')
70 use, intrinsic :: iso_c_binding
71 import c_rp
72 implicit none
73 type(c_ptr), value :: a_d, b_d
74 integer(c_int) :: nx, nelv
75 end subroutine cuda_pick_facet_value_hex
76 end interface
77 interface
78 subroutine cuda_gradient_jump_penalty_finalize(penalty_d, &
79 penalty_facet_d, &
80 dphidxi_d, &
81 nx, nelv) &
82 bind(c, name = 'cuda_gradient_jump_penalty_finalize')
83 use, intrinsic :: iso_c_binding
84 import c_rp
85 implicit none
86 type(c_ptr), value :: penalty_d, &
87 penalty_facet_d, dphidxi_d
88 integer(c_int) :: nx, nelv
90 end interface
91#elif HAVE_OPENCL
92
93#endif
94
97
98contains
99
100 subroutine device_pick_facet_value_hex(b_d, a_d, nx, nelv)
101 integer, intent(in) :: nx, nelv
102 type(c_ptr) :: a_d, b_d
103#ifdef HAVE_HIP
104 call hip_pick_facet_value_hex(b_d, a_d, nx, nelv)
105#elif HAVE_CUDA
106 call cuda_pick_facet_value_hex(b_d, a_d, nx, nelv)
107#elif HAVE_OPENCL
108 call neko_error('OPENCL is not implemented for gradient jump penalty')
109#else
110 call neko_error('No device backend configured')
111#endif
112
113 end subroutine device_pick_facet_value_hex
114
116 penalty_facet_d, &
117 dphidxi_d, &
118 nx, nelv)
119 integer, intent(in) :: nx, nelv
120 type(c_ptr) :: penalty_d, penalty_facet_d, dphidxi_d
121#ifdef HAVE_HIP
122 call hip_gradient_jump_penalty_finalize(penalty_d, &
123 penalty_facet_d, &
124 dphidxi_d, &
125 nx, nelv)
126#elif HAVE_CUDA
128 penalty_facet_d, &
129 dphidxi_d, &
130 nx, nelv)
131#elif HAVE_OPENCL
132 call neko_error('OPENCL is not implemented for gradient jump penalty')
133#else
134 call neko_error('No device backend configured')
135#endif
136
138
void cuda_gradient_jump_penalty_finalize(void *penalty_d, void *penalty_facet_d, void *dphidxi_d, int *nx, int *nel)
void cuda_pick_facet_value_hex(void *b, void *a, int *nx, int *nel)
subroutine, public device_gradient_jump_penalty_finalize(penalty_d, penalty_facet_d, dphidxi_d, nx, nelv)
subroutine, public device_pick_facet_value_hex(b_d, a_d, nx, nelv)
Device abstraction, common interface for various accelerators.
Definition device.F90:34
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