PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
zgetrf_incpiv.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
65 int PLASMA_zgetrf_incpiv(int M, int N,
66  PLASMA_Complex64_t *A, int LDA,
67  PLASMA_Complex64_t *L, int *IPIV)
68 {
69  int NB, IB, IBNB, MT, NT;
70  int status;
72  PLASMA_sequence *sequence = NULL;
74  PLASMA_desc descA, descL;
75 
76  plasma = plasma_context_self();
77  if (plasma == NULL) {
78  plasma_fatal_error("PLASMA_zgetrf_incpiv", "PLASMA not initialized");
80  }
81  /* Check input arguments */
82  if (M < 0) {
83  plasma_error("PLASMA_zgetrf_incpiv", "illegal value of M");
84  return -1;
85  }
86  if (N < 0) {
87  plasma_error("PLASMA_zgetrf_incpiv", "illegal value of N");
88  return -2;
89  }
90  if (LDA < max(1, M)) {
91  plasma_error("PLASMA_zgetrf_incpiv", "illegal value of LDA");
92  return -4;
93  }
94  /* Quick return */
95  if (min(M, N) == 0)
96  return PLASMA_SUCCESS;
97 
98  /* Tune NB & IB depending on M, N & NRHS; Set NBNBSIZE */
99  status = plasma_tune(PLASMA_FUNC_ZGESV, M, N, 0);
100  if (status != PLASMA_SUCCESS) {
101  plasma_error("PLASMA_zgetrf_incpiv", "plasma_tune() failed");
102  return status;
103  }
104 
105  /* Set NT & NTRHS */
106  NB = PLASMA_NB;
107  IB = PLASMA_IB;
108  IBNB = IB*NB;
109  MT = (M%NB==0) ? (M/NB) : (M/NB+1);
110  NT = (N%NB==0) ? (N/NB) : (N/NB+1);
111 
112  plasma_sequence_create(plasma, &sequence);
113 
114  descL = plasma_desc_init(
116  IB, NB, IBNB,
117  MT*IB, NT*NB, 0, 0, MT*IB, NT*NB);
118  descL.mat = L;
119 
121  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, plasma_desc_mat_free(&(descA)) );
122  } else {
123  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N);
124  }
125 
126  /* Call the tile interface */
127  PLASMA_zgetrf_incpiv_Tile_Async(&descA, &descL, IPIV, sequence, &request);
128 
130  plasma_zooptile2lap( descA, A, NB, NB, LDA, N );
132  plasma_desc_mat_free(&descA);
133  } else {
134  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
136  }
137 
138  status = sequence->status;
139  plasma_sequence_destroy(plasma, sequence);
140  return status;
141 }
142 
143 /***************************************************************************/
185 {
187  PLASMA_sequence *sequence = NULL;
189  int status;
190 
191  plasma = plasma_context_self();
192  if (plasma == NULL) {
193  plasma_fatal_error("PLASMA_zgetrf_incpiv_Tile", "PLASMA not initialized");
195  }
196  plasma_sequence_create(plasma, &sequence);
197  PLASMA_zgetrf_incpiv_Tile_Async(A, L, IPIV, sequence, &request);
199  status = sequence->status;
200  plasma_sequence_destroy(plasma, sequence);
201  return status;
202 }
203 
204 /***************************************************************************/
233  PLASMA_sequence *sequence, PLASMA_request *request)
234 {
235  PLASMA_desc descA = *A;
236  PLASMA_desc descL = *L;
238 
239  plasma = plasma_context_self();
240  if (plasma == NULL) {
241  plasma_fatal_error("PLASMA_zgetrf_incpiv_Tile", "PLASMA not initialized");
243  }
244  if (sequence == NULL) {
245  plasma_fatal_error("PLASMA_zgetrf_incpiv_Tile", "NULL sequence");
246  return PLASMA_ERR_UNALLOCATED;
247  }
248  if (request == NULL) {
249  plasma_fatal_error("PLASMA_zgetrf_incpiv_Tile", "NULL request");
250  return PLASMA_ERR_UNALLOCATED;
251  }
252  /* Check sequence status */
253  if (sequence->status == PLASMA_SUCCESS)
254  request->status = PLASMA_SUCCESS;
255  else
256  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
257 
258  /* Check descriptors for correctness */
259  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
260  plasma_error("PLASMA_zgetrf_incpiv_Tile", "invalid first descriptor");
261  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
262  }
263  if (plasma_desc_check(&descL) != PLASMA_SUCCESS) {
264  plasma_error("PLASMA_zgetrf_incpiv_Tile", "invalid second descriptor");
265  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
266  }
267  /* Check input arguments */
268  if (descA.nb != descA.mb) {
269  plasma_error("PLASMA_zgetrf_incpiv_Tile", "only square tiles supported");
270  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
271  }
272  /* Quick return */
273 /*
274  if (min(M, N) == 0)
275  return PLASMA_SUCCESS;
276 */
277 
279  PLASMA_desc, descA,
280  PLASMA_desc, descL,
281  int*, IPIV,
282  PLASMA_sequence*, sequence,
283  PLASMA_request*, request);
284 
285  return PLASMA_SUCCESS;
286 }