PaStiX Handbook  6.4.0
starpu_ddiag.c
Go to the documentation of this file.
1 /**
2  *
3  * @file starpu_ddiag.c
4  *
5  * PaStiX ddiag StarPU wrapper.
6  *
7  * @copyright 2016-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.4.0
11  * @author Vincent Bridonneau
12  * @author Mathieu Faverge
13  * @author Pierre Ramet
14  * @date 2024-07-05
15  * @generated from /builds/solverstack/pastix/sopalin/starpu/starpu_zdiag.c, normal z -> d, Tue Oct 8 14:17:37 2024
16  *
17  * @addtogroup starpu_diag_solve
18  * @{
19  *
20  **/
21 
22 #include "common.h"
23 #include "blend/solver.h"
24 #include "sopalin/sopalin_data.h"
25 #include "pastix_dcores.h"
26 #include "pastix_starpu.h"
27 #include "pastix_dstarpu.h"
28 
29 /**
30  *******************************************************************************
31  *
32  * @brief Apply the diagonal solve on a problem of 1 dimension.
33  *
34  *******************************************************************************
35  *
36  * @param[in] pastix_data
37  * Provide informations about starpu and the schur solving mode.
38  *
39  * @param[in] sopalin_data
40  * Provide descriptor of b and the sparse matrix and the SolverMatrix
41  * structure.
42  *
43  * @param[inout] rhsb
44  * The pointer to the rhs data structure that holds the vectors of the
45  * right hand side.
46  *
47  *******************************************************************************/
48 void
50  sopalin_data_t *sopalin_data,
51  pastix_rhs_t rhsb )
52 {
53  SolverMatrix *datacode = sopalin_data->solvmtx;
54  SolverCblk *cblk;
55  pastix_int_t k, cblknbr;
56  pastix_solv_mode_t mode = pastix_data->iparm[IPARM_SCHUR_SOLV_MODE];
57 
58  cblk = datacode->cblktab;
59  cblknbr = (mode == PastixSolvModeSchur) ? datacode->cblknbr : datacode->cblkschur;
60  for (k=0; k<cblknbr; k++, cblk++) {
61  if ( cblk->ownerid != datacode->clustnum ) {
62  continue;
63  }
64  starpu_stask_cblk_ddiag( sopalin_data, rhsb, cblk, cblknbr - k );
65  }
66 }
67 
68 /**
69  *******************************************************************************
70  *
71  * @brief Apply the diagonal solve (StarPU version)
72  *
73  *******************************************************************************
74  *
75  * @param[in] pastix_data
76  * Provide informations about starpu and the schur solving mode.
77  *
78  * @param[in] sopalin_data
79  * Provide descriptor of b and the sparse matrix and the SolverMatrix
80  * structure.
81  *
82  * @param[inout] rhsb
83  * The pointer to the rhs data structure that holds the vectors of the
84  * right hand side.
85  *
86  *******************************************************************************/
87 void
89  sopalin_data_t *sopalin_data,
90  pastix_rhs_t rhsb )
91 {
92  starpu_sparse_matrix_desc_t *sdesc = sopalin_data->solvmtx->starpu_desc;
93  starpu_rhs_desc_t *ddesc = rhsb->starpu_desc;
94 
95  /*
96  * Start StarPU if not already started
97  */
98  if (pastix_data->starpu == NULL) {
99  int argc = 0;
100  pastix_starpu_init( pastix_data, &argc, NULL, NULL );
101  }
102 
103  if ( sdesc == NULL ) {
104  /* Create the sparse matrix descriptor */
105  starpu_sparse_matrix_init( sopalin_data->solvmtx,
107  pastix_data->inter_node_procnbr,
108  pastix_data->inter_node_procnum,
109  PastixDouble );
110  sdesc = sopalin_data->solvmtx->starpu_desc;
111  }
112 
113  if ( ddesc == NULL ) {
114  /* Create the dense matrix descriptor */
115  starpu_rhs_init( pastix_data->solvmatr, rhsb,
116  PastixDouble,
117  pastix_data->inter_node_procnbr,
118  pastix_data->inter_node_procnum );
119  ddesc = rhsb->starpu_desc;
120  }
121 
122 #if defined(STARPU_USE_FXT)
123  if (pastix_data->iparm[IPARM_TRACE] & PastixTraceSolve) {
124  starpu_fxt_start_profiling();
125  }
126 #endif
127  starpu_resume();
128  starpu_ddiag_sp1dplus( pastix_data, sopalin_data, rhsb );
129 
131  starpu_rhs_getoncpu( ddesc );
132  starpu_task_wait_for_all();
133 #if defined(PASTIX_WITH_MPI)
134  starpu_mpi_wait_for_all( pastix_data->pastix_comm );
135  starpu_mpi_barrier(pastix_data->inter_node_comm);
136 #endif
137  starpu_pause();
138 #if defined(STARPU_USE_FXT)
139  if (pastix_data->iparm[IPARM_TRACE] & PastixTraceSolve) {
140  starpu_fxt_stop_profiling();
141  }
142 #endif
143 
144  return;
145 }
146 
147 /**
148  *@}
149  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
#define PastixSymmetric
Definition: api.h:459
enum pastix_solv_mode_e pastix_solv_mode_t
Solve Schur modes.
@ IPARM_SCHUR_SOLV_MODE
Definition: api.h:107
@ IPARM_TRACE
Definition: api.h:44
@ PastixTraceSolve
Definition: api.h:212
void starpu_sparse_matrix_getoncpu(starpu_sparse_matrix_desc_t *desc)
Submit asynchronous calls to retrieve the data on main memory.
void starpu_rhs_getoncpu(starpu_rhs_desc_t *desc)
Submit asynchronous calls to retrieve the data on main memory.
Definition: starpu_rhs.c:216
void starpu_rhs_init(SolverMatrix *solvmtx, pastix_rhs_t rhsb, int typesze, int nodes, int myrank)
Generate the StarPU descriptor of the dense matrix.
Definition: starpu_rhs.c:152
void starpu_sparse_matrix_init(SolverMatrix *solvmtx, pastix_mtxtype_t mtxtype, int nodes, int myrank, pastix_coeftype_t flttype)
Generate the StarPU descriptor of the sparse matrix.
void pastix_starpu_init(pastix_data_t *pastix, int *argc, char **argv[], const int *bindtab)
Startup the StarPU runtime system.
Definition: starpu.c:92
StarPU descriptor for the vectors linked to a given sparse matrix.
StarPU descriptor stucture for the sparse matrix.
PASTIX_Comm pastix_comm
Definition: pastixdata.h:76
int inter_node_procnum
Definition: pastixdata.h:84
SolverMatrix * solvmatr
Definition: pastixdata.h:103
int inter_node_procnbr
Definition: pastixdata.h:83
void * starpu
Definition: pastixdata.h:88
pastix_int_t * iparm
Definition: pastixdata.h:70
PASTIX_Comm inter_node_comm
Definition: pastixdata.h:78
Main PaStiX data structure.
Definition: pastixdata.h:68
Main PaStiX RHS structure.
Definition: pastixdata.h:155
void starpu_stask_cblk_ddiag(sopalin_data_t *sopalin_data, pastix_rhs_t rhsb, SolverCblk *cblk, int prio)
Submit a task to perform a diagonal solve related to one cblk to all the right hand side.
void starpu_ddiag_sp1dplus(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data, pastix_rhs_t rhsb)
Apply the diagonal solve on a problem of 1 dimension.
Definition: starpu_ddiag.c:49
void starpu_ddiag(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data, pastix_rhs_t rhsb)
Apply the diagonal solve (StarPU version)
Definition: starpu_ddiag.c:88
pastix_int_t cblknbr
Definition: solver.h:211
SolverCblk *restrict cblktab
Definition: solver.h:228
int ownerid
Definition: solver.h:181
pastix_int_t cblkschur
Definition: solver.h:221
Solver column block structure.
Definition: solver.h:161
Solver column block structure.
Definition: solver.h:203