ExaGeoStat
ExaGeoStat is a parallel high performance unified framework for geostatistics on manycore systems.
codelet_dcmg_diag.c
Go to the documentation of this file.
1 
20 #include "../include/starpu_exageostat.h"
21 #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
22 #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
23 
24 static void CORE_dcmg_starpu(void *buffers[],void *cl_arg){
25  int m, n, m0, n0;
26  location * l1;
27  location * l2;
28  double * theta;
29  double * A;
30  int distance_metric;
31  theta = (double *) malloc(3* sizeof(double));
32  A = (double *)STARPU_MATRIX_GET_PTR(buffers[0]);
33 
34  starpu_codelet_unpack_args(cl_arg, &m, &n, &m0, &n0, &l1, &l2, &theta[0], &theta[1], &theta[2], &distance_metric);
35 
36 
37  core_dcmg(A, m, n, m0, n0, l1, l2, theta, distance_metric);
38 
39 }
40 
41 static struct starpu_codelet cl_dcmg =
42 {
43  .where = STARPU_CPU,
44  .cpu_funcs = {CORE_dcmg_starpu},
45  .nbuffers = 1,
46  .modes = {STARPU_W},
47  .name = "dcmg"
48 };
49 
50 /***************************************************************************/
99 int MORSE_MLE_dcmg_diag_Tile_Async(MORSE_enum uplo, MORSE_desc_t *descA, MORSE_sequence_t *sequence, MORSE_request_t *request, location *l1, location *l2, double *theta, char *dm, int diag_thick) {
100 
101  MORSE_context_t *morse;
102  MORSE_option_t options;
103  morse = morse_context_self();
104 
105 
106  if (sequence->status != MORSE_SUCCESS)
107  return -2;
108  RUNTIME_options_init(&options, morse, sequence, request);
109 
110 
111  int m, n, m0, n0;
112  int distance_metric = strcmp(dm,"gc") == 0? 1 : 0 ;
113  int tempmm, tempnn;
114  MORSE_desc_t A = *descA;
115  struct starpu_codelet *cl = &cl_dcmg;
116 
117  int k = 0;
118 
119  for(m = 0; m < A.mt;)
120  {
121  int v = m;
122 
123  for (k=0 ; k<diag_thick && m < A.mt;k++)
124  {
125  tempmm = m == A.mt -1 ? A.m- m* A.mb : A.mb;
126 
127 
128  for (n = v; n < A.nt && n < v+diag_thick; n++) {
129  //Escape unwanted tiles
130 
131  //printf ("%d - %d\n", m , n);
132  tempnn = n == A.nt -1 ? A.n - n * A.nb : A.nb;
133  m0= m * A.mb;
134  n0= n * A.nb;
135  starpu_insert_task(starpu_mpi_codelet(cl),
136  STARPU_VALUE, &tempmm, sizeof(int),
137  STARPU_VALUE, &tempnn, sizeof(int),
138  STARPU_VALUE, &m0, sizeof(int),
139  STARPU_VALUE, &n0, sizeof(int),
140  STARPU_W, RTBLKADDR(descA, sizeof(double)*ldam*tempnn, m, n),
141  STARPU_VALUE, &l1, sizeof(location*),
142  STARPU_VALUE, &l2, sizeof(location*),
143  STARPU_VALUE, &theta[0], sizeof(double),
144  STARPU_VALUE, &theta[1], sizeof(double),
145  STARPU_VALUE, &theta[2], sizeof(double),
146  STARPU_VALUE, &distance_metric, sizeof(int),
147  0);
148  }
149  m++;
150  }
151 
152  }
153 
154  //RUNTIME_data_flush( sequence, descA );
155  //MORSE_TASK_flush_desc( &options, MorseUpperLower, descA);
156  RUNTIME_options_ws_free(&options);
157  RUNTIME_options_finalize(&options, morse);
158  //MORSE_TASK_dataflush_all();
159  return MORSE_SUCCESS;
160 }
161 
162 
163 
#define RTBLKADDR(desc, type, m, n)
#define starpu_mpi_codelet(_codelet_)
void core_dcmg(double *A, int m, int n, int m0, int n0, location *l1, location *l2, double *localtheta, int distance_metric)
Definition: core_dcmg.c:95
int MORSE_MLE_dcmg_diag_Tile_Async(MORSE_enum uplo, MORSE_desc_t *descA, MORSE_sequence_t *sequence, MORSE_request_t *request, location *l1, location *l2, double *theta, char *dm, int diag_thick)
#define A(m, n)
Definition: pdpotrf_diag.c:34