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