ExaGeoStat
ExaGeoStat is a parallel high performance unified framework for geostatistics on manycore systems.
codelet_dmse.c
Go to the documentation of this file.
1 
20 #include "../include/starpu_exageostat.h"
21 static void CORE_dmse_starpu(void *buffers[], void *cl_arg){
22  int m, m0, i;
23  double * zpre;
24  double * zmiss;
25  double * serror;
26  double local_serror = 0.0;
27 
28  serror = (double *)STARPU_MATRIX_GET_PTR(buffers[0]);
29  zpre = (double *)STARPU_MATRIX_GET_PTR(buffers[1]);
30  zmiss = (double *)STARPU_MATRIX_GET_PTR(buffers[2]);
31 
32  starpu_codelet_unpack_args(cl_arg, &m, &m0);
33 
34  for(i = 0; i < m; i++)
35  {
36 // printf("%f, %f, \n",zpre[i], zmiss[i]);
37  local_serror += pow((zpre[i]-zmiss[i]), 2);
38  }
39 
40  *serror += local_serror;
41 }
42 
43 static struct starpu_codelet cl_dmse =
44 {
45  .where = STARPU_CPU,
46  .cpu_funcs = {CORE_dmse_starpu},
47  .nbuffers = 3,
48  .modes = {STARPU_RW,STARPU_R,STARPU_R},
49  .name = "dmse"
50 };
51 
52 
53 
54 /***************************************************************************/
91 int MORSE_MLE_dmse_Tile_Async(MORSE_desc_t *descZpre, MORSE_desc_t *descZmiss, MORSE_desc_t *descserror, MORSE_sequence_t *sequence, MORSE_request_t *request){
92  MORSE_context_t *morse;
93  MORSE_option_t options;
94  morse = morse_context_self();
95  if (sequence->status != MORSE_SUCCESS)
96  return -2;
97  RUNTIME_options_init(&options, morse, sequence, request);
98 
99  int m, m0;
100  int tempmm;
101  MORSE_desc_t Zpre = *descZpre;
102  struct starpu_codelet *cl=&cl_dmse;
103 
104 
105  for (m = 0; m < Zpre.mt; m++) {
106  tempmm = m == Zpre.mt-1 ? Zpre.m - m * Zpre.mb : Zpre.mb;
107 
108  m0 = m * Zpre.mb;
109 
110  starpu_insert_task(starpu_mpi_codelet(cl),
111  STARPU_VALUE, &tempmm, sizeof(int),
112  STARPU_VALUE, &m0, sizeof(int),
113  STARPU_RW, RTBLKADDR(descserror, sizeof(double), 0, 0),
114  STARPU_R, RTBLKADDR(descZpre, sizeof(double)*tempmm, m, 0),
115  STARPU_R, RTBLKADDR(descZmiss, sizeof(double)*tempmm, m, 0),
116  #if defined(CHAMELEON_CODELETS_HAVE_NAME)
117  STARPU_NAME, "dmse",
118  #endif
119  0);
120  }
121 
122  //MORSE_TASK_flush_desc( &options, MorseUpperLower, descZpre);
123  //MORSE_TASK_flush_desc( &options, MorseUpperLower, descZmiss);
124  //MORSE_TASK_flush_desc( &options, MorseUpperLower, descserror);
125  RUNTIME_options_ws_free(&options);
126  RUNTIME_options_finalize(&options, morse);
127  //MORSE_TASK_dataflush_all();
128  MORSE_Sequence_Wait(sequence);
129  return MORSE_SUCCESS;
130 }
131 
#define RTBLKADDR(desc, type, m, n)
#define starpu_mpi_codelet(_codelet_)
int MORSE_MLE_dmse_Tile_Async(MORSE_desc_t *descZpre, MORSE_desc_t *descZmiss, MORSE_desc_t *descserror, MORSE_sequence_t *sequence, MORSE_request_t *request)
Definition: codelet_dmse.c:91