Neko
1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
mappings_device.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
module
mappings_device
35
use
num_types
,
only
:
rp
,
c_rp
36
use,
intrinsic
:: iso_c_binding, only : c_ptr
37
use
utils
,
only
:
neko_error
38
39
use
cuda_mappings
,
only
: &
40
cuda_smooth_step
,
cuda_step_function
,
cuda_permeability
41
use
hip_mappings
,
only
: &
42
hip_smooth_step
,
hip_step_function
,
hip_permeability
43
use
opencl_mappings
,
only
: &
44
opencl_smooth_step
,
opencl_step_function
,
opencl_permeability
45
use
metal_mappings
,
only
: &
46
metal_smooth_step
,
metal_step_function
,
metal_permeability
47
48
implicit none
49
50
contains
51
52
! ========================================================================== !
53
! Internal functions and subroutines
54
! ========================================================================== !
55
57
subroutine
smooth_step_device
(x, edge0, edge1, n)
58
type
(c_ptr),
intent(inout)
:: x
59
real
(kind=
rp
),
intent(in)
:: edge0, edge1
60
integer
,
intent(in)
:: n
61
62
#if HAVE_HIP == 1
63
call
hip_smooth_step
(x, edge0, edge1, n)
64
#elif HAVE_CUDA == 1
65
call
cuda_smooth_step
(x, edge0, edge1, n)
66
#elif HAVE_OPENCL == 1
67
call
opencl_smooth_step
(x, edge0, edge1, n)
68
#elif HAVE_METAL
69
call
metal_smooth_step
(x, edge0, edge1, n)
70
#else
71
call
neko_error
(&
72
"Smooth step function not implemented for the current device."
)
73
#endif
74
75
end subroutine
smooth_step_device
76
78
subroutine
step_function_device
(x, x_step, value0, value1, n)
79
type
(c_ptr),
intent(inout)
:: x
80
real
(kind=
rp
),
intent(in)
:: x_step, value0, value1
81
integer
,
intent(in)
:: n
82
83
#if HAVE_HIP == 1
84
call
hip_step_function
(x, x_step, value0, value1, n)
85
#elif HAVE_CUDA == 1
86
call
cuda_step_function
(x, x_step, value0, value1, n)
87
#elif HAVE_OPENCL == 1
88
call
opencl_step_function
(x, x_step, value0, value1, n)
89
#elif HAVE_METAL
90
call
metal_step_function
(x, x_step, value0, value1, n)
91
#else
92
call
neko_error
(&
93
"Step function not implemented for the current device."
)
94
#endif
95
96
end subroutine
step_function_device
97
99
subroutine
permeability_device
(x, k_0, k_1, q, n)
100
type
(c_ptr),
intent(inout)
:: x
101
real
(kind=
rp
),
intent(in)
:: k_0, k_1, q
102
integer
,
intent(in)
:: n
103
104
#if HAVE_HIP == 1
105
call
hip_permeability
(x, k_0, k_1, q, n)
106
#elif HAVE_CUDA == 1
107
call
cuda_permeability
(x, k_0, k_1, q, n)
108
#elif HAVE_OPENCL == 1
109
call
opencl_permeability
(x, k_0, k_1, q, n)
110
#elif HAVE_METAL
111
call
metal_permeability
(x, k_0, k_1, q, n)
112
#else
113
call
neko_error
(&
114
"Permeability function not implemented for the current device."
)
115
#endif
116
117
end subroutine
permeability_device
118
119
120
end module
mappings_device
cuda_mappings::cuda_permeability
Definition
cuda_mappings.f90:61
cuda_mappings::cuda_smooth_step
Definition
cuda_mappings.f90:43
cuda_mappings::cuda_step_function
Definition
cuda_mappings.f90:52
hip_mappings::hip_permeability
Definition
hip_mappings.f90:61
hip_mappings::hip_smooth_step
Definition
hip_mappings.f90:43
hip_mappings::hip_step_function
Definition
hip_mappings.f90:52
metal_mappings::metal_permeability
Definition
metal_mappings.f90:61
metal_mappings::metal_smooth_step
Definition
metal_mappings.f90:43
metal_mappings::metal_step_function
Definition
metal_mappings.f90:52
opencl_mappings::opencl_permeability
Definition
opencl_mappings.f90:61
opencl_mappings::opencl_smooth_step
Definition
opencl_mappings.f90:43
opencl_mappings::opencl_step_function
Definition
opencl_mappings.f90:52
utils::neko_error
Definition
utils.f90:45
cuda_mappings
Cuda interface binding for mappings.
Definition
cuda_mappings.f90:34
hip_mappings
Hip interface binding for mappings.
Definition
hip_mappings.f90:34
mappings_device
Device implementations of the mapping functions.
Definition
mappings_device.F90:34
mappings_device::permeability_device
subroutine permeability_device(x, k_0, k_1, q, n)
Apply a permeability function to a scalar.
Definition
mappings_device.F90:100
mappings_device::step_function_device
subroutine step_function_device(x, x_step, value0, value1, n)
Apply a step function to a scalar.
Definition
mappings_device.F90:79
mappings_device::smooth_step_device
subroutine smooth_step_device(x, edge0, edge1, n)
Apply a smooth step function to a scalar.
Definition
mappings_device.F90:58
metal_mappings
Metal interface binding for mappings.
Definition
metal_mappings.f90:34
num_types
Definition
num_types.f90:1
num_types::c_rp
integer, parameter, public c_rp
Definition
num_types.f90:13
num_types::rp
integer, parameter, public rp
Global precision used in computations.
Definition
num_types.f90:12
opencl_mappings
OpenCL interface binding for mappings.
Definition
opencl_mappings.f90:34
utils
Utilities.
Definition
utils.f90:35
src
filter
bcknd
device
mappings_device.F90
Generated on Tue Jun 16 2026 05:17:17 for Neko by
1.9.8