codelet_zlange.c 3 KB
Newer Older
Mathieu Faverge's avatar
Mathieu Faverge committed
1
/**
2 3
 *
 * @file codelet_zlange.c
Mathieu Faverge's avatar
Mathieu Faverge committed
4
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
5 6
 * @copyright 2009-2015 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
7 8
 * @copyright 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 *                      Univ. Bordeaux. All rights reserved.
Mathieu Faverge's avatar
Mathieu Faverge committed
9
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
10
 ***
Mathieu Faverge's avatar
Mathieu Faverge committed
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
12
 * @brief Chameleon zlange PaRSEC codelet
Mathieu Faverge's avatar
Mathieu Faverge committed
13
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
14
 * @version 1.0.0
Mathieu Faverge's avatar
Mathieu Faverge committed
15 16 17 18
 * @author Reazul Hoque
 * @precisions normal z -> c d s
 *
 **/
19 20
#include "chameleon_parsec.h"
#include "chameleon/morse_tasks_z.h"
21
#include "coreblas/coreblas_z.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
22

Mathieu Faverge's avatar
Mathieu Faverge committed
23 24 25
static inline int
CORE_zlange_parsec( parsec_execution_stream_t *context,
                    parsec_task_t             *this_task )
Mathieu Faverge's avatar
Mathieu Faverge committed
26
{
27 28 29
    MORSE_enum norm;
    int M;
    int N;
Mathieu Faverge's avatar
Mathieu Faverge committed
30
    MORSE_Complex64_t *A;
31
    int LDA;
Mathieu Faverge's avatar
Mathieu Faverge committed
32
    double *work;
Mathieu Faverge's avatar
Mathieu Faverge committed
33
    double *normA;
Mathieu Faverge's avatar
Mathieu Faverge committed
34

Mathieu Faverge's avatar
Mathieu Faverge committed
35
    parsec_dtd_unpack_args(
36
        this_task,   &norm,   &M,   &N, &A,   &LDA, &work, &normA );
Mathieu Faverge's avatar
Mathieu Faverge committed
37

38
    CORE_zlange( norm, M, N, A, LDA, work, normA );
Mathieu Faverge's avatar
Mathieu Faverge committed
39

Mathieu Faverge's avatar
Mathieu Faverge committed
40
    (void)context;
41
    return PARSEC_HOOK_RETURN_DONE;
Mathieu Faverge's avatar
Mathieu Faverge committed
42 43
}

44
void MORSE_TASK_zlange(const MORSE_option_t *options,
Mathieu Faverge's avatar
Mathieu Faverge committed
45
                       MORSE_enum norm, int M, int N, int NB,
46 47
                       const MORSE_desc_t *A, int Am, int An, int LDA,
                       const MORSE_desc_t *B, int Bm, int Bn)
Mathieu Faverge's avatar
Mathieu Faverge committed
48
{
Mathieu Faverge's avatar
Mathieu Faverge committed
49
    parsec_taskpool_t* PARSEC_dtd_taskpool = (parsec_taskpool_t *)(options->sequence->schedopt);
Mathieu Faverge's avatar
Mathieu Faverge committed
50

51
    int szeW = chameleon_max( M, N );
Mathieu Faverge's avatar
Mathieu Faverge committed
52

Mathieu Faverge's avatar
Mathieu Faverge committed
53 54
    parsec_dtd_taskpool_insert_task(
        PARSEC_dtd_taskpool, CORE_zlange_parsec, options->priority, "lange",
55 56 57
        sizeof(MORSE_enum),            &norm,          VALUE,
        sizeof(int),                   &M,             VALUE,
        sizeof(int),                   &N,             VALUE,
58
        PASSED_BY_REF,         RTBLKADDR( A, MORSE_Complex64_t, Am, An ),     INPUT,
59 60
        sizeof(int),                   &LDA,           VALUE,
        sizeof(double)*szeW,           NULL,           SCRATCH,
61
        PASSED_BY_REF,         RTBLKADDR( B, double, Bm, Bn ),     OUTPUT,
62
        PARSEC_DTD_ARG_END );
63 64

    (void)NB;
Mathieu Faverge's avatar
Mathieu Faverge committed
65 66
}

Mathieu Faverge's avatar
Mathieu Faverge committed
67
#if defined(PRECISION_d) || defined(PRECISION_s)
Mathieu Faverge's avatar
Mathieu Faverge committed
68 69 70
static inline int
CORE_zlange_max_parsec( parsec_execution_stream_t *context,
                    parsec_task_t             *this_task )
Mathieu Faverge's avatar
Mathieu Faverge committed
71
{
Mathieu Faverge's avatar
Mathieu Faverge committed
72 73
    double *A;
    double *normA;
Mathieu Faverge's avatar
Mathieu Faverge committed
74

Mathieu Faverge's avatar
Mathieu Faverge committed
75
    parsec_dtd_unpack_args(
76
        this_task, &A, &normA );
Mathieu Faverge's avatar
Mathieu Faverge committed
77

Mathieu Faverge's avatar
Mathieu Faverge committed
78 79
    if ( *A > *normA )
        *normA = *A;
Mathieu Faverge's avatar
Mathieu Faverge committed
80

Mathieu Faverge's avatar
Mathieu Faverge committed
81
    (void)context;
82
    return PARSEC_HOOK_RETURN_DONE;
Mathieu Faverge's avatar
Mathieu Faverge committed
83 84
}

85
void MORSE_TASK_zlange_max(const MORSE_option_t *options,
86 87
                           const MORSE_desc_t *A, int Am, int An,
                           const MORSE_desc_t *B, int Bm, int Bn)
Mathieu Faverge's avatar
Mathieu Faverge committed
88
{
Mathieu Faverge's avatar
Mathieu Faverge committed
89
    parsec_taskpool_t* PARSEC_dtd_taskpool = (parsec_taskpool_t *)(options->sequence->schedopt);
Mathieu Faverge's avatar
Mathieu Faverge committed
90

Mathieu Faverge's avatar
Mathieu Faverge committed
91 92
    parsec_dtd_taskpool_insert_task(
        PARSEC_dtd_taskpool, CORE_zlange_max_parsec, options->priority, "lange_max",
93 94
        PASSED_BY_REF,         RTBLKADDR( A, double, Am, An ), INPUT,
        PASSED_BY_REF,         RTBLKADDR( B, double, Bm, Bn ), OUTPUT,
95
        PARSEC_DTD_ARG_END );
Mathieu Faverge's avatar
Mathieu Faverge committed
96
}
Mathieu Faverge's avatar
Mathieu Faverge committed
97 98

#endif /* defined(PRECISION_d) || defined(PRECISION_s) */