23#ifndef DOXYGEN_SHOULD_SKIP_THIS
28#include "sopalin/sopalin_data.h"
30#if defined(PASTIX_WITH_CUDA)
40struct cl_blok_strsmsp_args_s {
42 sopalin_data_t *sopalin_data;
51#if defined( PASTIX_STARPU_PROFILING )
59starpu_profile_t blok_strsmsp_profile = {
61 .name =
"blok_strsmsp"
67void blok_strsmsp_profile_register(
void ) __attribute__( ( constructor ) );
69blok_strsmsp_profile_register(
void )
71 profiling_register_cl( &blok_strsmsp_profile );
74#ifndef DOXYGEN_SHOULD_SKIP_THIS
75#if defined(PASTIX_STARPU_PROFILING_LOG)
77cl_profiling_cb_blok_strsmsp(
void *callback_arg )
79 cl_profiling_callback( callback_arg );
81 struct starpu_task *task = starpu_task_get_current();
82 struct starpu_profiling_task_info *info = task->profiling_info;
89 struct cl_blok_strsmsp_args_s *args = (
struct cl_blok_strsmsp_args_s *) callback_arg;
91 pastix_fixdbl_t duration = starpu_timing_timespec_delay_us( &info->start_time, &info->end_time );
97 cl_profiling_log_register( task->name,
"blok_strsmsp", M, N, 0, flops, speed );
101#if defined(PASTIX_STARPU_PROFILING_LOG)
102static void (*blok_strsmsp_callback)(
void*) = cl_profiling_cb_blok_strsmsp;
104static void (*blok_strsmsp_callback)(
void*) = cl_profiling_callback;
110#if defined(PASTIX_STARPU_COST_PER_ARCH)
136fct_blok_strsmsp_cost(
struct starpu_task *task,
137 struct starpu_perfmodel_arch *arch,
140 struct cl_blok_strsmsp_args_s *args = (
struct cl_blok_strsmsp_args_s *)(task->cl_arg);
147 switch( arch->devices->type ) {
148 case STARPU_CPU_WORKER:
151 case STARPU_CUDA_WORKER:
160 cost = modelsGetCost2Param( coefs, M, N ) * 1e6;
167#ifndef DOXYGEN_SHOULD_SKIP_THIS
168static struct starpu_perfmodel starpu_blok_strsmsp_model = {
169#if defined(PASTIX_STARPU_COST_PER_ARCH)
170 .type = STARPU_PER_ARCH,
171 .arch_cost_function = fct_blok_strsmsp_cost,
173 .type = STARPU_HISTORY_BASED,
175 .symbol =
"blok_strsmsp",
179#if !defined(PASTIX_STARPU_SIMULATION)
197 struct cl_blok_strsmsp_args_s *args = (
struct cl_blok_strsmsp_args_s *)cl_arg;
201 A = pastix_starpu_blok_get_ptr( descr[0] );
202 C = pastix_starpu_blok_get_ptr( descr[1] );
204 assert( args->cblk->cblktype & CBLK_TASKS_2D );
207 args->trans, args->diag,
208 args->cblk, args->blok_m, A, C,
209 &(args->sopalin_data->solvmtx->lowrank) );
215#if defined(PASTIX_WITH_CUDA)
217fct_blok_strsmsp_gpu(
void *descr[],
void *cl_arg )
219 struct cl_blok_strsmsp_args_s *args = (
struct cl_blok_strsmsp_args_s *)cl_arg;
223 A = pastix_starpu_blok_get_ptr( descr[0] );
224 C = pastix_starpu_blok_get_ptr( descr[1] );
226 assert( args->cblk->cblktype & CBLK_TASKS_2D );
228 args->profile_data.flops = gpublok_strsmsp( args->side, args->uplo,
229 args->trans, args->diag,
230 args->cblk, args->blok_m, A, C,
231 &(args->sopalin_data->solvmtx->lowrank),
232 starpu_cuda_get_local_stream() );
237#ifndef DOXYGEN_SHOULD_SKIP_THIS
238CODELETS_GPU( blok_strsmsp, 2, STARPU_CUDA_ASYNC );
287 struct cl_blok_strsmsp_args_s *cl_arg = NULL;
288 long long execute_where = cl_blok_strsmsp_any.where;
290#if defined(PASTIX_DEBUG_STARPU) || defined(PASTIX_STARPU_PROFILING_LOG)
299#if defined(PASTIX_WITH_MPI)
302 if ( cblk->
ownerid == sopalin_data->solvmtx->clustnum ) {
308 if ( starpu_mpi_cached_receive( blok->
handler[coef] ) ) {
311 if ( !need_submit ) {
321 cl_arg = malloc(
sizeof(
struct cl_blok_strsmsp_args_s ) );
322 cl_arg->sopalin_data = sopalin_data;
323#if defined(PASTIX_STARPU_PROFILING)
324 cl_arg->profile_data.measures = blok_strsmsp_profile.measures;
325 cl_arg->profile_data.flops = NAN;
329 cl_arg->trans = trans;
332 cl_arg->blok_m = blok_m;
334#if defined(PASTIX_WITH_CUDA)
335 if ( (cblk->
cblktype & CBLK_COMPRESSED) ) {
336 execute_where &= (~STARPU_CUDA);
341#if defined(PASTIX_DEBUG_STARPU) || defined(PASTIX_STARPU_PROFILING_LOG)
343 asprintf( &task_name,
"%s( %ld, %ld, %ld )",
344 cl_blok_strsmsp_any.name,
345 (
long)(cblk - sopalin_data->solvmtx->cblktab),
346 (
long)(blok - sopalin_data->solvmtx->bloktab),
350 pastix_starpu_insert_task(
351 &cl_blok_strsmsp_any,
352 STARPU_CL_ARGS, cl_arg,
sizeof(
struct cl_blok_strsmsp_args_s ),
353 STARPU_EXECUTE_WHERE, execute_where,
354#
if defined(PASTIX_STARPU_PROFILING)
355 STARPU_CALLBACK_WITH_ARG_NFREE, blok_strsmsp_callback, cl_arg,
358 STARPU_RW, blok->
handler[coef],
359#
if defined(PASTIX_DEBUG_STARPU) || defined(PASTIX_STARPU_PROFILING_LOG)
360 STARPU_NAME, task_name,
362#
if defined(PASTIX_STARPU_HETEROPRIO)
363 STARPU_PRIORITY, BucketTRSM2D,
365 STARPU_PRIORITY, prio,
BEGIN_C_DECLS typedef int pastix_int_t
pastix_fixdbl_t cpublok_strsmsp(pastix_side_t side, pastix_uplo_t uplo, pastix_trans_t trans, pastix_diag_t diag, const SolverCblk *cblk, pastix_int_t blok_m, const void *A, void *C, const pastix_lr_t *lowrank)
Compute the updates associated to one off-diagonal block.
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.
static void fct_blok_strsmsp_cpu(void *descr[], void *cl_arg)
StarPU CPU implementation.
void starpu_task_blok_strsmsp(sopalin_data_t *sopalin_data, pastix_coefside_t coef, pastix_side_t side, pastix_uplo_t uplo, pastix_trans_t trans, pastix_diag_t diag, const SolverCblk *cblk, SolverBlok *blok, int prio)
StarPU GPU implementation.
Base structure to all codelet arguments that include the profiling data.
static double cost(symbol_cblk_t *cblk)
Computes the cost of a cblk.
static pastix_int_t blok_rownbr_ext(const SolverBlok *blok)
Compute the number of rows of a contiguous block in front of the same cblk.
static pastix_int_t cblk_colnbr(const SolverCblk *cblk)
Compute the number of columns in a column block.
Solver column block structure.