ExaGeoStat
ExaGeoStat is a parallel high performance unified framework for geostatistics on manycore systems.
dpotrf_diag.c
Go to the documentation of this file.
1 
30 #include "../include/diag.h"
31 
32 /***************************************************************************/
85 int MORSE_dpotrf_diag(MORSE_enum uplo, int N,
86  double *A, int LDA, int diag_thick)
87 {
88  int NB;
89  int status;
90  MORSE_context_t *morse;
91  MORSE_sequence_t *sequence = NULL;
92  MORSE_request_t request = MORSE_REQUEST_INITIALIZER;
93  MORSE_desc_t descAl, descAt;
94 
95  morse = morse_context_self();
96  if (morse == NULL) {
97  morse_fatal_error("MORSE_diag_dpotrf", "MORSE not initialized");
98  return MORSE_ERR_NOT_INITIALIZED;
99  }
100  /* Check input arguments */
101  if ((uplo != MorseUpper) && (uplo != MorseLower)) {
102  morse_error("MORSE_diag_dpotrf", "illegal value of uplo");
103  return -1;
104  }
105  if (N < 0) {
106  morse_error("MORSE_diag_dpotrf", "illegal value of N");
107  return -2;
108  }
109  if (LDA < chameleon_max(1, N)) {
110  morse_error("MORSE_diag_dpotrf", "illegal value of LDA");
111  return -4;
112  }
113 /* Quick return */
114  if (chameleon_max(N, 0) == 0)
115  return MORSE_SUCCESS;
116 
117  /* Tune NB depending on M, N & NRHS; Set NBNB */
118  status = morse_tune(MORSE_FUNC_DPOSV, N, N, 0);
119  if (status != MORSE_SUCCESS) {
120  morse_error("MORSE_diag_dpotrf", "morse_tune() failed");
121  return status;
122  }
123 
124  /* Set NT */
125  NB = MORSE_NB;
126 
127  morse_sequence_create( morse, &sequence );
128 
129  /* Submit the matrix conversion */
130  morse_dlap2tile( morse, &descAl, &descAt, MorseDescInout, uplo,
131  A, NB, NB, LDA, N, N, N, sequence, &request );
132 
133  /* Call the tile interface */
134  MORSE_dpotrf_diag_Tile_Async(uplo, &descAt, diag_thick, sequence, &request);
135 
136  /* Submit the matrix conversion back */
137  morse_dtile2lap( morse, &descAl, &descAt,
138  MorseDescInout, uplo, sequence, &request );
139 
140  morse_sequence_wait( morse, sequence );
141 
142  /* Cleanup the temporary data */
143  morse_dtile2lap_cleanup( morse, &descAl, &descAt );
144 
145  status = sequence->status;
146  morse_sequence_destroy( morse, sequence );
147 
148  return status;
149 
150 
151 }
152 
153 /***************************************************************************/
198 int MORSE_dpotrf_diag_Tile(MORSE_enum uplo, MORSE_desc_t *A, int diag_thick)
199 {
200  MORSE_context_t *morse;
201  MORSE_sequence_t *sequence = NULL;
202  MORSE_request_t request = MORSE_REQUEST_INITIALIZER;
203  int status;
204 
205  morse = morse_context_self();
206  if (morse == NULL) {
207  morse_fatal_error("MORSE_dpotrf_Tile", "MORSE not initialized");
208  return MORSE_ERR_NOT_INITIALIZED;
209  }
210  morse_sequence_create(morse, &sequence);
211  MORSE_dpotrf_diag_Tile_Async(uplo, A, diag_thick, sequence, &request);
212  MORSE_Desc_Flush( A, sequence );
213  morse_sequence_wait(morse, sequence);
214  // RUNTIME_desc_getoncpu(A);
215 
216  status = sequence->status;
217  morse_sequence_destroy(morse, sequence);
218  return status;
219 }
220 
221 /***************************************************************************/
250 int MORSE_dpotrf_diag_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, int diag_thick,
251  MORSE_sequence_t *sequence, MORSE_request_t *request)
252 {
253  MORSE_context_t *morse;
254 
255  morse = morse_context_self();
256  if (morse == NULL) {
257  morse_fatal_error("MORSE_dpotrf_Tile_Async", "MORSE not initialized");
258  return MORSE_ERR_NOT_INITIALIZED;
259  }
260  if (sequence == NULL) {
261  morse_fatal_error("MORSE_dpotrf_Tile_Async", "NULL sequence");
262  return MORSE_ERR_UNALLOCATED;
263  }
264  if (request == NULL) {
265  morse_fatal_error("MORSE_dpotrf_Tile_Async", "NULL request");
266  return MORSE_ERR_UNALLOCATED;
267  }
268  /* Check sequence status */
269  if (sequence->status == MORSE_SUCCESS)
270  request->status = MORSE_SUCCESS;
271  else
272  return morse_request_fail(sequence, request, MORSE_ERR_SEQUENCE_FLUSHED);
273 
274  /* Check descriptors for correctness */
275  if (morse_desc_check(A) != MORSE_SUCCESS) {
276  morse_error("MORSE_dpotrf_Tile_Async", "invalid descriptor");
277  return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
278  }
279  /* Check input arguments */
280  if (A->nb != A->mb) {
281  morse_error("MORSE_dpotrf_Tile_Async", "only square tiles supported");
282  return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
283  }
284  if (uplo != MorseUpper && uplo != MorseLower) {
285  morse_error("MORSE_dpotrf_Tile_Async", "illegal value of uplo");
286  return morse_request_fail(sequence, request, -1);
287  }
288  /* Quick return */
289 /*
290  if (chameleon_max(N, 0) == 0)
291  return MORSE_SUCCESS;
292 */
293  morse_pdpotrf_diag(uplo, A, diag_thick, sequence, request);
294 
295  return MORSE_SUCCESS;
296 }
int MORSE_dpotrf_diag_Tile(MORSE_enum uplo, MORSE_desc_t *A, int diag_thick)
Definition: dpotrf_diag.c:198
int MORSE_dpotrf_diag_Tile_Async(MORSE_enum uplo, MORSE_desc_t *A, int diag_thick, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: dpotrf_diag.c:250
void morse_pdpotrf_diag(MORSE_enum uplo, MORSE_desc_t *A, int diag_thick, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: pdpotrf_diag.c:38
int MORSE_dpotrf_diag(MORSE_enum uplo, int N, double *A, int LDA, int diag_thick)
Definition: dpotrf_diag.c:85
#define A(m, n)
Definition: pdpotrf_diag.c:34