HiCMA
Hierarchical Computations on Manycore Architectures
codelet_zhagcm.c
Go to the documentation of this file.
1 
16 #include "morse.h"
17 #include "runtime/starpu/chameleon_starpu.h"
18 //#include "runtime/starpu/include/runtime_codelet_z.h"
19 #include "hcore_z.h"
20 
21 #include "runtime/starpu/runtime_codelets.h"
22 ZCODELETS_HEADER(hagcm)
23 
24 
25 //CHAMELEON_CL_CB(zhagcm, starpu_matrix_get_nx(task->handles[0]), starpu_matrix_get_ny(task->handles[0]), 0, M*N)
29 void HICMA_TASK_zhagcm( const MORSE_option_t *options,
30  int m, int n,
31  const MORSE_desc_t *AUV,
32  const MORSE_desc_t *Ark,
33  int Am, int An,
34  int ldu,
35  int ldv,
36  int maxrank, double tol
37  )
38 {
39  struct starpu_codelet *codelet = &cl_zhagcm;
40  //void (*callback)(void*) = options->profiling ? cl_zhagcm_callback : NULL;
41  void (*callback)(void*) = NULL;
42  int nAUV = AUV->nb;
43 
44  MORSE_BEGIN_ACCESS_DECLARATION;
45  MORSE_ACCESS_W(AUV, Am, An);
46  MORSE_ACCESS_W(Ark, Am, An);
47  MORSE_END_ACCESS_DECLARATION;
48 
49  //printf("%s:%d: Am:%d An:%d lda:%d bigM:%d m0:%d n0:%d\n ", __FILE__, __LINE__, Am, An, lda, bigM, m0, n0);
50  //printf("%s %d: Am:%d An:%d ADm:%d ADn:%d ptr:%p\n", __func__, __LINE__, Am, An, ADm, ADn, ptr);
51  starpu_insert_task(
52  starpu_mpi_codelet(codelet),
53  STARPU_VALUE, &m, sizeof(int),
54  STARPU_VALUE, &n, sizeof(int),
55  STARPU_VALUE, &nAUV, sizeof(int),
56  STARPU_W, RTBLKADDR(AUV, double, Am, An),
57  STARPU_W, RTBLKADDR(Ark, double, Am, An),
58  STARPU_VALUE, &ldu, sizeof(int),
59  STARPU_VALUE, &ldv, sizeof(int),
60  STARPU_VALUE, &Am, sizeof(int),
61  STARPU_VALUE, &An, sizeof(int),
62  STARPU_VALUE, &maxrank, sizeof(int),
63  STARPU_VALUE, &tol, sizeof(double),
64  STARPU_PRIORITY, options->priority,
65  STARPU_CALLBACK, callback,
66 #if defined(CHAMELEON_CODELETS_HAVE_NAME)
67  STARPU_NAME, "hcore_zhagcm",
68 #endif
69  0);
70 }
71 
72 /* cl_zhagcm_cpu_func - Generate a tile for random matrix. */
73 
74 #if !defined(CHAMELEON_SIMULATION)
75 static void cl_zhagcm_cpu_func(void *descr[], void *cl_arg)
76 {
77  int m;
78  int n;
79  int nAUV;
80  double *AUV;
81  double *Ark;
82  int ldu;
83  int ldv;
84  int tile_row_index;
85  int tile_column_index;
86  int maxrank;
87  double tol;
88 
89  AUV = (double *)STARPU_MATRIX_GET_PTR(descr[0]);
90  Ark = (double *)STARPU_MATRIX_GET_PTR(descr[1]);
91 
92 
93  starpu_codelet_unpack_args(cl_arg, &m, &n, &nAUV, &ldu, &ldv, &tile_row_index, &tile_column_index, &maxrank, &tol);
94 
95  double *AU = AUV;
96  int nAU = nAUV/2;
97  assert(ldu == ldv);
98  size_t nelm_AU = (size_t)ldu * (size_t)nAU;
99  double *AV = &(AUV[nelm_AU]);
100 
101  //printf("(%d,%d)%d %s %d %d\n", m0/m,n0/n,MORSE_My_Mpi_Rank(), __func__, __LINE__, AD == Dense);
102  HCORE_zhagcm( m, n,
103  AU,
104  AV,
105  Ark,
106  ldu,
107  ldv,
108  tile_row_index, tile_column_index,
109  maxrank, tol
110  );
111 }
112 #endif /* !defined(CHAMELEON_SIMULATION) */
113 
114 /*
115  * Codelet definition
116  */
117 CODELETS_CPU(zhagcm, 2, cl_zhagcm_cpu_func)
#define AUV(m, n)
Definition: pzgemm.c:60
void HCORE_zhagcm(int m, int n, double *AU, double *AV, double *Ark, int ldu, int ldv, int tile_row_index, int tile_column_index, int maxrank, double tol)
Definition: hcore_zhagcm.c:37
void HICMA_TASK_zhagcm(const MORSE_option_t *options, int m, int n, const MORSE_desc_t *AUV, const MORSE_desc_t *Ark, int Am, int An, int ldu, int ldv, int maxrank, double tol)