codelet_ztpqrt.c 3.03 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
/**
 *
 * @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
 *
 **/
25 26
#include "chameleon_starpu.h"
#include "runtime_codelet_z.h"
27

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
#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)

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 )
67 68 69 70
{
    struct starpu_codelet *codelet = &cl_ztpqrt;
    void (*callback)(void*) = options->profiling ? cl_ztpqrt_callback : NULL;

Samuel Thibault's avatar
Samuel Thibault committed
71 72 73
    MORSE_BEGIN_ACCESS_DECLARATION;
    MORSE_ACCESS_RW(A, Am, An);
    MORSE_ACCESS_RW(B, Bm, Bn);
Samuel Thibault's avatar
Samuel Thibault committed
74
    MORSE_ACCESS_W(T, Tm, Tn);
Samuel Thibault's avatar
Samuel Thibault committed
75 76 77 78 79 80 81 82 83 84 85 86
    MORSE_END_ACCESS_DECLARATION;

    starpu_insert_task(
        starpu_mpi_codelet(codelet),
        STARPU_VALUE, &M,     sizeof(int),
        STARPU_VALUE, &N,     sizeof(int),
        STARPU_VALUE, &L,     sizeof(int),
        STARPU_VALUE, &ib,    sizeof(int),
        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),
Samuel Thibault's avatar
Samuel Thibault committed
87
        STARPU_W,      RTBLKADDR(T, MORSE_Complex64_t, Tm, Tn),
Samuel Thibault's avatar
Samuel Thibault committed
88 89 90 91 92
        STARPU_VALUE, &ldt,   sizeof(int),
        /* Other options */
        STARPU_SCRATCH,   options->ws_worker,
        STARPU_PRIORITY,  options->priority,
        STARPU_CALLBACK,  callback,
93 94 95
#if defined(CHAMELEON_USE_MPI)
        STARPU_EXECUTE_ON_NODE, B->get_rankof(B, Bm, Bn),
#endif
96
#if defined(CHAMELEON_CODELETS_HAVE_NAME)
Samuel Thibault's avatar
Samuel Thibault committed
97
        STARPU_NAME, "ztpqrt",
98
#endif
Samuel Thibault's avatar
Samuel Thibault committed
99
        0);
100 101

    (void)ib; (void)nb;
102
}