PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
codelet_solve_zdiag.c
Go to the documentation of this file.
1/**
2 *
3 * @file codelet_solve_zdiag.c
4 *
5 * StarPU codelets for diag functions.
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 * @author Alycia Lisito
15 * @author Nolan Bredel
16 * @author Tom Moenne-Loccoz
17 * @date 2024-07-05
18 *
19 * @generated from /builds/2mk6rsew/0/solverstack/pastix/sopalin/starpu/codelet_solve_zdiag.c, normal z -> z, Tue Feb 25 14:35:24 2025
20 *
21 * @addtogroup starpu_diag_solve
22 * @{
23 *
24 **/
25#ifndef DOXYGEN_SHOULD_SKIP_THIS
26#define _GNU_SOURCE
27#endif /* DOXYGEN_SHOULD_SKIP_THIS */
28#include "common.h"
29#include "blend/solver.h"
30#include "sopalin/sopalin_data.h"
31#include "pastix_zcores.h"
32#include "pastix_starpu.h"
33#include "pastix_zstarpu.h"
34#include "codelets.h"
35
36#if defined( PASTIX_STARPU_PROFILING )
37/**
38 * @brief Cblk version
39 */
40starpu_profile_t solve_cblk_zdiag_profile = {
41 .next = NULL,
42 .name = "solve_cblk_zdiag"
43};
44
45/**
46 * @brief Profiling registration function
47 */
48void solve_cblk_zdiag_profile_register( void ) __attribute__( ( constructor ) );
49void
50solve_cblk_zdiag_profile_register( void )
51{
52 profiling_register_cl( &solve_cblk_zdiag_profile );
53}
54#endif
55
56#ifndef DOXYGEN_SHOULD_SKIP_THIS
57struct cl_solve_cblk_zdiag_args_s {
58 profile_data_t profile_data;
59 SolverCblk *cblk;
60};
61
62static struct starpu_perfmodel starpu_solve_cblk_zdiag_model = {
63 .type = STARPU_HISTORY_BASED,
64 .symbol = "solve_cblk_zdiag",
65};
66
67#if !defined(PASTIX_STARPU_SIMULATION)
68static void
69fct_solve_cblk_zdiag_cpu( void *descr[], void *cl_arg )
70{
71 struct cl_solve_cblk_zdiag_args_s *args = (struct cl_solve_cblk_zdiag_args_s *) cl_arg;
72 void *A;
73 int nrhs;
74 pastix_complex64_t *b;
75 int ldb;
76
77 A = pastix_starpu_cblk_get_ptr( descr[0] );
78 b = (pastix_complex64_t *)STARPU_MATRIX_GET_PTR( descr[1] );
79 ldb = (int)STARPU_MATRIX_GET_LD( descr[1] );
80 nrhs = (int)STARPU_MATRIX_GET_NY( descr[1] );
81
82 solve_cblk_zdiag( args->cblk, A, nrhs, b, ldb, NULL );
83}
84#endif /* !defined(PASTIX_STARPU_SIMULATION) */
85
86CODELETS_CPU( solve_cblk_zdiag, 2 );
87#endif /* DOXYGEN_SHOULD_SKIP_THIS */
88
89/**
90 *******************************************************************************
91 *
92 * @brief Submit a task to perform a diagonal solve related to one cblk
93 * to all the right hand side.
94 *
95 *******************************************************************************
96 *
97 * @param[inout] sopalin_data
98 * The structure providing descriptor about b and the A matrix.
99 *
100 * @param[inout] rhsb
101 * The pointer to the rhs data structure that holds the vectors of the
102 * right hand side.
103 *
104 * @param[in] cblk
105 * The cblk structure to which diagonal block belongs to.
106 *
107 * @param[in] prio
108 * The priority of the task in the DAG.
109 *
110 *******************************************************************************/
111void
112starpu_stask_cblk_zdiag( sopalin_data_t *sopalin_data,
113 pastix_rhs_t rhsb,
114 SolverCblk *cblk,
115 int prio )
116{
117 struct cl_solve_cblk_zdiag_args_s *cl_arg;
118 starpu_data_handle_t handle;
119 SolverMatrix *solvmtx = sopalin_data->solvmtx;
120 pastix_int_t cblknum = cblk - solvmtx->cblktab;
121#if defined(PASTIX_DEBUG_STARPU)
122 char *task_name;
123#endif
124
125 /*
126 * Check if it needs to be submitted
127 */
128#if defined(PASTIX_WITH_MPI)
129 {
130 int need_submit = 0;
131 if ( cblk->ownerid == sopalin_data->solvmtx->clustnum ) {
132 need_submit = 1;
133 }
134 if ( starpu_mpi_cached_receive( rhsb->starpu_desc->handletab[cblknum] ) ) {
135 need_submit = 1;
136 }
137 if ( !need_submit ) {
138 return;
139 }
140 }
141#endif
142
143 /*
144 * Create the arguments array
145 */
146 cl_arg = malloc( sizeof(struct cl_solve_cblk_zdiag_args_s) );
147#if defined(PASTIX_STARPU_PROFILING)
148 cl_arg->profile_data.measures = solve_cblk_zdiag_profile.measures;
149 cl_arg->profile_data.flops = NAN;
150#endif
151 cl_arg->cblk = cblk;
152
153#if defined(PASTIX_DEBUG_STARPU)
154 asprintf( &task_name, "%s( %ld )",
155 cl_solve_cblk_zdiag_cpu.name,
156 (long)cblknum );
157#endif
158
159 handle = cblk->handler[0];
160
161 pastix_starpu_insert_task(
162 &cl_solve_cblk_zdiag_cpu,
163 STARPU_CL_ARGS, cl_arg, sizeof( struct cl_solve_cblk_zdiag_args_s ),
164#if defined(PASTIX_STARPU_PROFILING)
165 STARPU_CALLBACK_WITH_ARG_NFREE, cl_profiling_callback, cl_arg,
166#endif
167 STARPU_R, handle,
168 STARPU_RW, rhsb->starpu_desc->handletab[cblknum],
169#if defined(PASTIX_DEBUG_STARPU)
170 STARPU_NAME, task_name,
171#endif
172#if defined(PASTIX_STARPU_HETEROPRIO)
173 STARPU_PRIORITY, BucketSolveDiag,
174#endif
175 0);
176 (void)prio;
177}
178/**
179 * @}
180 */
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
void solve_cblk_zdiag(const SolverCblk *cblk, const void *dataA, int nrhs, pastix_complex64_t *b, int ldb, pastix_complex64_t *work)
Apply the diagonal solve related to one cblk to all the right hand side.
Base structure to all codelet arguments that include the profiling data.
Main PaStiX RHS structure.
Definition pastixdata.h:155
void starpu_stask_cblk_zdiag(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.
SolverCblk *restrict cblktab
Definition solver.h:228
void * handler[2]
Definition solver.h:179
Solver column block structure.
Definition solver.h:161
Solver column block structure.
Definition solver.h:203