Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_neumann.F90
Go to the documentation of this file.
1! Copyright (c) 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 utils, only : neko_error
35 use, intrinsic :: iso_c_binding, only : c_int, c_ptr
36 implicit none
37 private
38
39#ifdef HAVE_HIP
40 interface
41 subroutine hip_neumann_apply_scalar(msk, facet, x, flux, area, &
42 lx, m, strm) &
43 bind(c, name='hip_neumann_apply_scalar')
44 use, intrinsic :: iso_c_binding
45 implicit none
46 integer(c_int) :: m, lx
47 type(c_ptr), value :: msk, facet, x, flux, area, strm
48 end subroutine hip_neumann_apply_scalar
49 end interface
50#elif HAVE_CUDA
51 interface
52 subroutine cuda_neumann_apply_scalar(msk, facet, x, flux, area, &
53 lx, m, strm) &
54 bind(c, name='cuda_neumann_apply_scalar')
55 use, intrinsic :: iso_c_binding
56 implicit none
57 integer(c_int) :: m, lx
58 type(c_ptr), value :: msk, facet, x, flux, area, strm
59 end subroutine cuda_neumann_apply_scalar
60 end interface
61#elif HAVE_OPENCL
62 interface
63 subroutine opencl_neumann_apply_scalar(msk, facet, x, flux, area, &
64 lx, m, strm) &
65 bind(c, name='opencl_neumann_apply_scalar')
66 use, intrinsic :: iso_c_binding
67 implicit none
68 integer(c_int) :: m, lx
69 type(c_ptr), value :: msk, facet, x, flux, area, strm
70 end subroutine opencl_neumann_apply_scalar
71 end interface
72#endif
73
75
76contains
77
78 subroutine device_neumann_apply_scalar(msk, facet, x, flux, area, lx, m, strm)
79 integer, intent(in) :: m, lx
80 type(c_ptr) :: msk, facet, x, flux, area, strm
81
82 if (m .lt. 1) return
83#ifdef HAVE_HIP
84 call hip_neumann_apply_scalar(msk, facet, x, flux, area, lx, m, strm)
85#elif HAVE_CUDA
86 call cuda_neumann_apply_scalar(msk, facet, x, flux, area, lx, m, strm)
87#elif HAVE_OPENCL
88 call opencl_neumann_apply_scalar(msk, facet, x, flux, area, lx, m, strm)
89#else
90 call neko_error('No device backend configured')
91#endif
92
93 end subroutine device_neumann_apply_scalar
94
95end module device_neumann
subroutine, public device_neumann_apply_scalar(msk, facet, x, flux, area, lx, m, strm)
Utilities.
Definition utils.f90:35
void opencl_neumann_apply_scalar(void *msk, void *facet, void *x, void *flux, void *area, int *lx, int *m, cl_command_queue cmd_queue)
Definition neumann.c:52
void cuda_neumann_apply_scalar(void *msk, void *facet, void *x, void *flux, void *area, int *lx, int *m, cudaStream_t strm)
Definition neumann.cu:44