ExaGeoStat
ExaGeoStat is a parallel high performance unified framework for geostatistics on manycore systems.
pdpotrf_diag.c
Go to the documentation of this file.
1 
32 #include "../include/diag.h"
33 
34 #define A(m,n) A, m, n
35 /***************************************************************************/
38 void morse_pdpotrf_diag(MORSE_enum uplo, MORSE_desc_t *A, int diag_thick,
39  MORSE_sequence_t *sequence, MORSE_request_t *request)
40 {
41  MORSE_context_t *morse;
42  MORSE_option_t options;
43 
44  int k, m, n;
45  int ldak, ldam, ldan;
46  int tempkm, tempmm, tempnn;
47  size_t ws_host = 0;
48 
49  double zone = (double) 1.0;
50  double mzone = (double)-1.0;
51 
52  morse = morse_context_self();
53  if (sequence->status != MORSE_SUCCESS)
54  return;
55  RUNTIME_options_init(&options, morse, sequence, request);
56 
57  RUNTIME_options_ws_alloc( &options, 0, ws_host );
58 
59  /*
60  * MorseLower
61  */
62  if (uplo == MorseLower) {
63  for (k = 0; k < A->mt; k++) {
64  RUNTIME_iteration_push(morse, k);
65 
66  tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
67  ldak = BLKLDD(A, k);
68 
69  options.priority = 2*A->mt - 2*k;
70  MORSE_TASK_dpotrf(
71  &options,
72  MorseLower, tempkm, A->mb,
73  A(k, k), ldak, A->nb*k);
74 
75  for (m = k+1; m < A->mt && m < k+diag_thick; m++) {
76  tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
77  ldam = BLKLDD(A, m);
78 
79  options.priority = 2*A->mt - 2*k - m;
80  MORSE_TASK_dtrsm(
81  &options,
82  MorseRight, MorseLower, MorseTrans, MorseNonUnit,
83  tempmm, A->mb, A->mb,
84  zone, A(k, k), ldak,
85  A(m, k), ldam);
86  }
87  RUNTIME_data_flush( sequence, A(k, k) );
88 
89  for (n = k+1; n < A->nt && n < k+diag_thick; n++) {
90  tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
91  ldan = BLKLDD(A, n);
92 
93  options.priority = 2*A->mt - 2*k - n;
94  MORSE_TASK_dsyrk(
95  &options,
96  MorseLower, MorseNoTrans,
97  tempnn, A->nb, A->mb,
98  -1.0, A(n, k), ldan,
99  1.0, A(n, n), ldan);
100 
101  for (m = n+1; m < A->mt && m < n+diag_thick; m++) {
102  tempmm = m == A->mt-1 ? A->m - m*A->mb : A->mb;
103  ldam = BLKLDD(A, m);
104 
105  options.priority = 2*A->mt - 2*k - n - m;
106  MORSE_TASK_dgemm(
107  &options,
108  MorseNoTrans, MorseTrans,
109  tempmm, tempnn, A->mb, A->mb,
110  mzone, A(m, k), ldam,
111  A(n, k), ldan,
112  zone, A(m, n), ldam);
113  }
114  RUNTIME_data_flush( sequence, A(n, k) );
115  }
116  RUNTIME_iteration_pop(morse);
117  }
118  }
119  /*
120  * MorseUpper
121  */
122  else {
123  for (k = 0; k < A->nt; k++) {
124  RUNTIME_iteration_push(morse, k);
125 
126  tempkm = k == A->nt-1 ? A->n-k*A->nb : A->nb;
127  ldak = BLKLDD(A, k);
128 
129  options.priority = 2*A->nt - 2*k;
130  MORSE_TASK_dpotrf(
131  &options,
132  MorseUpper,
133  tempkm, A->mb,
134  A(k, k), ldak, A->nb*k);
135 
136  for (n = k+1; n < A->nt; n++) {
137  tempnn = n == A->nt-1 ? A->n - n*A->nb : A->nb;
138 
139  options.priority = 2*A->nt - 2*k - n;
140  MORSE_TASK_dtrsm(
141  &options,
142  MorseLeft, MorseUpper, MorseTrans, MorseNonUnit,
143  A->mb, tempnn, A->mb,
144  zone, A(k, k), ldak,
145  A(k, n), ldak);
146  }
147  RUNTIME_data_flush( sequence, A(k, k) );
148 
149  for (m = k+1; m < A->mt; m++) {
150  tempmm = m == A->mt-1 ? A->m - m*A->mb : A->mb;
151  ldam = BLKLDD(A, m);
152 
153  options.priority = 2*A->nt - 2*k - m;
154  MORSE_TASK_dsyrk(
155  &options,
156  MorseUpper, MorseTrans,
157  tempmm, A->mb, A->mb,
158  -1.0, A(k, m), ldak,
159  1.0, A(m, m), ldam);
160 
161  for (n = m+1; n < A->nt; n++) {
162  tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
163 
164  options.priority = 2*A->nt - 2*k - n - m;
165  MORSE_TASK_dgemm(
166  &options,
167  MorseTrans, MorseNoTrans,
168  tempmm, tempnn, A->mb, A->mb,
169  mzone, A(k, m), ldak,
170  A(k, n), ldak,
171  zone, A(m, n), ldam);
172  }
173  RUNTIME_data_flush( sequence, A(k, m) );
174  }
175 
176  RUNTIME_iteration_pop(morse);
177  }
178  }
179 
180  RUNTIME_options_ws_free(&options);
181  RUNTIME_options_finalize(&options, morse);
182 }
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
#define A(m, n)
Definition: pdpotrf_diag.c:34