PaStiX Handbook  6.3.2
starpu_task_sadd.c
Go to the documentation of this file.
1 /**
2  *
3  * @file starpu_task_sadd.c
4  *
5  * PaStiX zadd StarPU wrapper.
6  *
7  * @copyright 2016-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.1
11  * @author Mathieu Faverge
12  * @author Alycia Lisito
13  * @date 2023-12-01
14  * @generated from /builds/solverstack/pastix/sopalin/starpu/starpu_task_zadd.c, normal z -> s, Wed Dec 13 12:09:29 2023
15  *
16  **/
17 
18 #include "common.h"
19 #include "blend/solver.h"
20 #include "sopalin/sopalin_data.h"
21 #include "pastix_scores.h"
22 #include "pastix_starpu.h"
23 #include "pastix_sstarpu.h"
24 
25 /**
26  *******************************************************************************
27  *
28  * @brief Submits starpu zadd task to send the fanin cblk.
29  *
30  *******************************************************************************
31  *
32  * @param[in] sopalin_data
33  * Solver matrix information structure that will guide the algorithm.
34  *
35  * @param[in] side
36  * The side of the update.
37  *
38  * @param[in] cblk
39  * The fanin column block.
40  *
41  * @param[in] prio
42  * The task priority.
43  *
44  *******************************************************************************/
45 void
46 starpu_task_sadd_1dp_fanin( sopalin_data_t *sopalin_data,
47  pastix_coefside_t side,
48  const SolverCblk *cblk,
49  int prio )
50 {
51  /* If this is a fanin, let's submit the send */
52  assert( cblk->cblktype & CBLK_FANIN );
53  starpu_task_cblk_sadd_fanin( sopalin_data, side, cblk, prio );
54 }
55 
56 /**
57  *******************************************************************************
58  *
59  * @brief Submits starpu zadd task to receive and add the recv cblk.
60  *
61  *******************************************************************************
62  *
63  * @param[in] sopalin_data
64  * Solver matrix information structure that will guide the algorithm.
65  *
66  * @param[in] side
67  * The side of the update.
68  *
69  * @param[in] cblk
70  * The recv column block.
71  *
72  * @param[in] prio
73  * The task priority.
74  *
75  *******************************************************************************/
76 void
77 starpu_task_sadd_1dp_recv( sopalin_data_t *sopalin_data,
78  pastix_coefside_t side,
79  const SolverCblk *cblk,
80  int prio )
81 {
82  SolverCblk *fcblk = sopalin_data->solvmtx->cblktab + cblk->fblokptr->fcblknm;
83 
84  assert( cblk->cblktype & CBLK_RECV );
85  starpu_task_cblk_sadd_recv( sopalin_data, side, cblk, fcblk, prio );
86 }
87 
88 /**
89  *******************************************************************************
90  *
91  * @brief Submits starpu zadd task to send the fanin block.
92  *
93  *******************************************************************************
94  *
95  * @param[in] sopalin_data
96  * Solver matrix information structure that will guide the algorithm.
97  *
98  * @param[in] side
99  * The side of the update.
100  *
101  * @param[in] cblk
102  * The fanin column block.
103  *
104  * @param[in] prio
105  * The task priority.
106  *
107  *******************************************************************************/
108 void
109 starpu_task_sadd_2d_fanin( sopalin_data_t *sopalin_data,
110  pastix_coefside_t side,
111  const SolverCblk *cblk,
112  int prio )
113 {
114  const SolverBlok *blok = cblk[0].fblokptr;
115  const SolverBlok *lblk = cblk[1].fblokptr;
116 
117  assert( cblk->cblktype & CBLK_FANIN );
118 
119  for ( ; blok < lblk; blok++ ) {
120 
121  starpu_task_blok_sadd_fanin( sopalin_data, side, cblk, blok, prio );
122 
123  /* Skip blocks facing the same cblk */
124  while ( ( blok < lblk ) &&
125  ( blok[0].fcblknm == blok[1].fcblknm ) &&
126  ( blok[0].lcblknm == blok[1].lcblknm ) )
127  {
128  blok++;
129  }
130  }
131 }
132 
133 /**
134  *******************************************************************************
135  *
136  * @brief Submits starpu zadd task to receive and add the recv block.
137  *
138  *******************************************************************************
139  *
140  * @param[in] sopalin_data
141  * Solver matrix information structure that will guide the algorithm.
142  *
143  * @param[in] side
144  * The side of the update.
145  *
146  * @param[in] cblk
147  * The recv column block.
148  *
149  * @param[in] prio
150  * The task priority.
151  *
152  *******************************************************************************/
153 void
154 starpu_task_sadd_2d_recv( sopalin_data_t *sopalin_data,
155  pastix_coefside_t side,
156  const SolverCblk *cblk,
157  int prio )
158 {
159  const SolverBlok *blok = cblk[0].fblokptr;
160  const SolverBlok *lblk = cblk[1].fblokptr;
161  SolverCblk *fcblk = sopalin_data->solvmtx->cblktab + cblk->fblokptr->fcblknm;
162  SolverBlok *fblok = fcblk[0].fblokptr;
163  SolverBlok *lfblok = fcblk[1].fblokptr;
164 
165  assert( cblk->cblktype & CBLK_RECV );
166 
167  for ( ; blok < lblk; blok++ ) {
168  while ( (blok->fcblknm != fblok->fcblknm) && (fblok < lfblok) ) {
169  fblok++;
170  }
171  assert( fblok->lcblknm == cblk->fblokptr->fcblknm );
172  starpu_task_blok_sadd_recv( sopalin_data, side, cblk, blok, fcblk, fblok, prio );
173 
174  /* Skip blocks facing the same cblk */
175  while ( ( blok < lblk ) &&
176  ( blok[0].fcblknm == blok[1].fcblknm ) &&
177  ( blok[0].lcblknm == blok[1].lcblknm ) )
178  {
179  blok++;
180  }
181  }
182 }
183 
184 /**
185  *******************************************************************************
186  *
187  * @brief Submits starpu zadd task to send the recv cblk.
188  *
189  *******************************************************************************
190  *
191  * @param[in] sopalin_data
192  * Solver matrix information structure that will guide the algorithm.
193  *
194  * @param[in] side
195  * The side of the update.
196  *
197  * @param[in] cblk
198  * The recv column block.
199  *
200  * @param[in] prio
201  * The task priority.
202  *
203  *******************************************************************************/
204 void
205 starpu_task_sadd_recv( sopalin_data_t *sopalin_data,
206  pastix_coefside_t side,
207  const SolverCblk *cblk,
208  int prio )
209 {
210  if ( cblk->cblktype & CBLK_TASKS_2D ) {
211  starpu_task_sadd_2d_recv( sopalin_data, side, cblk, prio );
212  return;
213  }
214  else {
215  starpu_task_sadd_1dp_recv( sopalin_data, side, cblk, prio );
216  return;
217  }
218 }
219 
220 /**
221  *******************************************************************************
222  *
223  * @brief Submits starpu zadd task to send the fanin cblk.
224  *
225  *******************************************************************************
226  *
227  * @param[in] sopalin_data
228  * Solver matrix information structure that will guide the algorithm.
229  *
230  * @param[in] side
231  * The side of the update.
232  *
233  * @param[in] cblk
234  * The fanin column block.
235  *
236  * @param[in] prio
237  * The task priority.
238  *
239  *******************************************************************************/
240 void
241 starpu_task_sadd_fanin( sopalin_data_t *sopalin_data,
242  pastix_coefside_t side,
243  const SolverCblk *cblk,
244  int prio )
245 {
246  if ( cblk->cblktype & CBLK_TASKS_2D ) {
247  starpu_task_sadd_2d_fanin( sopalin_data, side, cblk, prio );
248  return;
249  }
250  else {
251  starpu_task_sadd_1dp_fanin( sopalin_data, side, cblk, prio );
252  return;
253  }
254 }
enum pastix_coefside_e pastix_coefside_t
Data blocks used in the kernel.
void starpu_task_blok_sadd_fanin(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, const SolverBlok *blok, int prio)
Insert the task to add a fanin cblk on the emitter side. Note that this task is submitted only to emi...
void starpu_task_blok_sadd_recv(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, const SolverBlok *blok, SolverCblk *fcblk, SolverBlok *fblok, int prio)
Insert the task to add a fanin cblk on the receiver side (The fanin is seen on this side as the RECV ...
void starpu_task_cblk_sadd_fanin(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Insert the task to add a fanin cblk on the emitter side. Note that this task is submitted only to emi...
void starpu_task_cblk_sadd_recv(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, SolverCblk *fcblk, int prio)
Insert the task to add a fanin cblk on the receiver side (The fanin is seen on this side as the RECV ...
pastix_int_t fcblknm
Definition: solver.h:140
SolverBlok * fblokptr
Definition: solver.h:163
pastix_int_t lcblknm
Definition: solver.h:139
int8_t cblktype
Definition: solver.h:159
Solver block structure.
Definition: solver.h:137
Solver column block structure.
Definition: solver.h:156
void starpu_task_sadd_1dp_recv(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Submits starpu zadd task to receive and add the recv cblk.
void starpu_task_sadd_1dp_fanin(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Submits starpu zadd task to send the fanin cblk.
void starpu_task_sadd_fanin(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Submits starpu zadd task to send the fanin cblk.
void starpu_task_sadd_recv(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Submits starpu zadd task to send the recv cblk.
void starpu_task_sadd_2d_fanin(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Submits starpu zadd task to send the fanin block.
void starpu_task_sadd_2d_recv(sopalin_data_t *sopalin_data, pastix_coefside_t side, const SolverCblk *cblk, int prio)
Submits starpu zadd task to receive and add the recv block.