Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
gs_bcknd.f90
Go to the documentation of this file.
1! Copyright (c) 2021, 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!
35 use num_types
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 integer, public, parameter :: gs_bcknd_cpu = 1, gs_bcknd_sx = 2, &
41 gs_bcknd_dev = 3
42
44 type, public, abstract :: gs_bcknd_t
45 type(c_ptr) :: gather_event = c_null_ptr
46 type(c_ptr) :: scatter_event = c_null_ptr
47 type(c_ptr) :: gs_stream = c_null_ptr
48 contains
49 procedure(gs_backend_init), pass(this), deferred :: init
50 procedure(gs_backend_free), pass(this), deferred :: free
51 procedure(gs_gather), pass(this), deferred :: gather
52 procedure(gs_scatter), pass(this), deferred :: scatter
53 end type gs_bcknd_t
54
56 abstract interface
57 subroutine gs_backend_init(this, nlocal, nshared, nlcl_blks, nshrd_blks)
58 import gs_bcknd_t
59 class(gs_bcknd_t), intent(inout) :: this
60 integer, intent(in) :: nlocal
61 integer, intent(in) :: nshared
62 integer, intent(in) :: nlcl_blks
63 integer, intent(in) :: nshrd_blks
64 end subroutine gs_backend_init
65 end interface
66
68 abstract interface
69 subroutine gs_backend_free(this)
70 import gs_bcknd_t
71 class(gs_bcknd_t), intent(inout) :: this
72 end subroutine gs_backend_free
73 end interface
74
77 abstract interface
78 subroutine gs_gather(this, v, m, o, dg, u, n, gd, nb, b, op, shrd)
79 import gs_bcknd_t
80 import rp
81 integer, intent(in) :: m
82 integer, intent(in) :: n
83 integer, intent(in) :: nb
84 class(gs_bcknd_t), intent(inout) :: this
85 real(kind=rp), dimension(m), intent(inout) :: v
86 integer, dimension(m), intent(inout) :: dg
87 real(kind=rp), dimension(n), intent(inout) :: u
88 integer, dimension(m), intent(inout) :: gd
89 integer, dimension(nb), intent(inout) :: b
90 integer, intent(in) :: o
91 integer, intent(in) :: op
92 logical, intent(in) :: shrd
93 end subroutine gs_gather
94 end interface
95
98 abstract interface
99 subroutine gs_scatter(this, v, m, dg, u, n, gd, nb, b, shrd, event)
100 import gs_bcknd_t
101 import c_ptr
102 import rp
103 integer, intent(in) :: m
104 integer, intent(in) :: n
105 integer, intent(in) :: nb
106 class(gs_bcknd_t), intent(inout) :: this
107 real(kind=rp), dimension(m), intent(inout) :: v
108 integer, dimension(m), intent(inout) :: dg
109 real(kind=rp), dimension(n), intent(inout) :: u
110 integer, dimension(m), intent(inout) :: gd
111 integer, dimension(nb), intent(inout) :: b
112 logical, intent(in) :: shrd
113 type(c_ptr) :: event
114 end subroutine gs_scatter
115 end interface
116
117
118end module gs_bcknd
Abstract interface for deallocating a Gather-Scatter backend.
Definition gs_bcknd.f90:69
Abstract interface for initialising a Gather-Scatter backend.
Definition gs_bcknd.f90:57
Abstract interface for the Gather kernel .
Definition gs_bcknd.f90:78
Abstract interface for the Scatter kernel .
Definition gs_bcknd.f90:99
Defines a gather-scatter backend.
Definition gs_bcknd.f90:34
integer, parameter, public gs_bcknd_cpu
Definition gs_bcknd.f90:40
integer, parameter, public gs_bcknd_sx
Definition gs_bcknd.f90:40
integer, parameter, public gs_bcknd_dev
Definition gs_bcknd.f90:40
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Gather-scatter backend.
Definition gs_bcknd.f90:44