Neko 1.99.9
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, only : rp
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
53 logical :: shared_on_host = .true.
54 contains
55 procedure(gs_backend_init), pass(this), deferred :: init
56 procedure(gs_backend_free), pass(this), deferred :: free
57 procedure(gs_gather), pass(this), deferred :: gather
58 procedure(gs_scatter), pass(this), deferred :: scatter
59 end type gs_bcknd_t
60
62 abstract interface
63 subroutine gs_backend_init(this, nlocal, nshared, nlcl_blks, nshrd_blks)
64 import gs_bcknd_t
65 class(gs_bcknd_t), intent(inout) :: this
66 integer, intent(in) :: nlocal
67 integer, intent(in) :: nshared
68 integer, intent(in) :: nlcl_blks
69 integer, intent(in) :: nshrd_blks
70 end subroutine gs_backend_init
71 end interface
72
74 abstract interface
75 subroutine gs_backend_free(this)
76 import gs_bcknd_t
77 class(gs_bcknd_t), intent(inout) :: this
78 end subroutine gs_backend_free
79 end interface
80
83 abstract interface
84 subroutine gs_gather(this, v, m, o, dg, u, n, gd, nb, b, bo, op, shrd)
85 import gs_bcknd_t
86 import rp
87 integer, intent(in) :: m
88 integer, intent(in) :: n
89 integer, intent(in) :: nb
90 class(gs_bcknd_t), intent(inout) :: this
91 real(kind=rp), dimension(m), intent(inout) :: v
92 integer, dimension(m), intent(inout) :: dg
93 real(kind=rp), dimension(n), intent(inout) :: u
94 integer, dimension(m), intent(inout) :: gd
95 integer, dimension(nb), intent(inout) :: b
96 integer, dimension(nb), intent(inout) :: bo
97 integer, intent(in) :: o
98 integer, intent(in) :: op
99 logical, intent(in) :: shrd
100 end subroutine gs_gather
101 end interface
102
105 abstract interface
106 subroutine gs_scatter(this, v, m, dg, u, n, gd, nb, b, bo, shrd, event)
107 import gs_bcknd_t
108 import c_ptr
109 import rp
110 integer, intent(in) :: m
111 integer, intent(in) :: n
112 integer, intent(in) :: nb
113 class(gs_bcknd_t), intent(inout) :: this
114 real(kind=rp), dimension(m), intent(inout) :: v
115 integer, dimension(m), intent(inout) :: dg
116 real(kind=rp), dimension(n), intent(inout) :: u
117 integer, dimension(m), intent(inout) :: gd
118 integer, dimension(nb), intent(inout) :: b
119 integer, dimension(nb), intent(inout) :: bo
120 logical, intent(in) :: shrd
121 type(c_ptr) :: event
122 end subroutine gs_scatter
123 end interface
124
125
126end module gs_bcknd
Abstract interface for deallocating a Gather-Scatter backend.
Definition gs_bcknd.f90:75
Abstract interface for initialising a Gather-Scatter backend.
Definition gs_bcknd.f90:63
Abstract interface for the Gather kernel .
Definition gs_bcknd.f90:84
Abstract interface for the Scatter kernel .
Definition gs_bcknd.f90:106
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:14
Gather-scatter backend.
Definition gs_bcknd.f90:44