File: devxlib_auxfunc.jf90

package info (click to toggle)
devicexlib 0.8.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,364 kB
  • sloc: f90: 77,678; sh: 3,701; fortran: 773; makefile: 268; python: 246; ansic: 69; awk: 36
file content (312 lines) | stat: -rw-r--r-- 14,206 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
!                                                                                                                                                         c
! Copyright (C) 2021, MaX CoE
! Distributed under the MIT License 
! (license terms are at http://opensource.org/licenses/MIT).
!
!--
!
! Auxiliary functions
!
! AF: OpenACC support is incomplete !!
!
!==================================================================
!==================================================================
! *DO NOT EDIT*: automatically generated from devxlib_auxfunc.jf90
!==================================================================
!==================================================================
!
#include<devxlib_macros.h>
#include<devxlib_defs.h>
!
!=======================================
!
module devxlib_auxfunc
   !
   use iso_fortran_env,     only : real32, real64
   use devxlib_async,       only : dxl_async_kind
   use devxlib_environment, only : devxlib_error
   !
#if defined __DXL_CUDAF
   use cudafor
#endif

   implicit none

   private :: dxl_async_kind

   interface devxlib_conjg_d
      module procedure &
{% set t='complex' %}
{%- for p in precision %}
{%- set outer_loop = loop %}
{%- for d in range(1,dimensions+1,3) %}
{%- if (d+1)<=dimensions %}
{%- if (d+2)<=dimensions %}
         {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d+1}}d, {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d+2}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- else %}
         {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d+1}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- else %}
         {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}
   endinterface devxlib_conjg_d


   interface devxlib_conjg_h
      module procedure &
{% set t='complex' %}
{%- for p in precision %}
{%- set outer_loop = loop %}
{%- for d in range(1,dimensions+1,3) %}
{%- if (d+1)<=dimensions %}
{%- if (d+2)<=dimensions %}
         {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d+1}}d, {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d+2}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- else %}
         {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d+1}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- else %}
         {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}
   endinterface devxlib_conjg_h


   interface devxlib_conjg_d_p
      module procedure &
{% set t='complex' %}
{%- for p in precision %}
{%- set outer_loop = loop %}
{%- for d in range(1,dimensions+1,3) %}
{%- if (d+1)<=dimensions %}
{%- if (d+2)<=dimensions %}
         {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d_p, {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d+1}}d_p, {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d+2}}d_p{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- else %}
         {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d_p, {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d+1}}d_p{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- else %}
         {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d_p{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}
   endinterface devxlib_conjg_d_p

   interface devxlib_vec_upd_remap
      module procedure &
{% set d=1 %}
{%- for p in precision %}
{%- set outer_loop = loop %}
{%- for t in types %}
         {{p.name}}_devxlib_vec_upd_remap_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endfor %}
{%- endfor %}
   endinterface devxlib_vec_upd_remap

   interface devxlib_vec_upd_v_remap_v
      module procedure &
{% set d=1 %}
{%- for p in precision %}
{%- set outer_loop = loop %}
{%- for t in types %}
         {{p.name}}_devxlib_vec_upd_v_remap_v_{{t[0]|lower}}{{d}}d, &
{%- endfor %}
{%- endfor %}
{% set d=1 %}
{% set t= "complex" %}
{%- for p in precision %}
         {{p.name}}_devxlib_vec_upd_v_remap_v_x_{{t[0]|lower}}{{d}}d{% if (not loop.last)%}, &{%- endif %}
{%- endfor %}
   endinterface devxlib_vec_upd_v_remap_v

   interface devxlib_mat_upd_dMd
      module procedure &
{% set d=2 %}
{%- for p in precision %}
{%- set outer_loop = loop %}
{%- for t in types %}
         {{p.name}}_devxlib_mat_upd_dMd_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endfor %}
{%- endfor %}
   endinterface devxlib_mat_upd_dMd

   interface devxlib_mem_addscal
      module procedure &
{%- for t in types %}
{%- set outer_loop = loop %}
{%- for p in precision %}
{%- set medium_loop = loop %}
{%- for d in range(1,dimensions+1,3) %}
{%- if (d+1)<=dimensions %}
{%- if (d+2)<=dimensions %}
         {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d+1}}d, {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d+2}}d{% if ((not loop.last) or (not medium_loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- else %}
         {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d+1}}d{% if ((not loop.last) or (not medium_loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- else %}
         {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not medium_loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}
{%- endfor %}
   endinterface devxlib_mem_addscal

   interface
{% set t='complex' %}
{%- for p in precision %}
{%- for d in range(1,dimensions+1) %}
      module subroutine {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d(array_inout, async_id, &
                                        {% for dd in range(d) %}
                                        {{ "range%s"|format(dd+1) }}, {{ "lbound%s"|format(dd+1) }}{% if not loop.last %}, &
                                        {%- endif %}{% endfor %} )
         implicit none
         {{t}}({{p.val}}) DEV_ATTR, intent(inout) :: array_inout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         integer(kind=dxl_async_kind), optional, intent(in) :: async_id
         integer, optional, intent(in) :: {% for dd in range(d) %} {{ "range%s(2)"|format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
         integer, optional, intent(in) :: {% for dd in range(d) %} {{ "lbound%s"  |format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
      end subroutine {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}
   endinterface

   interface
{% set t='complex' %}
{%- for p in precision %}
{%- for d in range(1,dimensions+1) %}
      module subroutine {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d}}d(array_inout, async_id, &
                                     {% for dd in range(d) %}
                                     {{ "range%s"|format(dd+1) }}, {{ "lbound%s"|format(dd+1) }}{% if not loop.last %}, &
                                     {%- endif %}{% endfor %} )
         implicit none
         {{t}}({{p.val}}), intent(inout) :: array_inout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         integer(kind=dxl_async_kind), optional, intent(in) :: async_id
         integer, optional, intent(in) :: {% for dd in range(d) %} {{ "range%s(2)"|format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
         integer, optional, intent(in) :: {% for dd in range(d) %} {{ "lbound%s"  |format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
      end subroutine {{p.name}}_devxlib_conjg_h_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}
   endinterface

   interface
{% set t='complex' %}
{%- for p in precision %}
{%- for d in range(1,dimensions+1) %}
      module subroutine {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d_p(ptr_inout, async_id, &
                                        {% for dd in range(d) %}
                                        {{ "range%s"|format(dd+1) }}, {{ "lbound%s"|format(dd+1) }}{% if not loop.last %}, &
                                        {%- endif %}{% endfor %} )
         implicit none
         {{t}}({{p.val}}), pointer, contiguous, intent(inout) DEV_ATTR :: ptr_inout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         integer(kind=dxl_async_kind), optional, intent(in) :: async_id
         integer, optional, intent(in) :: {% for dd in range(d) %} {{ "range%s(2)"|format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
         integer, optional, intent(in) :: {% for dd in range(d) %} {{ "lbound%s"  |format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
      end subroutine {{p.name}}_devxlib_conjg_{{t[0]|lower}}{{d}}d_p
      !
{%- endfor %}
{%- endfor %}
   endinterface

   interface
{% set d=1 %}
{%- for p in precision %}
{%- for t in types %}
       module subroutine {{p.name}}_devxlib_vec_upd_remap_{{t[0]|lower}}{{d}}d(ndim, vout, v1, map1, scal)
          implicit none
          integer,      intent(in)    :: ndim
          {{t}}({{p.val}}) DEV_ATTR, intent(inout) :: vout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
          {{t}}({{p.val}}) DEV_ATTR, intent(in)    :: v1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
          integer DEV_ATTR,      intent(in)    :: map1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
          {{t}}({{p.val}}), optional, intent(in)   :: scal
       end subroutine {{p.name}}_devxlib_vec_upd_remap_{{t[0]|lower}}{{d}}d
       !
{%- endfor %}
{%- endfor %}
   end interface

   interface
{% set d=1 %}
{%- for p in precision %}
{%- for t in types %}
      module subroutine {{p.name}}_devxlib_vec_upd_v_remap_v_{{t[0]|lower}}{{d}}d(ndim, vout, v1, map1, v2, scal)
         implicit none
         integer,      intent(in)    :: ndim
         {{t}}({{p.val}}) DEV_ATTR, intent(inout) :: vout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         {{t}}({{p.val}}) DEV_ATTR, intent(in)    :: v1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         integer DEV_ATTR,      intent(in)    :: map1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         {{t}}({{p.val}}) DEV_ATTR, intent(in)    :: v2({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         {{t}}({{p.val}}), optional, intent(in)   :: scal
      end subroutine {{p.name}}_devxlib_vec_upd_v_remap_v_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}

{% set d=1 %}
{% set t= "complex" %}
{%- for p in precision %}
      module subroutine {{p.name}}_devxlib_vec_upd_v_remap_v_x_{{t[0]|lower}}{{d}}d(ndim, vout, v1,op1, map1, v2,op2, scal)
         implicit none
         integer,      intent(in)    :: ndim
         {{t}}({{p.val}}), intent(inout) :: vout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         {{t}}({{p.val}}), intent(in)    :: v1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         integer,      intent(in)    :: map1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         {{t}}({{p.val}}), intent(in)    :: v2({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         character(1), intent(in)    :: op1, op2
         {{t}}({{p.val}}), optional, intent(in)    :: scal
#if defined(__DXL_CUDAF)
         attributes(device) :: vout, v1, v2, map1
#endif
      end subroutine {{p.name}}_devxlib_vec_upd_v_remap_v_x_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
   end interface

   interface
{% set d=2 %}
{%- for p in precision %}
{%- for t in types %}
      module subroutine {{p.name}}_devxlib_mat_upd_dMd_{{t[0]|lower}}{{d}}d(ndim1, ndim2, mat, v1,op1, v2,op2, scal)
         !   
         ! performs: mat(i,j) = scal * op1(v1(i)) * mat(i,j) * op2(v2(j))
         ! op = 'N', 'R', 'C',       'RC'
         !       x   1/x  conjg(x)   conjg(1/x)
         implicit none
         integer,      intent(in)    :: ndim1,ndim2
         {{t}}({{p.val}}), intent(inout) DEV_ATTR :: mat(:,:)
         {{t}}({{p.val}}), intent(in)    DEV_ATTR :: v1(:)
         {{t}}({{p.val}}), intent(in)    DEV_ATTR :: v2(:)
         character(1), intent(in)    :: op1, op2 
         {{t}}({{p.val}}), optional, intent(in)  :: scal
      end subroutine {{p.name}}_devxlib_mat_upd_dMd_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}
   end interface

   interface
{%- for t in types %}
{%- for p in precision %}
{%- for d in range(1,dimensions+1) %}
      module subroutine {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d}}d(array_out, array_in, scal, &
                                                  {% for dd in range(d) -%}
                                                  {{ "range%s"|format(dd+1) }}, {{ "lbound%s"|format(dd+1) }}{% if not loop.last %}, &
                                                  {% endif %}{% endfor %} )
          implicit none
          {{t}}({{p.val}}), intent(inout) :: array_out({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
          {{t}}({{p.val}}), intent(in)    :: array_in({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
          {{t}}({{p.val}}), optional, intent(in) :: scal
          integer, optional, intent(in) :: {% for dd in range(d) %} {{ "range%s(2)"|format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
          integer, optional, intent(in) :: {% for dd in range(d) %} {{ "lbound%s"|format(dd+1) }}{% if not loop.last %}, {%- endif %}{% endfor %}
#if defined(__DXL_CUDAF)
          attributes(device) :: array_out, array_in
#endif
      end subroutine {{p.name}}_devxlib_mem_addscal_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}
{%- endfor %}
   end interface

endmodule devxlib_auxfunc