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
zplghe.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
58 int PLASMA_zplghe( double bump, int N,
59  PLASMA_Complex64_t *A, int LDA,
60  unsigned long long int seed )
61 {
62  int NB;
63  int status;
65  PLASMA_sequence *sequence = NULL;
67  PLASMA_desc descA;
68 
69  plasma = plasma_context_self();
70  if (plasma == NULL) {
71  plasma_fatal_error("PLASMA_zplghe", "PLASMA not initialized");
73  }
74  /* Check input arguments */
75  if (N < 0) {
76  plasma_error("PLASMA_zplghe", "illegal value of N");
77  return -2;
78  }
79  if (LDA < max(1, N)) {
80  plasma_error("PLASMA_zplghe", "illegal value of LDA");
81  return -4;
82  }
83  /* Quick return */
84  if (max(0, N) == 0)
85  return PLASMA_SUCCESS;
86 
87  /* Tune NB depending on M, N & NRHS; Set NBNB */
88  status = plasma_tune(PLASMA_FUNC_ZGEMM, N, N, 0);
89  if (status != PLASMA_SUCCESS) {
90  plasma_error("PLASMA_zplghe", "plasma_tune() failed");
91  return status;
92  }
93 
94  /* Set NT */
95  NB = PLASMA_NB;
96  plasma_sequence_create(plasma, &sequence);
97 
98  descA = plasma_desc_init(
99  PlasmaComplexDouble, NB, NB, NB*NB,
100  LDA, N, 0, 0, N, N);
101  descA.mat = A;
102 
103  /* Call the tile interface */
104  PLASMA_zplghe_Tile_Async( bump, &descA, seed, sequence, &request );
105 
106  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
108 
109  status = sequence->status;
110  plasma_sequence_destroy(plasma, sequence);
111 
112  return status;
113 }
114 
115 /***************************************************************************/
153 int PLASMA_zplghe_Tile( double bump, PLASMA_desc *A,
154  unsigned long long int seed )
155 {
157  PLASMA_sequence *sequence = NULL;
159  int status;
160 
161  plasma = plasma_context_self();
162  if (plasma == NULL) {
163  plasma_fatal_error("PLASMA_zplghe_Tile", "PLASMA not initialized");
165  }
166  plasma_sequence_create(plasma, &sequence);
167  PLASMA_zplghe_Tile_Async( bump, A, seed, sequence, &request );
169  status = sequence->status;
170  plasma_sequence_destroy(plasma, sequence);
171  return status;
172 }
173 
174 /***************************************************************************/
203 int PLASMA_zplghe_Tile_Async( double bump,
204  PLASMA_desc *A,
205  unsigned long long int seed,
206  PLASMA_sequence *sequence,
207  PLASMA_request *request)
208 {
209  PLASMA_desc descA = *A;
211 
212  plasma = plasma_context_self();
213  if (plasma == NULL) {
214  plasma_fatal_error("PLASMA_zplghe_Tile", "PLASMA not initialized");
216  }
217  if (sequence == NULL) {
218  plasma_fatal_error("PLASMA_zplghe_Tile", "NULL sequence");
219  return PLASMA_ERR_UNALLOCATED;
220  }
221  if (request == NULL) {
222  plasma_fatal_error("PLASMA_zplghe_Tile", "NULL request");
223  return PLASMA_ERR_UNALLOCATED;
224  }
225  /* Check sequence status */
226  if (sequence->status == PLASMA_SUCCESS)
227  request->status = PLASMA_SUCCESS;
228  else
229  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
230 
231  /* Check descriptors for correctness */
232  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
233  plasma_error("PLASMA_zplghe_Tile", "invalid descriptor");
234  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
235  }
236  /* Check input arguments */
237  if (descA.nb != descA.mb) {
238  plasma_error("PLASMA_zplghe_Tile", "only square tiles supported");
239  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
240  }
241 
242  /* Quick return */
243  if (min( descA.m, descA.n ) == 0)
244  return PLASMA_SUCCESS;
245 
247  double, bump,
248  PLASMA_desc, descA,
249  unsigned long long int, seed,
250  PLASMA_sequence*, sequence,
251  PLASMA_request*, request);
252 
253  return PLASMA_SUCCESS;
254 }