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