Newer
Older
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2025 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
* @author Hatem Ltaief
* @author Jakub Kurzak
* @author Mathieu Faverge
* @author Emmanuel Agullo
* @author Cedric Castagnede
* @date 2024-10-18
* @precisions normal z -> c d s
*

Mathieu Faverge
committed
*/

Mathieu Faverge
committed
#include "chameleon_starpu_internal.h"
struct cl_zpotrf_args_s {
cham_uplo_t uplo;
int n;
int iinfo;
RUNTIME_request_t *request;
};
#if !defined(CHAMELEON_SIMULATION)
static void
cl_zpotrf_cpu_func(void *descr[], void *cl_arg)
{
struct cl_zpotrf_args_s *clargs = (struct cl_zpotrf_args_s *)cl_arg;
CHAM_tile_t *tileA;

Mathieu Faverge
committed
tileA = cti_interface_get(descr[0]);
assert( tileA->flttype == ChamComplexDouble );
TCORE_zpotrf( clargs->uplo, clargs->n, tileA, &info );
if ( (clargs->sequence->status == CHAMELEON_SUCCESS) && (info != 0) ) {
RUNTIME_sequence_flush( NULL, clargs->sequence, clargs->request, clargs->iinfo+info );
}
}
#endif /* !defined(CHAMELEON_SIMULATION) */
/*
* Codelet definition
*/
#if defined(CHAMELEON_SIMULATION) && defined(CHAMELEON_SIMULATION_EXTENDED)
CODELETS( zpotrf, cl_zpotrf_cpu_func, cl_zpotrf_cuda_func, STARPU_CUDA_ASYNC )
#else

Mathieu Faverge
committed
CODELETS_CPU( zpotrf, cl_zpotrf_cpu_func )
#endif
#if defined(CHAMELEON_STARPU_USE_INSERT)
void INSERT_TASK_zpotrf( const RUNTIME_option_t *options,
cham_uplo_t uplo, int n, int nb,
const CHAM_desc_t *A, int Am, int An,
int iinfo )
void (*callback)(void*);
struct cl_zpotrf_args_s *clargs = NULL;
int exec = 0;
const char *cl_name = "zpotrf";
/* Handle cache */
CHAMELEON_BEGIN_ACCESS_DECLARATION;
CHAMELEON_ACCESS_RW(A, Am, An);
exec = __chameleon_need_exec;
if ( exec ) {
clargs = malloc( sizeof( struct cl_zpotrf_args_s ) );
clargs->uplo = uplo;
clargs->n = n;
clargs->iinfo = iinfo;
clargs->sequence = options->sequence;
clargs->request = options->request;
}
/* Callback fro profiling information */
callback = options->profiling ? cl_zpotrf_callback : NULL;

Mathieu Faverge
committed
/* Refine name */
cl_name = chameleon_codelet_name( cl_name, 1,
A->get_blktile( A, Am, An ) );
/* Insert the task */

Mathieu Faverge
committed
rt_starpu_insert_task(
&cl_zpotrf,
/* Task codelet arguments */
STARPU_CL_ARGS, clargs, sizeof(struct cl_zpotrf_args_s),
STARPU_RW, RTBLKADDR(A, ChamComplexDouble, Am, An),
/* Common task arguments */
STARPU_PRIORITY, options->priority,
STARPU_CALLBACK, callback,
STARPU_EXECUTE_ON_WORKER, options->workerid,
COJEAN Terry
committed
STARPU_POSSIBLY_PARALLEL, options->parallel,
STARPU_NAME, cl_name,
0 );
(void)nb;
#else
void INSERT_TASK_zpotrf( const RUNTIME_option_t *options,
cham_uplo_t uplo, int n, int nb,
const CHAM_desc_t *A, int Am, int An,
int iinfo )
{
INSERT_TASK_COMMON_PARAMETERS( zpotrf, 1 );
/*
* Set the data handles and initialize exchanges if needed
*/
starpu_cham_exchange_init_params( options, ¶ms, A->get_rankof( A, Am, An ) );
starpu_cham_exchange_data_before_execution( options, ¶ms, &nbdata, descrs, A, Am, An, STARPU_RW );
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
* Not involved, let's return
*/
if ( nbdata == 0 ) {
return;
}
if ( params.do_execute )
{
int ret;
struct starpu_task *task = starpu_task_create();
task->cl = cl;
/* Set codelet parameters */
clargs = malloc( sizeof( struct cl_zpotrf_args_s ) );
clargs->uplo = uplo;
clargs->n = n;
clargs->iinfo = iinfo;
clargs->sequence = options->sequence;
clargs->request = options->request;
task->cl_arg = clargs;
task->cl_arg_size = sizeof( struct cl_zpotrf_args_s );
task->cl_arg_free = 1;
/* Set common parameters */
starpu_cham_task_set_options( options, task, nbdata, descrs, cl_zpotrf_callback );
/* Flops */
task->flops = flops_zpotrf( n );
/* Refine name */
task->name = chameleon_codelet_name( cl_name, 1,
A->get_blktile( A, Am, An ) );
ret = starpu_task_submit( task );
if ( ret == -ENODEV ) {
task->destroy = 0;
starpu_task_destroy( task );
chameleon_error( "INSERT_TASK_zpotrf", "Failed to submit the task to StarPU" );
return;
}
}
starpu_cham_task_exchange_data_after_execution( options, params, nbdata, descrs );
(void)nb;
}
#endif