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
ztrsm.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
90  int N, int NRHS, PLASMA_Complex64_t alpha,
91  PLASMA_Complex64_t *A, int LDA,
92  PLASMA_Complex64_t *B, int LDB)
93 {
94  int NB, NA;
95  int status;
97  PLASMA_sequence *sequence = NULL;
99  PLASMA_desc descA, descB;
100 
101  plasma = plasma_context_self();
102  if (plasma == NULL) {
103  plasma_fatal_error("PLASMA_ztrsm", "PLASMA not initialized");
105  }
106  /* Check input arguments */
107  if (side != PlasmaLeft && side != PlasmaRight) {
108  plasma_error("PLASMA_ztrsm", "illegal value of side");
109  return -1;
110  }
111  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
112  plasma_error("PLASMA_ztrsm", "illegal value of uplo");
113  return -2;
114  }
115  if (transA != PlasmaConjTrans && transA != PlasmaNoTrans && transA != PlasmaTrans ) {
116  plasma_error("PLASMA_ztrsm", "illegal value of transA");
117  return -3;
118  }
119  if (diag != PlasmaUnit && diag != PlasmaNonUnit) {
120  plasma_error("PLASMA_ztrsm", "illegal value of diag");
121  return -4;
122  }
123  if (N < 0) {
124  plasma_error("PLASMA_ztrsm", "illegal value of N");
125  return -5;
126  }
127  if (NRHS < 0) {
128  plasma_error("PLASMA_ztrsm", "illegal value of NRHS");
129  return -6;
130  }
131  if (LDA < max(1, N)) {
132  plasma_error("PLASMA_ztrsm", "illegal value of LDA");
133  return -8;
134  }
135  if (LDB < max(1, N)) {
136  plasma_error("PLASMA_ztrsm", "illegal value of LDB");
137  return -10;
138  }
139  /* Quick return */
140  if (min(N, NRHS) == 0)
141  return PLASMA_SUCCESS;
142 
143  /* Tune NB depending on M, N & NRHS; Set NBNB */
144  status = plasma_tune(PLASMA_FUNC_ZPOSV, N, N, NRHS);
145  if (status != PLASMA_SUCCESS) {
146  plasma_error("PLASMA_ztrsm", "plasma_tune() failed");
147  return status;
148  }
149 
150  /* Set NT & NTRHS */
151  NB = PLASMA_NB;
152  if (side == PlasmaLeft) {
153  NA = N;
154  } else {
155  NA = NRHS;
156  }
157 
158  plasma_sequence_create(plasma, &sequence);
159 
161  plasma_zooplap2tile( descA, A, NB, NB, LDA, NA, 0, 0, NA, NA, plasma_desc_mat_free(&(descA)) );
162  plasma_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, plasma_desc_mat_free(&(descA)); plasma_desc_mat_free(&(descB)));
163  } else {
164  plasma_ziplap2tile( descA, A, NB, NB, LDA, NA, 0, 0, NA, NA );
165  plasma_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS);
166  }
167 
168  /* Call the tile interface */
170  side, uplo, transA, diag, alpha, &descA, &descB, sequence, &request);
171 
173  plasma_zooptile2lap( descB, B, NB, NB, LDB, NRHS );
175  plasma_desc_mat_free(&descA);
176  plasma_desc_mat_free(&descB);
177  } else {
178  plasma_ziptile2lap( descA, A, NB, NB, LDA, NA );
179  plasma_ziptile2lap( descB, B, NB, NB, LDB, NRHS );
181  }
182 
183  status = sequence->status;
184  plasma_sequence_destroy(plasma, sequence);
185  return status;
186 }
187 /***************************************************************************/
250  PLASMA_enum transA, PLASMA_enum diag,
252 {
254  PLASMA_sequence *sequence = NULL;
256  int status;
257 
258  plasma = plasma_context_self();
259  if (plasma == NULL) {
260  plasma_fatal_error("PLASMA_ztrsm_Tile", "PLASMA not initialized");
262  }
263  plasma_sequence_create(plasma, &sequence);
264  PLASMA_ztrsm_Tile_Async(side, uplo, transA, diag, alpha, A, B, sequence, &request);
266  status = sequence->status;
267  plasma_sequence_destroy(plasma, sequence);
268  return status;
269 }
270 
271 /***************************************************************************/
299  PLASMA_enum transA, PLASMA_enum diag,
301  PLASMA_sequence *sequence, PLASMA_request *request)
302 {
303  PLASMA_desc descA = *A;
304  PLASMA_desc descB = *B;
306 
307  plasma = plasma_context_self();
308  if (plasma == NULL) {
309  plasma_fatal_error("PLASMA_ztrsm_Tile", "PLASMA not initialized");
311  }
312  if (sequence == NULL) {
313  plasma_fatal_error("PLASMA_ztrsm_Tile", "NULL sequence");
314  return PLASMA_ERR_UNALLOCATED;
315  }
316  if (request == NULL) {
317  plasma_fatal_error("PLASMA_ztrsm_Tile", "NULL request");
318  return PLASMA_ERR_UNALLOCATED;
319  }
320  /* Check sequence status */
321  if (sequence->status == PLASMA_SUCCESS)
322  request->status = PLASMA_SUCCESS;
323  else
324  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
325 
326  /* Check descriptors for correctness */
327  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
328  plasma_error("PLASMA_ztrsm_Tile", "invalid first descriptor");
329  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
330  }
331  if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
332  plasma_error("PLASMA_ztrsm_Tile", "invalid second descriptor");
333  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
334  }
335  /* Check input arguments */
336  if (descA.nb != descA.mb || descB.nb != descB.mb) {
337  plasma_error("PLASMA_ztrsm_Tile", "only square tiles supported");
338  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
339  }
340  if (side != PlasmaLeft && side != PlasmaRight) {
341  plasma_error("PLASMA_ztrsm_Tile", "illegal value of side");
342  return plasma_request_fail(sequence, request, -1);
343  }
344  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
345  plasma_error("PLASMA_ztrsm_Tile", "illegal value of uplo");
346  return plasma_request_fail(sequence, request, -2);
347  }
348  if (transA != PlasmaConjTrans && transA != PlasmaNoTrans && transA != PlasmaTrans) {
349  plasma_error("PLASMA_ztrsm_Tile", "illegal value of transA");
350  return plasma_request_fail(sequence, request, -3);
351  }
352  if (diag != PlasmaUnit && diag != PlasmaNonUnit) {
353  plasma_error("PLASMA_ztrsm_Tile", "illegal value of diag");
354  return plasma_request_fail(sequence, request, -4);
355  }
356 
357  /* Quick return */
359  PLASMA_enum, side,
360  PLASMA_enum, uplo,
361  PLASMA_enum, transA,
362  PLASMA_enum, diag,
363  PLASMA_Complex64_t, alpha,
364  PLASMA_desc, descA,
365  PLASMA_desc, descB,
366  PLASMA_sequence*, sequence,
367  PLASMA_request*, request);
368 
369  return PLASMA_SUCCESS;
370 }