PaStiX Handbook  6.3.1
starpu_zdiag.c
Go to the documentation of this file.
1 /**
2  *
3  * @file starpu_zdiag.c
4  *
5  * PaStiX zdiag 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 Vincent Bridonneau
12  * @author Mathieu Faverge
13  * @author Pierre Ramet
14  * @date 2023-07-21
15  * @generated from /builds/solverstack/pastix/sopalin/starpu/starpu_zdiag.c, normal z -> z, Thu Nov 23 09:56:00 2023
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_zcores.h"
26 #include "pastix_starpu.h"
27 #include "pastix_zstarpu.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  *******************************************************************************/
44 void
46  sopalin_data_t *sopalin_data )
47 {
48  SolverMatrix *datacode = sopalin_data->solvmtx;
49  SolverCblk *cblk;
50  pastix_int_t k, cblknbr;
51  pastix_solv_mode_t mode = pastix_data->iparm[IPARM_SCHUR_SOLV_MODE];
52 
53  cblk = datacode->cblktab;
54  cblknbr = (mode == PastixSolvModeSchur) ? datacode->cblknbr : datacode->cblkschur;
55  for (k=0; k<cblknbr; k++, cblk++) {
56  if ( cblk->ownerid != datacode->clustnum ) {
57  continue;
58  }
59  starpu_stask_cblk_zdiag( sopalin_data, cblk, cblknbr - k );
60  }
61 }
62 
63 /**
64  *******************************************************************************
65  *
66  * @brief Apply the diagonal solve (StarPU version)
67  *
68  *******************************************************************************
69  *
70  * @param[in] pastix_data
71  * Provide informations about starpu and the schur solving mode.
72  *
73  * @param[in] sopalin_data
74  * Provide descriptor of b and the sparse matrix and the SolverMatrix
75  * structure.
76  *
77  * @param[in] nrhs
78  * The number of right hand side
79  *
80  * @param[inout] b
81  * The pointer to vectors of the right hand side
82  *
83  * @param[in] ldb
84  * The leading dimension of b
85  *
86  *******************************************************************************/
87 void
89  sopalin_data_t *sopalin_data,
90  int nrhs,
91  pastix_complex64_t *b,
92  int ldb )
93 {
94  starpu_sparse_matrix_desc_t *sdesc = sopalin_data->solvmtx->starpu_desc;
96 
97  /*
98  * Start StarPU if not already started
99  */
100  if (pastix_data->starpu == NULL) {
101  int argc = 0;
102  pastix_starpu_init( pastix_data, &argc, NULL, NULL );
103  }
104 
105  if ( sdesc == NULL ) {
106  /* Create the sparse matrix descriptor */
107  starpu_sparse_matrix_init( sopalin_data->solvmtx,
109  pastix_data->inter_node_procnbr,
110  pastix_data->inter_node_procnum,
111  PastixComplex64 );
112  sdesc = sopalin_data->solvmtx->starpu_desc;
113  }
114 
115  /* Create the dense matrix descriptor */
116  starpu_dense_matrix_init( sopalin_data->solvmtx,
117  nrhs, (char*)b, ldb,
118  sizeof(pastix_complex64_t),
119  pastix_data->inter_node_procnbr,
120  pastix_data->inter_node_procnum );
121  ddesc = sopalin_data->solvmtx->starpu_desc_rhs;
122 
123 #if defined(STARPU_USE_FXT)
124  if (pastix_data->iparm[IPARM_TRACE] & PastixTraceSolve) {
125  starpu_fxt_start_profiling();
126  }
127 #endif
128  starpu_resume();
129  starpu_zdiag_sp1dplus( pastix_data, sopalin_data );
130 
133  starpu_task_wait_for_all();
134 #if defined(PASTIX_WITH_MPI)
135  starpu_mpi_wait_for_all( pastix_data->pastix_comm );
136  starpu_mpi_barrier(pastix_data->inter_node_comm);
137 #endif
138  starpu_pause();
139 #if defined(STARPU_USE_FXT)
140  if (pastix_data->iparm[IPARM_TRACE] & PastixTraceSolve) {
141  starpu_fxt_stop_profiling();
142  }
143 #endif
144 
145  return;
146 }
147 
148 /**
149  *@}
150  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
enum pastix_solv_mode_e pastix_solv_mode_t
Solve Schur modes.
#define PastixHermitian
Definition: api.h:460
@ IPARM_SCHUR_SOLV_MODE
Definition: api.h:107
@ IPARM_TRACE
Definition: api.h:44
@ PastixTraceSolve
Definition: api.h:212
void starpu_dense_matrix_init(SolverMatrix *solvmtx, pastix_int_t ncol, char *A, pastix_int_t lda, int typesze, int nodes, int myrank)
Generate the StarPU descriptor of the dense matrix.
void starpu_sparse_matrix_getoncpu(starpu_sparse_matrix_desc_t *desc)
Submit asynchronous calls to retrieve the data on main memory.
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
void starpu_dense_matrix_getoncpu(starpu_dense_matrix_desc_t *desc)
Submit asynchronous calls to retrieve the data on main memory.
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:75
int inter_node_procnum
Definition: pastixdata.h:83
int inter_node_procnbr
Definition: pastixdata.h:82
void * starpu
Definition: pastixdata.h:87
pastix_int_t * iparm
Definition: pastixdata.h:69
PASTIX_Comm inter_node_comm
Definition: pastixdata.h:77
Main PaStiX data structure.
Definition: pastixdata.h:67
void starpu_zdiag_sp1dplus(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
Apply the diagonal solve on a problem of 1 dimension.
Definition: starpu_zdiag.c:45
void starpu_stask_cblk_zdiag(sopalin_data_t *sopalin_data, SolverCblk *cblk, int prio)
Submit a task to perform a diagonal solve related to one cblk to all the right hand side.
void starpu_zdiag(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data, int nrhs, pastix_complex64_t *b, int ldb)
Apply the diagonal solve (StarPU version)
Definition: starpu_zdiag.c:88
pastix_int_t cblknbr
Definition: solver.h:208
SolverCblk *restrict cblktab
Definition: solver.h:222
int ownerid
Definition: solver.h:175
pastix_int_t cblkschur
Definition: solver.h:217
Solver column block structure.
Definition: solver.h:156
Solver column block structure.
Definition: solver.h:200