MAGMA  1.2.0
MatrixAlgebraonGPUandMulticoreArchitectures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
dgesv_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  @generated d Thu May 10 22:26:48 2012
9 
10 */
11 #include "common_magma.h"
12 
13 // === Define what BLAS to use ============================================
14 #define PRECISION_d
15 #if (defined(PRECISION_s) || defined(PRECISION_d))
16  #define magma_dtrsm magmablas_dtrsm
17 #endif
18 // === End defining what BLAS to use =======================================
19 
20 extern "C" magma_int_t
22  double *dA, magma_int_t ldda,
23  magma_int_t *ipiv,
24  double *dB, magma_int_t lddb,
25  magma_int_t *info)
26 {
27 /* -- MAGMA (version 1.2.0) --
28  Univ. of Tennessee, Knoxville
29  Univ. of California, Berkeley
30  Univ. of Colorado, Denver
31  May 2012
32 
33  Purpose
34  =======
35 
36  Solves a system of linear equations
37  A * X = B
38  where A is a general N-by-N matrix and X and B are N-by-NRHS matrices.
39  The LU decomposition with partial pivoting and row interchanges is
40  used to factor A as
41  A = P * L * U,
42  where P is a permutation matrix, L is unit lower triangular, and U is
43  upper triangular. The factored form of A is then used to solve the
44  system of equations A * X = B.
45 
46  Arguments
47  =========
48 
49  N (input) INTEGER
50  The order of the matrix A. N >= 0.
51 
52  NRHS (input) INTEGER
53  The number of right hand sides, i.e., the number of columns
54  of the matrix B. NRHS >= 0.
55 
56  A (input/output) DOUBLE_PRECISION array on the GPU, dimension (LDDA,N).
57  On entry, the M-by-N matrix to be factored.
58  On exit, the factors L and U from the factorization
59  A = P*L*U; the unit diagonal elements of L are not stored.
60 
61  LDA (input) INTEGER
62  The leading dimension of the array A. LDA >= max(1,N).
63 
64  IPIV (output) INTEGER array, dimension (min(M,N))
65  The pivot indices; for 1 <= i <= min(M,N), row i of the
66  matrix was interchanged with row IPIV(i).
67 
68  B (input/output) DOUBLE_PRECISION array on the GPU, dimension (LDB,NRHS)
69  On entry, the right hand side matrix B.
70  On exit, the solution matrix X.
71 
72  LDB (input) INTEGER
73  The leading dimension of the array B. LDB >= max(1,N).
74 
75  INFO (output) INTEGER
76  = 0: successful exit
77  < 0: if INFO = -i, the i-th argument had an illegal value
78  ===================================================================== */
79 
80  *info = 0;
81  if (n < 0) {
82  *info = -1;
83  } else if (nrhs < 0) {
84  *info = -2;
85  } else if (ldda < max(1,n)) {
86  *info = -4;
87  } else if (lddb < max(1,n)) {
88  *info = -7;
89  }
90  if (*info != 0) {
91  magma_xerbla( __func__, -(*info) );
92  return *info;
93  }
94 
95  /* Quick return if possible */
96  if (n == 0 || nrhs == 0) {
97  return *info;
98  }
99 
100  magma_dgetrf_gpu( n, n, dA, ldda, ipiv, info );
101  if ( *info == 0 ) {
102  magma_dgetrs_gpu( MagmaNoTrans, n, nrhs, dA, ldda, ipiv, dB, lddb, info );
103  }
104 
105  return *info;
106 }