codelet_zlag2c.c 4.18 KB
Newer Older
1 2
/**
 *
3 4
 * @copyright (c) 2009-2014 The University of Tennessee and The University
 *                          of Tennessee Research Foundation.
5
 *                          All rights reserved.
6
 * @copyright (c) 2012-2016 Inria. All rights reserved.
7
 * @copyright (c) 2012-2014, 2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 *
 **/

/**
 *
 * @file codelet_zlag2c.c
 *
 *  MORSE codelets kernel
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
 * @version 2.5.0
 * @comment This file has been automatically generated
 *          from Plasma 2.5.0 for MORSE 1.0.0
 * @author Mathieu Faverge
 * @author Emmanuel Agullo
 * @author Cedric Castagnede
 * @date 2010-11-15
 * @precisions mixed zc -> ds
 *
 **/
29 30
#include "chameleon_starpu.h"
#include "runtime_codelet_z.h"
31 32 33 34 35 36

/**
 *
 * @ingroup CORE_MORSE_Complex64_t
 *
 **/
37
void MORSE_TASK_zlag2c(const MORSE_option_t *options,
38
                       int m, int n, int nb,
39 40
                       const MORSE_desc_t *A, int Am, int An, int lda,
                       const MORSE_desc_t *B, int Bm, int Bn, int ldb)
41 42 43 44 45
{
    (void)nb;
    struct starpu_codelet *codelet = &cl_zlag2c;
    void (*callback)(void*) = options->profiling ? cl_zlag2c_callback : NULL;

THIBAULT Samuel's avatar
THIBAULT Samuel committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    MORSE_BEGIN_ACCESS_DECLARATION;
    MORSE_ACCESS_R(A, Am, An);
    MORSE_ACCESS_W(B, Bm, Bn);
    MORSE_END_ACCESS_DECLARATION;

    starpu_insert_task(
        starpu_mpi_codelet(codelet),
        STARPU_VALUE,    &m,                 sizeof(int),
        STARPU_VALUE,    &n,                 sizeof(int),
        STARPU_R,         RTBLKADDR(A, MORSE_Complex64_t, Am, An),
        STARPU_VALUE,    &lda,               sizeof(int),
        STARPU_W,         RTBLKADDR(B, MORSE_Complex32_t, Bm, Bn),
        STARPU_VALUE,    &ldb,               sizeof(int),
        STARPU_PRIORITY,  options->priority,
        STARPU_CALLBACK,  callback,
61
#if defined(CHAMELEON_CODELETS_HAVE_NAME)
THIBAULT Samuel's avatar
THIBAULT Samuel committed
62
        STARPU_NAME, "zlag2c",
63
#endif
THIBAULT Samuel's avatar
THIBAULT Samuel committed
64
        0);
65 66
}

67
#if !defined(CHAMELEON_SIMULATION)
68 69 70 71 72 73 74 75 76 77 78 79
static void cl_zlag2c_cpu_func(void *descr[], void *cl_arg)
{
    int m;
    int n;
    MORSE_Complex64_t *A;
    int lda;
    MORSE_Complex32_t *B;
    int ldb;

    A = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[0]);
    B = (MORSE_Complex32_t *)STARPU_MATRIX_GET_PTR(descr[1]);
    starpu_codelet_unpack_args(cl_arg, &m, &n, &lda, &ldb);
80
    CORE_zlag2c( m, n, A, lda, B, ldb);
81
}
82
#endif /* !defined(CHAMELEON_SIMULATION) */
83

84
void MORSE_TASK_clag2z(const MORSE_option_t *options,
85
                       int m, int n, int nb,
86 87
                       const MORSE_desc_t *A, int Am, int An, int lda,
                       const MORSE_desc_t *B, int Bm, int Bn, int ldb)
88 89 90 91 92 93 94 95 96
{
    (void)nb;
    struct starpu_codelet *codelet = &cl_clag2z;
    void (*callback)(void*) = options->profiling ? cl_clag2z_callback : NULL;

    if ( morse_desc_islocal( A, Am, An ) ||
         morse_desc_islocal( B, Bm, Bn ) )
    {
        starpu_insert_task(
97
            starpu_mpi_codelet(codelet),
98 99 100 101 102 103 104 105
            STARPU_VALUE,    &m,                 sizeof(int),
            STARPU_VALUE,    &n,                 sizeof(int),
            STARPU_R,         RTBLKADDR(A, MORSE_Complex32_t, Am, An),
            STARPU_VALUE,    &lda,               sizeof(int),
            STARPU_W,         RTBLKADDR(B, MORSE_Complex64_t, Bm, Bn),
            STARPU_VALUE,    &ldb,               sizeof(int),
            STARPU_PRIORITY,  options->priority,
            STARPU_CALLBACK,  callback,
106 107 108
#if defined(CHAMELEON_CODELETS_HAVE_NAME)
            STARPU_NAME, "clag2z",
#endif
109 110 111 112 113
            0);
    }
}


114
#if !defined(CHAMELEON_SIMULATION)
115 116 117 118 119 120 121 122 123 124 125 126
static void cl_clag2z_cpu_func(void *descr[], void *cl_arg)
{
    int m;
    int n;
    MORSE_Complex32_t *A;
    int lda;
    MORSE_Complex64_t *B;
    int ldb;

    A = (MORSE_Complex32_t *)STARPU_MATRIX_GET_PTR(descr[0]);
    B = (MORSE_Complex64_t *)STARPU_MATRIX_GET_PTR(descr[1]);
    starpu_codelet_unpack_args(cl_arg, &m, &n, &lda, &ldb);
127
    CORE_clag2z( m, n, A, lda, B, ldb);
128
}
129
#endif /* !defined(CHAMELEON_SIMULATION) */
130 131 132 133 134 135 136 137 138

/*
 * Codelet definition
 */
CODELETS_CPU(zlag2c, 1, cl_zlag2c_cpu_func)
/*
 * Codelet definition
 */
CODELETS_CPU(clag2z, 2, cl_clag2z_cpu_func)