MAGMA
1.2.0
MatrixAlgebraonGPUandMulticoreArchitectures
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
zgessm_gpu.cpp
Go to the documentation of this file.
1
/*
2
-- MAGMA (version 1.2.0) --
3
Univ. of Tennessee, Knoxville
4
Univ. of California, Berkeley
5
Univ. of Colorado, Denver
6
May 2012
7
8
@author Hatem Ltaief
9
@author Mathieu Faverge
10
11
@precisions normal z -> c d s
12
13
*/
14
#include "common_magma.h"
15
16
#define magma_zgemm magmablas_zgemm
17
//#define magma_ztrsm magmablas_ztrsm
18
//#define magma_ztrmm magmablas_ztrmm
19
20
extern
"C"
magma_int_t
21
magma_zgessm_gpu
(
char
storev,
magma_int_t
m,
magma_int_t
n,
magma_int_t
k,
magma_int_t
ib,
22
magma_int_t
*ipiv,
23
cuDoubleComplex *dL1,
magma_int_t
lddl1,
24
cuDoubleComplex *dL,
magma_int_t
lddl,
25
cuDoubleComplex *
dA
,
magma_int_t
ldda,
26
magma_int_t
*info)
27
{
28
/* -- MAGMA (version 1.2.0) --
29
Univ. of Tennessee, Knoxville
30
Univ. of California, Berkeley
31
Univ. of Colorado, Denver
32
May 2012
33
34
Purpose
35
=======
36
37
SGETRF computes an LU factorization of a general M-by-N matrix A
38
using partial pivoting with row interchanges.
39
40
The factorization has the form
41
A = P * L * U
42
where P is a permutation matrix, L is lower triangular with unit
43
diagonal elements (lower trapezoidal if m > n), and U is upper
44
triangular (upper trapezoidal if m < n).
45
46
This is the right-looking Level 3 BLAS version of the algorithm.
47
48
Arguments
49
=========
50
51
M (input) INTEGER
52
The number of rows of the matrix A. M >= 0.
53
54
N (input) INTEGER
55
The number of columns of the matrix A. N >= 0.
56
57
A (input/output) REAL array on the GPU, dimension (LDA,N).
58
On entry, the M-by-N matrix to be factored.
59
On exit, the factors L and U from the factorization
60
A = P*L*U; the unit diagonal elements of L are not stored.
61
62
LDA (input) INTEGER
63
The leading dimension of the array A. LDA >= max(1,M).
64
65
IPIV (output) INTEGER array, dimension (min(M,N))
66
The pivot indices; for 1 <= i <= min(M,N), row i of the
67
matrix was interchanged with row IPIV(i).
68
69
INFO (output) INTEGER
70
= 0: successful exit
71
< 0: if INFO = -i, the i-th argument had an illegal value
72
or another error occured, such as memory allocation failed.
73
> 0: if INFO = i, U(i,i) is exactly zero. The factorization
74
has been completed, but the factor U is exactly
75
singular, and division by zero will occur if it is used
76
to solve a system of equations.
77
78
===================================================================== */
79
80
#define AT(i,j) (dAT + (i)*ldda + (j) )
81
#define L(i,j) (dL + (i) + (j)*lddl )
82
#define dL1(j) (dL1 + (j)*lddl1)
83
84
cuDoubleComplex c_one =
MAGMA_Z_ONE
;
85
cuDoubleComplex c_neg_one =
MAGMA_Z_NEG_ONE
;
86
87
int
i, s, sb;
88
cuDoubleComplex *dAT;
89
90
/* Check arguments */
91
*info = 0;
92
if
(m < 0)
93
*info = -1;
94
else
if
(n < 0)
95
*info = -2;
96
else
if
(ldda <
max
(1,m))
97
*info = -4;
98
99
if
(*info != 0) {
100
magma_xerbla
(
__func__
, -(*info) );
101
return
*info;
102
}
103
104
/* Quick return if possible */
105
if
(m == 0 || n == 0)
106
return
*info;
107
108
if
( (storev ==
'C'
) || (storev ==
'c'
) ) {
109
magmablas_zgetmo_in
( dA, dAT, ldda, m, n );
110
}
else
{
111
dAT =
dA
;
112
}
113
114
s = k / ib;
115
for
(i = 0; i < k; i += ib) {
116
sb =
min
(ib, k-i);
117
118
magmablas_zlaswp
( n, dAT, ldda, i+1, i+sb, ipiv, 1 );
119
120
#ifndef WITHOUTTRTRI
121
magma_ztrmm
(
MagmaRight
,
MagmaLower
,
MagmaTrans
,
MagmaUnit
,
122
n, sb,
123
c_one, dL1(i), lddl1,
124
AT
(i, 0), ldda);
125
#else
126
magma_ztrsm
(
MagmaRight
,
MagmaLower
,
MagmaTrans
,
MagmaUnit
,
127
n, sb,
128
c_one,
L
( i, i), lddl,
129
AT
(i, 0), ldda);
130
#endif
131
132
if
( (i+sb) < m) {
133
magma_zgemm
(
MagmaNoTrans
,
MagmaTrans
,
134
n, m-(i+sb), sb,
135
c_neg_one,
AT
(i, 0), ldda,
136
L
( i+sb, i), lddl,
137
c_one,
AT
(i+sb, 0), ldda );
138
}
139
}
140
141
if
( (storev ==
'C'
) || (storev ==
'c'
) ) {
142
magmablas_zgetmo_in
( dA, dAT, ldda, m, n );
143
}
144
145
return
*info;
146
/* End of MAGMA_ZGETRF_GPU */
147
}
magma-1.2.0
src
zgessm_gpu.cpp
Generated on Mon May 21 2012 16:42:25 for MAGMA by
1.8.1