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