-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmagma.F90
194 lines (164 loc) · 6.12 KB
/
magma.F90
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
!
! -- MAGMA (version 2.1.0) --
! Univ. of Tennessee, Knoxville
! Univ. of California, Berkeley
! Univ. of Colorado, Denver
! @date August 2016
!
module magma
use magma_param
use magma_zfortran
use magma_dfortran
use magma_cfortran
use magma_sfortran
!---- Fortran interfaces to MAGMA subroutines ----
interface
subroutine magmaf_init( )
end subroutine
subroutine magmaf_finalize( )
end subroutine
subroutine magmaf_wtime( time )
double precision :: time
end subroutine
end interface
! parameter constants from magma_types.h
! currently MAGMA's Fortran interface uses characters, not integers
character, parameter :: &
MagmaFalse = 'n', &
MagmaTrue = 'y', &
MagmaRowMajor = 'r', &
MagmaColMajor = 'c', &
MagmaNoTrans = 'n', &
MagmaTrans = 't', &
MagmaConjTrans = 'c', &
MagmaUpper = 'u', &
MagmaLower = 'l', &
MagmaFull = 'f', &
MagmaNonUnit = 'n', &
MagmaUnit = 'u', &
MagmaLeft = 'l', &
MagmaRight = 'r', &
MagmaBothSides = 'b', &
MagmaOneNorm = '1', &
MagmaTwoNorm = '2', &
MagmaFrobeniusNorm = 'f', &
MagmaInfNorm = 'i', &
MagmaMaxNorm = 'm', &
MagmaDistUniform = 'u', &
MagmaDistSymmetric = 's', &
MagmaDistNormal = 'n', &
MagmaHermGeev = 'h', &
MagmaHermPoev = 'p', &
MagmaNonsymPosv = 'n', &
MagmaSymPosv = 's', &
MagmaNoPacking = 'n', &
MagmaPackSubdiag = 'u', &
MagmaPackSupdiag = 'l', &
MagmaPackColumn = 'c', &
MagmaPackRow = 'r', &
MagmaPackLowerBand = 'b', &
MagmaPackUpeprBand = 'q', &
MagmaPackAll = 'z', &
MagmaNoVec = 'n', &
MagmaVec = 'v', &
MagmaIVec = 'i', &
MagmaAllVec = 'a', &
MagmaSomeVec = 's', &
MagmaOverwriteVec = 'o', &
MagmaBacktransVec = 'b', &
MagmaRangeAll = 'a', &
MagmaRangeV = 'v', &
MagmaRangeI = 'i', &
MagmaQ = 'q', &
MagmaP = 'p', &
MagmaForward = 'f', &
MagmaBackward = 'b', &
MagmaColumnwise = 'c', &
MagmaRowwise = 'r'
contains
! --------------------
!> Sets ptrNew = ptrOld( i ), with stride inc.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_soff1d( ptrNew, ptrOld, inc, i )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: inc, i
ptrNew = ptrOld + (i-1) * inc * sizeof_real
end subroutine magmaf_soff1d
!> Sets ptrNew = ptrOld( i, j ), with leading dimension lda.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_soff2d( ptrNew, ptrOld, lda, i, j )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: lda, i, j
ptrNew = ptrOld + ((j-1) * lda + (i-1)) * sizeof_real
end subroutine magmaf_soff2d
! --------------------
!> Sets ptrNew = ptrOld( i ), with stride inc.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_doff1d( ptrNew, ptrOld, inc, i )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: inc, i
ptrNew = ptrOld + (i-1) * inc * sizeof_double
end subroutine magmaf_doff1d
!> Sets ptrNew = ptrOld( i, j ), with leading dimension lda.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_doff2d( ptrNew, ptrOld, lda, i, j )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: lda, i, j
ptrNew = ptrOld + ((j-1) * lda + (i-1)) * sizeof_double
end subroutine magmaf_doff2d
! --------------------
!> Sets ptrNew = ptrOld( i ), with stride inc.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_coff1d( ptrNew, ptrOld, inc, i )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: inc, i
ptrNew = ptrOld + (i-1) * inc * sizeof_complex
end subroutine magmaf_coff1d
!> Sets ptrNew = ptrOld( i, j ), with leading dimension lda.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_coff2d( ptrNew, ptrOld, lda, i, j )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: lda, i, j
ptrNew = ptrOld + ((j-1) * lda + (i-1)) * sizeof_complex
end subroutine magmaf_coff2d
! --------------------
!> Sets ptrNew = ptrOld( i ), with stride inc.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_zoff1d( ptrNew, ptrOld, inc, i )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: inc, i
ptrNew = ptrOld + (i-1) * inc * sizeof_complex_16
end subroutine magmaf_zoff1d
!> Sets ptrNew = ptrOld( i, j ), with leading dimension lda.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_zoff2d( ptrNew, ptrOld, lda, i, j )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: lda, i, j
ptrNew = ptrOld + ((j-1) * lda + (i-1)) * sizeof_complex_16
end subroutine magmaf_zoff2d
! --------------------
!> Sets ptrNew = ptrOld( i ), with stride inc.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_ioff1d( ptrNew, ptrOld, inc, i )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: inc, i
ptrNew = ptrOld + (i-1) * inc * sizeof_integer
end subroutine magmaf_ioff1d
!> Sets ptrNew = ptrOld( i, j ), with leading dimension lda.
!! Useful because CUDA pointers are opaque types in Fortran.
subroutine magmaf_ioff2d( ptrNew, ptrOld, lda, i, j )
magma_devptr_t :: ptrNew
magma_devptr_t :: ptrOld
integer :: lda, i, j
ptrNew = ptrOld + ((j-1) * lda + (i-1)) * sizeof_integer
end subroutine magmaf_ioff2d
end module magma