MAGMA  magma-1.4.0 Matrix Algebra on GPU and Multicore Architectures
dgesv_gpu.cpp
Go to the documentation of this file.
1 /*
2  -- MAGMA (version 1.4.0) --
3  Univ. of Tennessee, Knoxville
4  Univ. of California, Berkeley
6  August 2013
7
8  @generated d Tue Aug 13 16:44:10 2013
9
10 */
11 #include "common_magma.h"
12
13 extern "C" magma_int_t
15  double *dA, magma_int_t ldda,
16  magma_int_t *ipiv,
17  double *dB, magma_int_t lddb,
18  magma_int_t *info)
19 {
20 /* -- MAGMA (version 1.4.0) --
21  Univ. of Tennessee, Knoxville
22  Univ. of California, Berkeley
24  August 2013
25
26  Purpose
27  =======
28  Solves a system of linear equations
29  A * X = B
30  where A is a general N-by-N matrix and X and B are N-by-NRHS matrices.
31  The LU decomposition with partial pivoting and row interchanges is
32  used to factor A as
33  A = P * L * U,
34  where P is a permutation matrix, L is unit lower triangular, and U is
35  upper triangular. The factored form of A is then used to solve the
36  system of equations A * X = B.
37
38  Arguments
39  =========
40  N (input) INTEGER
41  The order of the matrix A. N >= 0.
42
43  NRHS (input) INTEGER
44  The number of right hand sides, i.e., the number of columns
45  of the matrix B. NRHS >= 0.
46
47  A (input/output) DOUBLE_PRECISION array on the GPU, dimension (LDDA,N).
48  On entry, the M-by-N matrix to be factored.
49  On exit, the factors L and U from the factorization
50  A = P*L*U; the unit diagonal elements of L are not stored.
51
52  LDA (input) INTEGER
53  The leading dimension of the array A. LDA >= max(1,N).
54
55  IPIV (output) INTEGER array, dimension (min(M,N))
56  The pivot indices; for 1 <= i <= min(M,N), row i of the
57  matrix was interchanged with row IPIV(i).
58
59  B (input/output) DOUBLE_PRECISION array on the GPU, dimension (LDB,NRHS)
60  On entry, the right hand side matrix B.
61  On exit, the solution matrix X.
62
63  LDB (input) INTEGER
64  The leading dimension of the array B. LDB >= max(1,N).
65
66  INFO (output) INTEGER
67  = 0: successful exit
68  < 0: if INFO = -i, the i-th argument had an illegal value
69  ===================================================================== */
70
71  *info = 0;
72  if (n < 0) {
73  *info = -1;
74  } else if (nrhs < 0) {
75  *info = -2;
76  } else if (ldda < max(1,n)) {
77  *info = -4;
78  } else if (lddb < max(1,n)) {
79  *info = -7;
80  }
81  if (*info != 0) {
82  magma_xerbla( __func__, -(*info) );
83  return *info;
84  }
85
86  /* Quick return if possible */
87  if (n == 0 || nrhs == 0) {
88  return *info;
89  }
90
91  magma_dgetrf_gpu( n, n, dA, ldda, ipiv, info );
92  if ( *info == 0 ) {
93  magma_dgetrs_gpu( MagmaNoTrans, n, nrhs, dA, ldda, ipiv, dB, lddb, info );
94  }
95
96  return *info;
97 }
#define __func__
Definition: common_magma.h:65
magma_int_t magma_dgetrf_gpu(magma_int_t m, magma_int_t n, double *dA, magma_int_t ldda, magma_int_t *ipiv, magma_int_t *info)
Definition: dgetrf_gpu.cpp:14
magma_int_t ldda
int magma_int_t
Definition: magmablas.h:12
#define dB(dev, i, j)
magma_int_t magma_dgesv_gpu(magma_int_t n, magma_int_t nrhs, double *dA, magma_int_t ldda, magma_int_t *ipiv, double *dB, magma_int_t lddb, magma_int_t *info)
Definition: dgesv_gpu.cpp:14
void magma_xerbla(const char *srname, magma_int_t info)
Definition: xerbla.cpp:8
magma_int_t magma_dgetrs_gpu(char trans, magma_int_t n, magma_int_t nrhs, double *dA, magma_int_t ldda, magma_int_t *ipiv, double *dB, magma_int_t lddb, magma_int_t *info)
Definition: dgetrs_gpu.cpp:14
#define MagmaNoTrans
Definition: magma.h:57
#define max(a, b)
Definition: common_magma.h:82
#define dA(dev, i, j)