Mentions légales du service

Skip to content
Snippets Groups Projects
codelet_zlascal.c 2.9 KiB
Newer Older
 * @file starpu/codelet_zlascal.c
Mathieu Faverge's avatar
Mathieu Faverge committed
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
 * @copyright 2012-2022 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 *                      Univ. Bordeaux. All rights reserved.
 * @brief Chameleon zlascal StarPU codelet
 * @author Dalal Sukkari
BARROS DE ASSIS Lucas's avatar
BARROS DE ASSIS Lucas committed
 * @author Lucas Barros de Assis
Mathieu Faverge's avatar
Mathieu Faverge committed
 * @author Florent Pruvost
 * @author Mathieu Faverge
 * @author Samuel Thibault
 * @date 2021-03-16
 * @precisions normal z -> c d s
 *
#include "chameleon_starpu.h"
#include "runtime_codelet_z.h"
struct cl_zlascal_args_s {
    cham_uplo_t uplo;
    CHAMELEON_Complex64_t alpha;
};

#if !defined(CHAMELEON_SIMULATION)
static void
cl_zlascal_cpu_func( void *descr[], void *cl_arg )
{
    struct cl_zlascal_args_s *clargs = (struct cl_zlascal_args_s *)cl_arg;
    TCORE_zlascal( clargs->uplo, clargs->m, clargs->n, clargs->alpha, tileA );
}
#endif /* !defined(CHAMELEON_SIMULATION) */

/*
 * Codelet definition
 */
CODELETS_CPU( zlascal, cl_zlascal_cpu_func )
void INSERT_TASK_zlascal( const RUNTIME_option_t *options,
                          cham_uplo_t uplo,
                          int m, int n, int nb,
                          CHAMELEON_Complex64_t alpha,
                          const CHAM_desc_t *A, int Am, int An )
    if ( alpha == 0. ) {
        return INSERT_TASK_zlaset( options, uplo, m, n,
                                   alpha, alpha, A, Am, An );
    }
    else if ( alpha == 1. ) {
        return;
    }

    struct cl_zlascal_args_s *clargs = NULL;
    void (*callback)(void*);
    char                    *cl_name = "zlascal";
    CHAMELEON_BEGIN_ACCESS_DECLARATION;
    CHAMELEON_ACCESS_RW(A, Am, An);
    exec = __chameleon_need_exec;
    CHAMELEON_END_ACCESS_DECLARATION;
    if ( exec ) {
        clargs = malloc( sizeof( struct cl_zlascal_args_s ) );
        clargs->uplo  = uplo;
        clargs->m     = m;
        clargs->n     = n;
        clargs->alpha = alpha;
        clargs->tileA = A->get_blktile( A, Am, An );
    }

    /* Callback fro profiling information */
    callback = options->profiling ? cl_zlascal_callback : NULL;

    /* Insert the task */
        &cl_zlascal,
        /* Task codelet arguments */
        STARPU_CL_ARGS, clargs, sizeof(struct cl_zlascal_args_s),
        STARPU_RW,     RTBLKADDR(A, CHAMELEON_Complex64_t, Am, An),

        /* Common task arguments */
        STARPU_PRIORITY,          options->priority,
        STARPU_CALLBACK,          callback,
        STARPU_EXECUTE_ON_WORKER, options->workerid,
#if defined(CHAMELEON_CODELETS_HAVE_NAME)