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
zpotrf.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
71  PLASMA_Complex64_t *A, int LDA)
72 {
73  int NB;
74  int status;
76  PLASMA_sequence *sequence = NULL;
78  PLASMA_desc descA;
79 
80  plasma = plasma_context_self();
81  if (plasma == NULL) {
82  plasma_fatal_error("PLASMA_zpotrf", "PLASMA not initialized");
84  }
85  /* Check input arguments */
86  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
87  plasma_error("PLASMA_zpotrf", "illegal value of uplo");
88  return -1;
89  }
90  if (N < 0) {
91  plasma_error("PLASMA_zpotrf", "illegal value of N");
92  return -2;
93  }
94  if (LDA < max(1, N)) {
95  plasma_error("PLASMA_zpotrf", "illegal value of LDA");
96  return -4;
97  }
98  /* Quick return */
99  if (max(N, 0) == 0)
100  return PLASMA_SUCCESS;
101 
102  /* Tune NB depending on M, N & NRHS; Set NBNB */
103  status = plasma_tune(PLASMA_FUNC_ZPOSV, N, N, 0);
104  if (status != PLASMA_SUCCESS) {
105  plasma_error("PLASMA_zpotrf", "plasma_tune() failed");
106  return status;
107  }
108 
109  /* Set NT */
110  NB = PLASMA_NB;
111 
112  plasma_sequence_create(plasma, &sequence);
113 
115  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, plasma_desc_mat_free(&(descA)) );
116  } else {
117  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N);
118  }
119 
120  /* Call the tile interface */
121  PLASMA_zpotrf_Tile_Async(uplo, &descA, sequence, &request);
122 
124  plasma_zooptile2lap( descA, A, NB, NB, LDA, N );
126  plasma_desc_mat_free(&descA);
127  } else {
128  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
130  }
131 
132  status = sequence->status;
133  plasma_sequence_destroy(plasma, sequence);
134 
135  return status;
136 }
137 
138 /***************************************************************************/
184 {
186  PLASMA_sequence *sequence = NULL;
188  int status;
189 
190  plasma = plasma_context_self();
191  if (plasma == NULL) {
192  plasma_fatal_error("PLASMA_zpotrf_Tile", "PLASMA not initialized");
194  }
195  plasma_sequence_create(plasma, &sequence);
196  PLASMA_zpotrf_Tile_Async(uplo, A, sequence, &request);
198  status = sequence->status;
199  plasma_sequence_destroy(plasma, sequence);
200  return status;
201 }
202 
203 /***************************************************************************/
233  PLASMA_sequence *sequence, PLASMA_request *request)
234 {
235  PLASMA_desc descA = *A;
237 
238  plasma = plasma_context_self();
239  if (plasma == NULL) {
240  plasma_fatal_error("PLASMA_zpotrf_Tile", "PLASMA not initialized");
242  }
243  if (sequence == NULL) {
244  plasma_fatal_error("PLASMA_zpotrf_Tile", "NULL sequence");
245  return PLASMA_ERR_UNALLOCATED;
246  }
247  if (request == NULL) {
248  plasma_fatal_error("PLASMA_zpotrf_Tile", "NULL request");
249  return PLASMA_ERR_UNALLOCATED;
250  }
251  /* Check sequence status */
252  if (sequence->status == PLASMA_SUCCESS)
253  request->status = PLASMA_SUCCESS;
254  else
255  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
256 
257  /* Check descriptors for correctness */
258  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
259  plasma_error("PLASMA_zpotrf_Tile", "invalid descriptor");
260  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
261  }
262  /* Check input arguments */
263  if (descA.nb != descA.mb) {
264  plasma_error("PLASMA_zpotrf_Tile", "only square tiles supported");
265  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
266  }
267  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
268  plasma_error("PLASMA_zpotrf_Tile", "illegal value of uplo");
269  return plasma_request_fail(sequence, request, -1);
270  }
271  /* Quick return */
272 /*
273  if (max(N, 0) == 0)
274  return PLASMA_SUCCESS;
275 */
277  PLASMA_enum, uplo,
278  PLASMA_desc, descA,
279  PLASMA_sequence*, sequence,
280  PLASMA_request*, request);
281 
282  return PLASMA_SUCCESS;
283 }