File: devxlib_auxfunc_vec_upd.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 (172 lines) | stat: -rw-r--r-- 6,577 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
!
! 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 device_auxfunc_vec_upd.jf90
!==================================================================
!==================================================================
!
#include<devxlib_macros.h>
#include<devxlib_defs.h>
!
!=======================================
!
submodule (devxlib_auxfunc) devxlib_auxfunc_vec_upd

   implicit none

   contains
{% 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
         integer :: i
         !   
         if (present(scal)) then
            !DEV_CUF kernel do(1)
            !DEV_ACC data present(vout,v1,map1)
            !DEV_ACC parallel loop async
            !DEV_OMPGPU target map(present,alloc:vout,v1,map1) nowait
            !DEV_OMPGPU teams loop
            do i = 1, ndim
               vout(i) = v1(map1(i))*scal
            enddo
            !DEV_ACC end data
            !DEV_OMPGPU end target
         else
            !DEV_CUF kernel do(1)
            !DEV_ACC data present(vout,v1,map1)
            !DEV_ACC parallel loop async
            !DEV_OMPGPU target map(present,alloc:vout,v1,map1) nowait
            !DEV_OMPGPU teams loop
            do i = 1, ndim
               vout(i) = v1(map1(i))
            enddo
            !DEV_ACC end data
            !DEV_OMPGPU end target
         endif
      end subroutine {{p.name}}_devxlib_vec_upd_remap_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}

{% 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}}), intent(inout) DEV_ATTR :: vout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         {{t}}({{p.val}}), intent(in)    DEV_ATTR :: v1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         integer,      intent(in)    DEV_ATTR :: map1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         {{t}}({{p.val}}), intent(in)    DEV_ATTR :: v2({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         {{t}}({{p.val}}), optional, intent(in)   :: scal
         integer :: i
         !   
         if (present(scal)) then
            !DEV_CUF kernel do(1)
            do i = 1, ndim
               vout(i) = v1(map1(i))*v2(i)*scal
            enddo
         else
            !DEV_CUF kernel do(1)
            do i = 1, ndim
               vout(i) = v1(map1(i))*v2(i)
            enddo
         endif
      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) DEV_ATTR :: vout({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         {{t}}({{p.val}}), intent(in)    DEV_ATTR :: v1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         integer,      intent(in)    DEV_ATTR :: map1({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %}) 
         {{t}}({{p.val}}), intent(in)    DEV_ATTR :: 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
         integer :: i
         !
         if (op1=="N".and.op2=="N") then
            if (present(scal)) then
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = v1(map1(i))*v2(i)*scal
               enddo
            else
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = v1(map1(i))*v2(i)
               enddo
            endif
         elseif (op1=="C".and.op2=="N") then
            if (present(scal)) then
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = conjg(v1(map1(i)))*v2(i)*scal
               enddo
            else
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = conjg(v1(map1(i)))*v2(i)
               enddo
            endif
         elseif (op1=="N".and.op2=="C") then
            if (present(scal)) then
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = v1(map1(i))*conjg(v2(i))*scal
               enddo
            else
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = v1(map1(i))*conjg(v2(i))
               enddo
            endif
         elseif (op1=="N".and.op2=="C") then
            if (present(scal)) then
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = conjg(v1(map1(i)))*conjg(v2(i))*scal
               enddo
            else
               !DEV_CUF kernel do(1)
               do i = 1, ndim
                  vout(i) = conjg(v1(map1(i)))*conjg(v2(i))
               enddo
            endif
         else
            call devxlib_error("{{p.name}}_devxlib_vec_upd_v_remap_v_x_{{t[0]|lower}}{{d}}d","invalid op1/op2",10)
         endif
         !
      end subroutine {{p.name}}_devxlib_vec_upd_v_remap_v_x_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}

end submodule devxlib_auxfunc_vec_upd