HiCMA
Hierarchical Computations on Manycore Architectures
ztrsm.c
Go to the documentation of this file.
1 
27 /*
28  *
29  * file ztrsm.c
30  *
31  * MORSE computational routines
32  * MORSE is a software package provided by Univ. of Tennessee,
33  * Univ. of California Berkeley and Univ. of Colorado Denver
34  *
35  * version 2.5.0
36  * comment This file has been automatically generated
37  * from Plasma 2.5.0 for MORSE 1.0.0
38  * author Jakub Kurzak
39  * author Mathieu Faverge
40  * author Emmanuel Agullo
41  * author Cedric Castagnede
42  * date 2010-11-15
43  * precisions normal z -> s d c
44  *
45  */
46 #include "hicma.h"
47 #include <stdio.h>
48 #include "control/common.h"
49 #include "control/hicma_common.h"
50 
51 /***************************************************************************/
104 int HICMA_ztrsm_Tile(MORSE_enum side, MORSE_enum uplo,
105  MORSE_enum transA, MORSE_enum diag,
106  double alpha,
107  MORSE_desc_t *AUV,
108  MORSE_desc_t *AD,
109  MORSE_desc_t *Ark,
110  MORSE_desc_t *BUV,
111  MORSE_desc_t *Brk,
112  int rk,
113  int maxrk,
114  double acc
115  )
116 {
117  if(HICMA_get_print_index() == 1){
118  printf("%d:%s rk:%d maxrk:%d acc:%e alpha:%e\n",
119  __LINE__, __func__,
120  rk, maxrk, acc, alpha);
121  }
122  MORSE_context_t *morse;
123  MORSE_sequence_t *sequence = NULL;
124  MORSE_request_t request = MORSE_REQUEST_INITIALIZER;
125  int status;
126 
127  morse = morse_context_self();
128  if (morse == NULL) {
129  morse_fatal_error("MORSE_ztrsm_Tile", "MORSE not initialized");
130  return MORSE_ERR_NOT_INITIALIZED;
131  }
132  morse_sequence_create(morse, &sequence);
133  HICMA_ztrsm_Tile_Async(side, uplo, transA, diag, alpha,
134  AUV, AD, Ark, BUV, Brk,
135  rk, maxrk, acc,
136  sequence, &request);
137  MORSE_Desc_Flush( AUV, sequence );
138  MORSE_Desc_Flush( AD, sequence );
139  MORSE_Desc_Flush( Ark, sequence );
140  MORSE_Desc_Flush( BUV, sequence );
141  MORSE_Desc_Flush( Brk, sequence );
142  morse_sequence_wait(morse, sequence);
143  /*RUNTIME_desc_getoncpu(AUV);*/
144  /*RUNTIME_desc_getoncpu(AD);*/
145  /*RUNTIME_desc_getoncpu(Ark);*/
146  /*RUNTIME_desc_getoncpu(BUV);*/
147  /*RUNTIME_desc_getoncpu(Brk); */
148 
149  status = sequence->status;
150  morse_sequence_destroy(morse, sequence);
151  return status;
152 }
153 
154 /***************************************************************************/
172 int HICMA_ztrsm_Tile_Async(MORSE_enum side, MORSE_enum uplo,
173  MORSE_enum transA, MORSE_enum diag,
174  double alpha,
175  MORSE_desc_t *AUV,
176  MORSE_desc_t *AD,
177  MORSE_desc_t *Ark,
178  MORSE_desc_t *BUV,
179  MORSE_desc_t *Brk,
180  int rk,
181  int maxrk,
182  double acc,
183  MORSE_sequence_t *sequence, MORSE_request_t *request)
184 {
185  if(HICMA_get_print_index() == 1){
186  printf("%d:%s rk:%d maxrk:%d acc:%e alpha:%e\n",
187  __LINE__, __func__,
188  rk, maxrk, acc, alpha);
189  }
190  MORSE_context_t *morse;
191 
192  morse = morse_context_self();
193  if (morse == NULL) {
194  morse_fatal_error("MORSE_ztrsm_Tile", "MORSE not initialized");
195  return MORSE_ERR_NOT_INITIALIZED;
196  }
197  if (sequence == NULL) {
198  morse_fatal_error("MORSE_ztrsm_Tile", "NULL sequence");
199  return MORSE_ERR_UNALLOCATED;
200  }
201  if (request == NULL) {
202  morse_fatal_error("MORSE_ztrsm_Tile", "NULL request");
203  return MORSE_ERR_UNALLOCATED;
204  }
205  /* Check sequence status */
206  if (sequence->status == MORSE_SUCCESS)
207  request->status = MORSE_SUCCESS;
208  else
209  return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED);
210 
211  /* Check descriptors for correctness */
212  if (morse_desc_check(AUV) != MORSE_SUCCESS) {
213  morse_error("MORSE_ztrsm_Tile", "invalid first descriptor");
214  return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
215  }
216  if (morse_desc_check(BUV) != MORSE_SUCCESS) {
217  morse_error("MORSE_ztrsm_Tile", "invalid second descriptor");
218  return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
219  }
220  /* Check input arguments */
221  /*if (A->nb != A->mb || B->nb != B->mb) {*/
222  /*morse_error("MORSE_ztrsm_Tile", "only square tiles supported");*/
223  /*return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);*/
224  /*}*/
225  if (side != MorseLeft && side != MorseRight) {
226  morse_error("MORSE_ztrsm_Tile", "illegal value of side");
227  return morse_request_fail(sequence, request, -1);
228  }
229  if (uplo != MorseUpper && uplo != MorseLower) {
230  morse_error("MORSE_ztrsm_Tile", "illegal value of uplo");
231  return morse_request_fail(sequence, request, -2);
232  }
233  if (transA != MorseConjTrans && transA != MorseNoTrans && transA != MorseTrans) {
234  morse_error("MORSE_ztrsm_Tile", "illegal value of transA");
235  return morse_request_fail(sequence, request, -3);
236  }
237  if (diag != MorseUnit && diag != MorseNonUnit) {
238  morse_error("MORSE_ztrsm_Tile", "illegal value of diag");
239  return morse_request_fail(sequence, request, -4);
240  }
241 
242  hicma_pztrsm(side, uplo, transA, diag, alpha,
243  AUV, AD, Ark, BUV, Brk,
244  rk, maxrk, acc,
245  sequence, request);
246 
247  return MORSE_SUCCESS;
248 }
249 
250 /***************************************************************************/
303 int HICMA_ztrsmd_Tile(MORSE_enum side, MORSE_enum uplo,
304  MORSE_enum transA, MORSE_enum diag,
305  double alpha,
306  MORSE_desc_t *AUV,
307  MORSE_desc_t *AD,
308  MORSE_desc_t *Ark,
309  MORSE_desc_t *Bdense,
310  int maxrk
311  )
312 {
313  if(HICMA_get_print_index() == 1){
314  printf("%d:%s maxrk:%d alpha:%e\n",
315  __LINE__, __func__,
316  maxrk, alpha);
317  }
318  MORSE_context_t *morse;
319  MORSE_sequence_t *sequence = NULL;
320  MORSE_request_t request = MORSE_REQUEST_INITIALIZER;
321  int status;
322 
323  morse = morse_context_self();
324  if (morse == NULL) {
325  morse_fatal_error("MORSE_ztrsmd_Tile", "MORSE not initialized");
326  return MORSE_ERR_NOT_INITIALIZED;
327  }
328  morse_sequence_create(morse, &sequence);
329  HICMA_ztrsmd_Tile_Async(side, uplo, transA, diag, alpha,
330  AUV, AD, Ark, Bdense,
331  maxrk,
332  sequence, &request);
333  MORSE_Desc_Flush( AUV, sequence );
334  MORSE_Desc_Flush( AD, sequence );
335  MORSE_Desc_Flush( Ark, sequence );
336  MORSE_Desc_Flush( Bdense, sequence );
337  morse_sequence_wait(morse, sequence);
338  /*RUNTIME_desc_getoncpu(AUV);*/
339  /*RUNTIME_desc_getoncpu(AD);*/
340  /*RUNTIME_desc_getoncpu(Ark);*/
341  /*RUNTIME_desc_getoncpu(Bdense);*/
342 
343  status = sequence->status;
344  morse_sequence_destroy(morse, sequence);
345  return status;
346 }
347 
348 /***************************************************************************/
366 int HICMA_ztrsmd_Tile_Async(MORSE_enum side, MORSE_enum uplo,
367  MORSE_enum transA, MORSE_enum diag,
368  double alpha,
369  MORSE_desc_t *AUV,
370  MORSE_desc_t *AD,
371  MORSE_desc_t *Ark,
372  MORSE_desc_t *Bdense,
373  int maxrk,
374  MORSE_sequence_t *sequence, MORSE_request_t *request)
375 {
376  if(HICMA_get_print_index() == 1){
377  printf("%d:%s maxrk:%d alpha:%e\n",
378  __LINE__, __func__,
379  maxrk, alpha);
380  }
381  MORSE_context_t *morse;
382 
383  morse = morse_context_self();
384  if (morse == NULL) {
385  morse_fatal_error("MORSE_ztrsmd_Tile", "MORSE not initialized");
386  return MORSE_ERR_NOT_INITIALIZED;
387  }
388  if (sequence == NULL) {
389  morse_fatal_error("MORSE_ztrsmd_Tile", "NULL sequence");
390  return MORSE_ERR_UNALLOCATED;
391  }
392  if (request == NULL) {
393  morse_fatal_error("MORSE_ztrsmd_Tile", "NULL request");
394  return MORSE_ERR_UNALLOCATED;
395  }
396  /* Check sequence status */
397  if (sequence->status == MORSE_SUCCESS)
398  request->status = MORSE_SUCCESS;
399  else
400  return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED);
401 
402  /* Check descriptors for correctness */
403  if (morse_desc_check(AUV) != MORSE_SUCCESS) {
404  morse_error("MORSE_ztrsmd_Tile", "invalid first descriptor");
405  return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
406  }
407  if (morse_desc_check(Bdense) != MORSE_SUCCESS) {
408  morse_error("MORSE_ztrsmd_Tile", "invalid second descriptor");
409  return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
410  }
411  /* Check input arguments */
412  /*if (A->nb != A->mb || B->nb != B->mb) {*/
413  /*morse_error("MORSE_ztrsm_Tile", "only square tiles supported");*/
414  /*return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);*/
415  /*}*/
416  if (side != MorseLeft && side != MorseRight) {
417  morse_error("MORSE_ztrsmd_Tile", "illegal value of side");
418  return morse_request_fail(sequence, request, -1);
419  }
420  if (uplo != MorseUpper && uplo != MorseLower) {
421  morse_error("MORSE_ztrsmd_Tile", "illegal value of uplo");
422  return morse_request_fail(sequence, request, -2);
423  }
424  if (transA != MorseConjTrans && transA != MorseNoTrans && transA != MorseTrans) {
425  morse_error("MORSE_ztrsmd_Tile", "illegal value of transA");
426  return morse_request_fail(sequence, request, -3);
427  }
428  if (diag != MorseUnit && diag != MorseNonUnit) {
429  morse_error("MORSE_ztrsmd_Tile", "illegal value of diag");
430  return morse_request_fail(sequence, request, -4);
431  }
432 
433  hicma_pztrsmd(side, uplo, transA, diag, alpha,
434  AUV, AD, Ark, Bdense,
435  maxrk,
436  sequence, request);
437 
438  return MORSE_SUCCESS;
439 }
440 
#define AUV(m, n)
Definition: pzgemm.c:60
void hicma_pztrsm(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum diag, double alpha, MORSE_desc_t *AUV, MORSE_desc_t *AD, MORSE_desc_t *Ark, MORSE_desc_t *BUV, MORSE_desc_t *Brk, int rk, int maxrk, double acc, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: pztrsm.c:60
#define BUV(m, n)
Definition: pzgemm.c:61
int side[2]
int diag[2]
int HICMA_ztrsm_Tile_Async(MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, double alpha, MORSE_desc_t *AUV, MORSE_desc_t *AD, MORSE_desc_t *Ark, MORSE_desc_t *BUV, MORSE_desc_t *Brk, int rk, int maxrk, double acc, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: ztrsm.c:172
int HICMA_ztrsmd_Tile(MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, double alpha, MORSE_desc_t *AUV, MORSE_desc_t *AD, MORSE_desc_t *Ark, MORSE_desc_t *Bdense, int maxrk)
Definition: ztrsm.c:303
int HICMA_ztrsm_Tile(MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, double alpha, MORSE_desc_t *AUV, MORSE_desc_t *AD, MORSE_desc_t *Ark, MORSE_desc_t *BUV, MORSE_desc_t *Brk, int rk, int maxrk, double acc)
Definition: ztrsm.c:104
void hicma_pztrsmd(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum diag, double alpha, MORSE_desc_t *AUV, MORSE_desc_t *AD, MORSE_desc_t *Ark, MORSE_desc_t *Bdense, int maxrk, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: pztrsm.c:521
int uplo[2]
int HICMA_get_print_index()
Definition: hicma_init.c:50
int HICMA_ztrsmd_Tile_Async(MORSE_enum side, MORSE_enum uplo, MORSE_enum transA, MORSE_enum diag, double alpha, MORSE_desc_t *AUV, MORSE_desc_t *AD, MORSE_desc_t *Ark, MORSE_desc_t *Bdense, int maxrk, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: ztrsm.c:366