HiCMA
Hierarchical Computations on Manycore Architectures
codelet_zgytlr_diag.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(gytlrdiag)
23 
24 
25 //CHAMELEON_CL_CB(zgytlr, starpu_matrix_get_nx(task->handles[0]), starpu_matrix_get_ny(task->handles[0]), 0, M*N)
26 /* MORSE_TASK_zgytlr - Generate a tile for random matrix. */
27 
28 void HICMA_TASK_zgytlr_diag( const MORSE_option_t *options,
29  int m, int n,
30  const MORSE_desc_t *AUV,
31  const MORSE_desc_t *AD, int ADm, int ADn,
32  const MORSE_desc_t *Ark,
33  int Am, int An,
34  int lda,
35  int ldu,
36  int ldv,
37  int bigM, int m0, int n0, unsigned long long int seed,
38  int maxrank, double tol,
39  int compress_diag,
40  const MORSE_desc_t *Dense
41  )
42 {
43  struct starpu_codelet *codelet = &cl_zgytlrdiag;
44  //void (*callback)(void*) = options->profiling ? cl_zgytlr_callback : NULL;
45  void (*callback)(void*) = NULL;
46  int nAUV = AUV->nb;
47 
48  MORSE_BEGIN_ACCESS_DECLARATION;
49  MORSE_ACCESS_W(AUV, Am, An);
50  MORSE_ACCESS_W(AD, ADm, ADn);
51  MORSE_ACCESS_W(Dense, Am, An);
52  MORSE_ACCESS_W(Ark, Am, An);
53  MORSE_END_ACCESS_DECLARATION;
54 
55  // printf("%s:%d: Am:%d An:%d lda:%d bigM:%d m0:%d n0:%d\n ", __FILE__, __LINE__, Am, An, lda, bigM, m0, n0);
56 
57  //printf("%s %d: Am:%d An:%d ADm:%d ADn:%d ptr:%p\n", __func__, __LINE__, Am, An, ADm, ADn, ptr);
58  starpu_insert_task(
59  starpu_mpi_codelet(codelet),
60  STARPU_VALUE, &m, sizeof(int),
61  STARPU_VALUE, &n, sizeof(int),
62  STARPU_VALUE, &nAUV, sizeof(int),
63  STARPU_W, RTBLKADDR(AUV, double, Am, An),
64  STARPU_W, RTBLKADDR(AD, double, ADm, ADn),
65  STARPU_W, RTBLKADDR(Ark, double, Am, An),
66  STARPU_R, RTBLKADDR(Dense, double, Am, An), // _R must be _W SERIOUSLY. BUT _W STALLS ON SHAHEEN. FIXME
67  STARPU_VALUE, &lda, sizeof(int),
68  STARPU_VALUE, &ldu, sizeof(int),
69  STARPU_VALUE, &ldv, sizeof(int),
70  STARPU_VALUE, &bigM, sizeof(int),
71  STARPU_VALUE, &Am, sizeof(int),
72  STARPU_VALUE, &An, sizeof(int),
73  STARPU_VALUE, &seed, sizeof(unsigned long long int),
74  STARPU_VALUE, &maxrank, sizeof(int),
75  STARPU_VALUE, &tol, sizeof(double),
76  STARPU_VALUE, &compress_diag, sizeof(int),
77  STARPU_PRIORITY, options->priority,
78  STARPU_CALLBACK, callback,
79 #if defined(CHAMELEON_CODELETS_HAVE_NAME)
80  STARPU_NAME, "hcore_zgytlr_diag",
81 #endif
82  0);
83 }
84 
85 /* cl_zgytlr_cpu_func - Generate a tile for random matrix. */
86 
87 #if !defined(CHAMELEON_SIMULATION)
88 static void cl_zgytlr_cpu_func(void *descr[], void *cl_arg)
89 {
90  int m;
91  int n;
92  int nAUV;
93  double *AUV;
94  double *AD;
95  double *Ark;
96  double *Dense;
97  int lda;
98  int ldu;
99  int ldv;
100  int bigM;
101  int m0;
102  int n0;
103  unsigned long long int seed;
104  int maxrank;
105  double tol;
106  int compress_diag;
107 
108  AUV = (double *)STARPU_MATRIX_GET_PTR(descr[0]);
109  AD = (double *)STARPU_MATRIX_GET_PTR(descr[1]);
110  Ark = (double *)STARPU_MATRIX_GET_PTR(descr[2]);
111  Dense = (double *)STARPU_MATRIX_GET_PTR(descr[3]);
112 
113 
114  starpu_codelet_unpack_args(cl_arg, &m, &n, &nAUV, &lda, &ldu, &ldv, &bigM, &m0, &n0, &seed, &maxrank, &tol, &compress_diag );
115 
116  double *AU = AUV;
117  int nAU = nAUV/2;
118  size_t nelm_AU = (size_t)lda * (size_t)nAU;
119  double *AV = &(AUV[nelm_AU]);
120 
121  //printf("(%d,%d)%d %s %d %d\n", m0/m,n0/n,MORSE_My_Mpi_Rank(), __func__, __LINE__, AD == Dense);
122  HCORE_zgytlr( m, n,
123  AU,
124  AV,
125  AD,
126  Ark,
127  lda, ldu, ldv,
128  bigM, m0, n0, seed,
129  maxrank, tol,
130  compress_diag,
131  Dense
132  );
133 }
134 #endif /* !defined(CHAMELEON_SIMULATION) */
135 
136 /*
137  * Codelet definition
138  */
139 CODELETS_CPU(zgytlrdiag, 4, cl_zgytlr_cpu_func)
#define AUV(m, n)
Definition: pzgemm.c:60
void HCORE_zgytlr(int m, int n, double *AU, double *AV, double *AD, double *Ark, int lda, int ldu, int ldv, int bigM, int ii, int jj, unsigned long long int seed, int maxrank, double tol, int compress_diag, double *Dense)
Definition: hcore_zgytlr.c:51
void HICMA_TASK_zgytlr_diag(const MORSE_option_t *options, int m, int n, const MORSE_desc_t *AUV, const MORSE_desc_t *AD, int ADm, int ADn, const MORSE_desc_t *Ark, int Am, int An, int lda, int ldu, int ldv, int bigM, int m0, int n0, unsigned long long int seed, int maxrank, double tol, int compress_diag, const MORSE_desc_t *Dense)