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
zposv.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
82 int PLASMA_zposv(PLASMA_enum uplo, int N, int NRHS,
83  PLASMA_Complex64_t *A, int LDA,
84  PLASMA_Complex64_t *B, int LDB)
85 {
86  int NB;
87  int status;
89  PLASMA_sequence *sequence = NULL;
91  PLASMA_desc descA, descB;
92 
93  plasma = plasma_context_self();
94  if (plasma == NULL) {
95  plasma_fatal_error("PLASMA_zposv", "PLASMA not initialized");
97  }
98  /* Check input arguments */
99  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
100  plasma_error("PLASMA_zposv", "illegal value of uplo");
101  return -1;
102  }
103  if (N < 0) {
104  plasma_error("PLASMA_zposv", "illegal value of N");
105  return -2;
106  }
107  if (NRHS < 0) {
108  plasma_error("PLASMA_zposv", "illegal value of NRHS");
109  return -3;
110  }
111  if (LDA < max(1, N)) {
112  plasma_error("PLASMA_zposv", "illegal value of LDA");
113  return -5;
114  }
115  if (LDB < max(1, N)) {
116  plasma_error("PLASMA_zposv", "illegal value of LDB");
117  return -7;
118  }
119  /* Quick return - currently NOT equivalent to LAPACK's
120  * LAPACK does not have such check for DPOSV */
121  if (min(N, NRHS) == 0)
122  return PLASMA_SUCCESS;
123 
124  /* Tune NB depending on M, N & NRHS; Set NBNBSIZE */
125  status = plasma_tune(PLASMA_FUNC_ZPOSV, N, N, NRHS);
126  if (status != PLASMA_SUCCESS) {
127  plasma_error("PLASMA_zposv", "plasma_tune() failed");
128  return status;
129  }
130 
131  /* Set NT & NTRHS */
132  NB = PLASMA_NB;
133 
134  plasma_sequence_create(plasma, &sequence);
135 
137  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N , plasma_desc_mat_free(&(descA)) );
138  plasma_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, plasma_desc_mat_free(&(descA)); plasma_desc_mat_free(&(descB)));
139  } else {
140  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N );
141  plasma_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS);
142  }
143 
144  /* Call the tile interface */
145  PLASMA_zposv_Tile_Async(uplo, &descA, &descB, sequence, &request);
146 
148  plasma_zooptile2lap( descA, A, NB, NB, LDA, N );
149  plasma_zooptile2lap( descB, B, NB, NB, LDB, NRHS );
151  plasma_desc_mat_free(&descA);
152  plasma_desc_mat_free(&descB);
153  } else {
154  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
155  plasma_ziptile2lap( descB, B, NB, NB, LDB, NRHS );
157  }
158 
159  status = sequence->status;
160  plasma_sequence_destroy(plasma, sequence);
161  return status;
162 }
163 /***************************************************************************/
213 {
215  PLASMA_sequence *sequence = NULL;
217  int status;
218 
219  plasma = plasma_context_self();
220  if (plasma == NULL) {
221  plasma_fatal_error("PLASMA_zposv_Tile", "PLASMA not initialized");
223  }
224  plasma_sequence_create(plasma, &sequence);
225  PLASMA_zposv_Tile_Async(uplo, A, B, sequence, &request);
227  status = sequence->status;
228  plasma_sequence_destroy(plasma, sequence);
229  return status;
230 }
231 
232 /***************************************************************************/
261  PLASMA_sequence *sequence, PLASMA_request *request)
262 {
263  PLASMA_desc descA = *A;
264  PLASMA_desc descB = *B;
266 
267  plasma = plasma_context_self();
268  if (plasma == NULL) {
269  plasma_fatal_error("PLASMA_zposv_Tile", "PLASMA not initialized");
271  }
272  if (sequence == NULL) {
273  plasma_fatal_error("PLASMA_zposv_Tile", "NULL sequence");
274  return PLASMA_ERR_UNALLOCATED;
275  }
276  if (request == NULL) {
277  plasma_fatal_error("PLASMA_zposv_Tile", "NULL request");
278  return PLASMA_ERR_UNALLOCATED;
279  }
280  /* Check sequence status */
281  if (sequence->status == PLASMA_SUCCESS)
282  request->status = PLASMA_SUCCESS;
283  else
284  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
285 
286  /* Check descriptors for correctness */
287  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
288  plasma_error("PLASMA_zposv_Tile", "invalid first descriptor");
289  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
290  }
291  if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
292  plasma_error("PLASMA_zposv_Tile", "invalid second descriptor");
293  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
294  }
295  /* Check input arguments */
296  if (descA.nb != descA.mb || descB.nb != descB.mb) {
297  plasma_error("PLASMA_zposv_Tile", "only square tiles supported");
298  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
299  }
300  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
301  plasma_error("PLASMA_zposv_Tile", "illegal value of uplo");
302  return plasma_request_fail(sequence, request, -1);
303  }
304  /* Quick return - currently NOT equivalent to LAPACK's
305  * LAPACK does not have such check for DPOSV */
306 /*
307  if (min(N, NRHS) == 0)
308  return PLASMA_SUCCESS;
309 */
311  PLASMA_enum, uplo,
312  PLASMA_desc, descA,
313  PLASMA_sequence*, sequence,
314  PLASMA_request*, request);
315 
318  PLASMA_enum, uplo,
321  PLASMA_Complex64_t, 1.0,
322  PLASMA_desc, descA,
323  PLASMA_desc, descB,
324  PLASMA_sequence*, sequence,
325  PLASMA_request*, request);
326 
329  PLASMA_enum, uplo,
330  PLASMA_enum, uplo == PlasmaUpper ? PlasmaNoTrans : PlasmaConjTrans,
332  PLASMA_Complex64_t, 1.0,
333  PLASMA_desc, descA,
334  PLASMA_desc, descB,
335  PLASMA_sequence*, sequence,
336  PLASMA_request*, request);
337 
338  return PLASMA_SUCCESS;
339 }