codelet_ztpqrt.c 3.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
/**
 *
 * @copyright (c) 2009-2016 The University of Tennessee and The University
 *                          of Tennessee Research Foundation.
 *                          All rights reserved.
 * @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 *                          Univ. Bordeaux. All rights reserved.
 *
 **/

/**
 *
 * @file codelet_ztpqrt.c
 *
 *  MORSE codelets kernel
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
 * @version 0.9.0
 * @author Mathieu Faverge
 * @date 2016-12-15
 * @precisions normal z -> s d c
 *
 **/
#include "runtime/starpu/include/morse_starpu.h"
#include "runtime/starpu/include/runtime_codelet_z.h"

void MORSE_TASK_ztpqrt( const MORSE_option_t *options,
                        int M, int N, int L, int ib, int nb,
                        const MORSE_desc_t *A, int Am, int An, int lda,
                        const MORSE_desc_t *B, int Bm, int Bn, int ldb,
                        const MORSE_desc_t *T, int Tm, int Tn, int ldt )
{
    struct starpu_codelet *codelet = &cl_ztpqrt;
    void (*callback)(void*) = options->profiling ? cl_ztpqrt_callback : NULL;

    if ( morse_desc_islocal( A, Am, An ) ||
         morse_desc_islocal( B, Bm, Bn ) ||
         morse_desc_islocal( T, Tm, Tn ) )
    {
        starpu_insert_task(
42
            starpu_mpi_codelet(codelet),
43 44 45
            STARPU_VALUE, &M,     sizeof(int),
            STARPU_VALUE, &N,     sizeof(int),
            STARPU_VALUE, &L,     sizeof(int),
46
            STARPU_VALUE, &ib,    sizeof(int),
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
            STARPU_RW,     RTBLKADDR(A, MORSE_Complex64_t, Am, An),
            STARPU_VALUE, &lda,   sizeof(int),
            STARPU_RW,     RTBLKADDR(B, MORSE_Complex64_t, Bm, Bn),
            STARPU_VALUE, &ldb,   sizeof(int),
            STARPU_RW,     RTBLKADDR(T, MORSE_Complex64_t, Tm, Tn),
            STARPU_VALUE, &ldt,   sizeof(int),
            /* Other options */
            STARPU_SCRATCH,   options->ws_worker,
            STARPU_PRIORITY,  options->priority,
            STARPU_CALLBACK,  callback,
#if defined(CHAMELEON_CODELETS_HAVE_NAME)
            STARPU_NAME, "ztpqrt",
#endif
            0);
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
62 63

    (void)ib; (void)nb;
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
}


#if !defined(CHAMELEON_SIMULATION)
static void cl_ztpqrt_cpu_func(void *descr[], void *cl_arg)
{
    int M;
    int N;
    int L;
    int ib;
    MORSE_Complex64_t *A;
    int lda;
    MORSE_Complex64_t *B;
    int ldb;
    MORSE_Complex64_t *T;
    int ldt;
    MORSE_Complex64_t *WORK;

    A    = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[0]);
    B    = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[1]);
    T    = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[2]);
    WORK = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[3]); /* ib * nb */

    starpu_codelet_unpack_args( cl_arg, &M, &N, &L, &ib,
                                &lda, &ldb, &ldt );

    CORE_ztpqrt( M, N, L, ib,
                 A, lda, B, ldb, T, ldt, WORK );
}
#endif /* !defined(CHAMELEON_SIMULATION) */


/*
 * Codelet definition
 */
CODELETS_CPU(ztpqrt, 4, cl_ztpqrt_cpu_func)