File: devxlib_memset.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 (120 lines) | stat: -rw-r--r-- 5,364 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
!
! Copyright (C) 2021, MaX CoE
! Distributed under the MIT License 
! (license terms are at http://opensource.org/licenses/MIT).
!
!--
!
!
! Utility functions to perform data initializations (on host and
! on device), using CUDA-Fortran, OpenACC and OpenMP Offload
!
!==================================================================
!==================================================================
! *DO NOT EDIT*: automatically generated from devxlib_memset.jf90
!==================================================================
!==================================================================
!
#include<devxlib_macros.h>
#include<devxlib_defs.h>
!
!=======================================
!
! Note about dimensions:
! The lower bound of the assumed shape array passed to the subroutine is 1
! lbound and range instead refer to the indexing in the parent caller.
!
module devxlib_memset

   use iso_fortran_env,     only : int32, int64, real32, real64
#if defined __DXL_CUDAF
   use cudafor
#elif defined __DXL_OPENACC
   use openacc
   use devxlib_environment, only : cudaStreamSynchronize, cudaDeviceSynchronize, &
                                   acc_memcpy_device_f, acc_memcpy_from_device_f, acc_memcpy_to_device_f
#endif

   implicit none

   interface devxlib_memset_d
      module procedure &
{%- for t in types %}
{%- set outer_loop = loop %}
{%- for p in kinds[t] %}
{%- set medium_loop = loop %}
{%- for d in range(1,dimensions+1,3) %}
{%- if (d+1)<=dimensions %}
{%- if (d+2)<=dimensions %}
         {{p.name}}_devxlib_memset_d_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_memset_d_{{t[0]|lower}}{{d+1}}d, {{p.name}}_devxlib_memset_d_{{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_memset_d_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_memset_d_{{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_memset_d_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not medium_loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}
{%- endfor %}
   end interface devxlib_memset_d

   interface devxlib_memset_h
      module procedure &
{%- for t in types %}
{%- set outer_loop = loop %}
{%- for p in kinds[t] %}
{%- set medium_loop = loop %}
{%- for d in range(1,dimensions+1,3) %}
{%- if (d+1)<=dimensions %}
{%- if (d+2)<=dimensions %}
         {{p.name}}_devxlib_memset_h_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_memset_h_{{t[0]|lower}}{{d+1}}d, {{p.name}}_devxlib_memset_h_{{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_memset_h_{{t[0]|lower}}{{d}}d, {{p.name}}_devxlib_memset_h_{{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_memset_h_{{t[0]|lower}}{{d}}d{% if ((not loop.last) or (not medium_loop.last) or (not outer_loop.last))%}, &{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}
{%- endfor %}
   end interface devxlib_memset_h

   interface
{%- for t in types %}
{%- for p in kinds[t] %}
{%- for d in range(1,dimensions+1) %}
      module subroutine {{p.name}}_devxlib_memset_h_{{t[0]|lower}}{{d}}d(array_out, val, &{% 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)    :: val
          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_memset_h_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}
{%- endfor %}

{%- for t in types %}
{%- for p in kinds[t] %}
{%- for d in range(1,dimensions+1) %}
      module subroutine {{p.name}}_devxlib_memset_d_{{t[0]|lower}}{{d}}d(array_out, val, &{% 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_out({% for dd in range(d) %}:{% if not loop.last %}, {%- endif %}{% endfor %})
         {{t}}({{p.val}}), intent(in)    :: val
         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_memset_d_{{t[0]|lower}}{{d}}d
      !
{%- endfor %}
{%- endfor %}
{%- endfor %}
   endinterface

endmodule devxlib_memset