PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
codelet_solve_ctrsm.c
Go to the documentation of this file.
1/**
2 *
3 * @file codelet_solve_ctrsm.c
4 *
5 * StarPU codelet for TRSM function
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 *
16 * @generated from /builds/2mk6rsew/0/solverstack/pastix/sopalin/starpu/codelet_solve_ztrsm.c, normal z -> c, Tue Feb 25 14:35:23 2025
17 *
18 * @addtogroup starpu_trsm_solve
19 * @{
20 *
21 **/
22#ifndef DOXYGEN_SHOULD_SKIP_THIS
23#define _GNU_SOURCE
24#endif /* DOXYGEN_SHOULD_SKIP_THIS */
25#include "common.h"
26#include "blend/solver.h"
27#include "sopalin/sopalin_data.h"
28#include "pastix_ccores.h"
29#include "pastix_starpu.h"
30#include "pastix_cstarpu.h"
31#include "codelets.h"
32
33#if defined( PASTIX_STARPU_PROFILING )
34/**
35 * @brief Block version
36 */
37starpu_profile_t solve_blok_ctrsm_profile = {
38 .next = NULL,
39 .name = "solve_blok_ctrsm"
40};
41
42/**
43 * @brief Profiling registration function
44 */
45void solve_blok_ctrsm_profile_register( void ) __attribute__( ( constructor ) );
46void
47solve_blok_ctrsm_profile_register( void )
48{
49 profiling_register_cl( &solve_blok_ctrsm_profile );
50}
51#endif
52
53#ifndef DOXYGEN_SHOULD_SKIP_THIS
54struct cl_solve_blok_ctrsm_args_s {
55 profile_data_t profile_data;
56 pastix_side_t side;
57 pastix_uplo_t uplo;
58 pastix_trans_t trans;
59 pastix_diag_t diag;
60 const SolverCblk *cblk;
61};
62
63static struct starpu_perfmodel starpu_solve_blok_ctrsm_model = {
64 .type = STARPU_HISTORY_BASED,
65 .symbol = "solve_blok_ctrsm",
66};
67
68#if !defined(PASTIX_STARPU_SIMULATION)
69static void
70fct_solve_blok_ctrsm_cpu( void *descr[], void *cl_arg )
71{
72 struct cl_solve_blok_ctrsm_args_s *args = (struct cl_solve_blok_ctrsm_args_s *) cl_arg;
73 void *A;
75 pastix_int_t nrhs, ldb;
76
77 A = pastix_starpu_cblk_get_ptr( descr[0] );
78 B = (pastix_complex32_t *)STARPU_MATRIX_GET_PTR( descr[1] );
79 ldb = (pastix_int_t) STARPU_MATRIX_GET_LD( descr[1] );
80 nrhs = (pastix_int_t) STARPU_MATRIX_GET_NY( descr[1] );
81
82 solve_blok_ctrsm( args->side, args->uplo,
83 args->trans, args->diag, args->cblk,
84 nrhs, A, B, ldb );
85}
86#endif /* !defined(PASTIX_STARPU_SIMULATION) */
87
88CODELETS_CPU( solve_blok_ctrsm, 2 );
89#endif /* DOXYGEN_SHOULD_SKIP_THIS */
90
91/**
92 *******************************************************************************
93 *
94 * @brief Submit a task to do a trsm related to a diagonal
95 * block of the matrix A.
96 *
97 *******************************************************************************
98 *
99 * @param[in] sopalin_data
100 * The data that provide the SolverMatrix structure from PaStiX, and
101 * descriptor of b (providing nrhs, b and ldb).
102 *
103 * @param[inout] rhsb
104 * The pointer to the rhs data structure that holds the vectors of the
105 * right hand side.
106 *
107 * @param[in] coef
108 * Specify whether the computation are made with the L part, or the U
109 * part of A. It has to be either PastixLCoef, or PastixUCoef.
110 *
111 * @param[in] side
112 * Specify the side parameter of the TRSM.
113 *
114 * @param[in] uplo
115 * Specify the uplo parameter of the TRSM.
116 *
117 * @param[in] trans
118 * Specify the transposition used for the matrix A in the
119 * computation. It has to be either PastixTrans or PastixConjTrans.
120 *
121 * @param[in] diag
122 * Specify if the off-diagonal blocks are unit triangular. It has to be
123 * either PastixUnit or PastixNonUnit.
124 *
125 * @param[in] cblk
126 * The cblk structure that corresponds to the A and B matrix.
127
128 * @param[in] prio
129 * The priority of the task in th DAG.
130 *
131 *******************************************************************************/
132void
133starpu_stask_blok_ctrsm( sopalin_data_t *sopalin_data,
134 pastix_rhs_t rhsb,
136 pastix_side_t side,
137 pastix_uplo_t uplo,
138 pastix_trans_t trans,
139 pastix_diag_t diag,
140 const SolverCblk *cblk,
141 pastix_int_t prio )
142{
143 struct cl_solve_blok_ctrsm_args_s *cl_arg;
144 starpu_data_handle_t handle = cblk->handler[coef];
145 SolverMatrix *solvmtx = sopalin_data->solvmtx;
146 pastix_int_t cblknum = cblk - solvmtx->cblktab;
147#if defined(PASTIX_DEBUG_STARPU)
148 char *task_name;
149#endif
150
151 /*
152 * Check if it needs to be submitted
153 */
154#if defined(PASTIX_WITH_MPI)
155 {
156 int need_submit = 0;
157 if ( cblk->ownerid == sopalin_data->solvmtx->clustnum ) {
158 need_submit = 1;
159 }
160 if ( starpu_mpi_cached_receive( rhsb->starpu_desc->handletab[cblknum] ) ) {
161 need_submit = 1;
162 }
163 if ( !need_submit ) {
164 return;
165 }
166 }
167#endif
168
169 /*
170 * Create the arguments array
171 */
172 cl_arg = malloc( sizeof(struct cl_solve_blok_ctrsm_args_s) );
173#if defined(PASTIX_STARPU_PROFILING)
174 cl_arg->profile_data.measures = solve_blok_ctrsm_profile.measures;
175 cl_arg->profile_data.flops = NAN;
176#endif
177 cl_arg->side = side;
178 cl_arg->trans = trans;
179 cl_arg->uplo = uplo;
180 cl_arg->diag = diag;
181 cl_arg->cblk = cblk;
182
183#if defined(PASTIX_DEBUG_STARPU)
184 asprintf( &task_name, "%s( %ld )",
185 cl_solve_blok_ctrsm_cpu.name,
186 (long)(cblknum) );
187#endif
188
189 pastix_starpu_insert_task(
190 &cl_solve_blok_ctrsm_cpu,
191 STARPU_CL_ARGS, cl_arg, sizeof( struct cl_solve_blok_ctrsm_args_s ),
192#if defined(PASTIX_STARPU_PROFILING)
193 STARPU_CALLBACK_WITH_ARG_NFREE, cl_profiling_callback, cl_arg,
194#endif
195 STARPU_R, handle,
196 STARPU_RW, rhsb->starpu_desc->handletab[cblknum],
197#if defined(PASTIX_DEBUG_STARPU)
198 STARPU_NAME, task_name,
199#endif
200#if defined(PASTIX_STARPU_HETEROPRIO)
201 STARPU_PRIORITY, BucketSolveTRSM,
202#endif
203 0);
204 (void)prio;
205}
206
207/**
208 * @}
209 */
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
float _Complex pastix_complex32_t
Definition datatypes.h:76
void solve_blok_ctrsm(pastix_side_t side, pastix_uplo_t uplo, pastix_trans_t trans, pastix_diag_t diag, const SolverCblk *cblk, int nrhs, const void *dataA, pastix_complex32_t *b, int ldb)
Apply a solve trsm update related to a diagonal block of the matrix A.
enum pastix_diag_e pastix_diag_t
Diagonal.
enum pastix_uplo_e pastix_uplo_t
Upper/Lower part.
enum pastix_side_e pastix_side_t
Side of the operation.
enum pastix_trans_e pastix_trans_t
Transpostion.
enum pastix_coefside_e pastix_coefside_t
Data blocks used in the kernel.
Base structure to all codelet arguments that include the profiling data.
Main PaStiX RHS structure.
Definition pastixdata.h:155
void starpu_stask_blok_ctrsm(sopalin_data_t *sopalin_data, pastix_rhs_t rhsb, pastix_coefside_t coef, pastix_side_t side, pastix_uplo_t uplo, pastix_trans_t trans, pastix_diag_t diag, const SolverCblk *cblk, pastix_int_t prio)
Submit a task to do a trsm related to a diagonal block of the matrix A.
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