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
zgesv_incpiv.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
73 int PLASMA_zgesv_incpiv(int N, int NRHS,
74  PLASMA_Complex64_t *A, int LDA,
75  PLASMA_Complex64_t *L, int *IPIV,
76  PLASMA_Complex64_t *B, int LDB)
77 {
78  int NB, IB, IBNB, NT;
79  int status;
81  PLASMA_sequence *sequence = NULL;
83  PLASMA_desc descA, descB, descL;
84 
85  plasma = plasma_context_self();
86  if (plasma == NULL) {
87  plasma_error("PLASMA_zgesv_incpiv", "PLASMA not initialized");
89  }
90  /* Check input arguments */
91  if (N < 0) {
92  plasma_error("PLASMA_zgesv_incpiv", "illegal value of N");
93  return -1;
94  }
95  if (NRHS < 0) {
96  plasma_error("PLASMA_zgesv_incpiv", "illegal value of NRHS");
97  return -2;
98  }
99  if (LDA < max(1, N)) {
100  plasma_error("PLASMA_zgesv_incpiv", "illegal value of LDA");
101  return -4;
102  }
103  if (LDB < max(1, N)) {
104  plasma_error("PLASMA_zgesv_incpiv", "illegal value of LDB");
105  return -8;
106  }
107  /* Quick return */
108  if (min(N, NRHS) == 0)
109  return PLASMA_SUCCESS;
110 
111  /* Tune NB & IB depending on M, N & NRHS; Set NBNB */
112  status = plasma_tune(PLASMA_FUNC_ZGESV, N, N, NRHS);
113  if (status != PLASMA_SUCCESS) {
114  plasma_error("PLASMA_zgesv_incpiv", "plasma_tune() failed");
115  return status;
116  }
117 
118  /* Set NT & NTRHS */
119  NB = PLASMA_NB;
120  IB = PLASMA_IB;
121  IBNB = IB*NB;
122  NT = (N%NB==0) ? (N/NB) : (N/NB+1);
123 
124  plasma_sequence_create(plasma, &sequence);
125 
126  descL = plasma_desc_init(
128  IB, NB, IBNB,
129  NT*IB, NT*NB, 0, 0, NT*IB, NT*NB);
130  descL.mat = L;
131 
133  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N , plasma_desc_mat_free(&(descA)) );
134  plasma_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, plasma_desc_mat_free(&(descA)); plasma_desc_mat_free(&(descB)));
135  } else {
136  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N );
137  plasma_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS);
138  }
139 
140  /* Call the tile interface */
141  PLASMA_zgesv_incpiv_Tile_Async(&descA, &descL, IPIV, &descB, sequence, &request);
142 
144  plasma_zooptile2lap( descA, A, NB, NB, LDA, N );
145  plasma_zooptile2lap( descB, B, NB, NB, LDB, NRHS );
147  plasma_desc_mat_free(&descA);
148  plasma_desc_mat_free(&descB);
149  } else {
150  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
151  plasma_ziptile2lap( descB, B, NB, NB, LDB, NRHS );
153  }
154 
155  status = sequence->status;
156  plasma_sequence_destroy(plasma, sequence);
157  return status;
158 }
159 /***************************************************************************/
204 {
206  PLASMA_sequence *sequence = NULL;
208  int status;
209 
210  plasma = plasma_context_self();
211  if (plasma == NULL) {
212  plasma_fatal_error("PLASMA_zgesv_incpiv_Tile", "PLASMA not initialized");
214  }
215  plasma_sequence_create(plasma, &sequence);
216  PLASMA_zgesv_incpiv_Tile_Async(A, L, IPIV, B, sequence, &request);
218  status = sequence->status;
219  plasma_sequence_destroy(plasma, sequence);
220  return status;
221 }
222 
223 /***************************************************************************/
253  PLASMA_sequence *sequence, PLASMA_request *request)
254 {
255  PLASMA_desc descA = *A;
256  PLASMA_desc descL = *L;
257  PLASMA_desc descB = *B;
259 
260  plasma = plasma_context_self();
261  if (plasma == NULL) {
262  plasma_fatal_error("PLASMA_zgesv_incpiv_Tile", "PLASMA not initialized");
264  }
265  if (sequence == NULL) {
266  plasma_fatal_error("PLASMA_zgesv_incpiv_Tile", "NULL sequence");
267  return PLASMA_ERR_UNALLOCATED;
268  }
269  if (request == NULL) {
270  plasma_fatal_error("PLASMA_zgesv_incpiv_Tile", "NULL request");
271  return PLASMA_ERR_UNALLOCATED;
272  }
273  /* Check sequence status */
274  if (sequence->status == PLASMA_SUCCESS)
275  request->status = PLASMA_SUCCESS;
276  else
277  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
278 
279  /* Check descriptors for correctness */
280  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
281  plasma_error("PLASMA_zgesv_incpiv_Tile", "invalid first descriptor");
282  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
283  }
284  if (plasma_desc_check(&descL) != PLASMA_SUCCESS) {
285  plasma_error("PLASMA_zgesv_incpiv_Tile", "invalid second descriptor");
286  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
287  }
288  if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
289  plasma_error("PLASMA_zgesv_incpiv_Tile", "invalid third descriptor");
290  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
291  }
292  /* Check input arguments */
293  if (descA.nb != descA.mb || descB.nb != descB.mb) {
294  plasma_error("PLASMA_zgesv_incpiv_Tile", "only square tiles supported");
295  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
296  }
297  /* Quick return */
298 /*
299  if (min(N, NRHS) == 0)
300  return PLASMA_SUCCESS;
301 */
302 
304  PLASMA_desc, descA,
305  PLASMA_desc, descL,
306  int*, IPIV,
307  PLASMA_sequence*, sequence,
308  PLASMA_request*, request);
309 
311  PLASMA_desc, descA,
312  PLASMA_desc, descB,
313  PLASMA_desc, descL,
314  int*, IPIV,
315  PLASMA_sequence*, sequence,
316  PLASMA_request*, request);
317 
324  PLASMA_desc, descA,
325  PLASMA_desc, descB,
326  PLASMA_sequence*, sequence,
327  PLASMA_request*, request);
328 
329  return PLASMA_SUCCESS;
330 }