pzlauum.c 4.19 KB
Newer Older
1
/**
2 3
 *
 * @file pzlauum.c
4
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
5 6
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
Mathieu Faverge's avatar
Mathieu Faverge committed
7
 * @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
10
 ***
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
12
 * @brief Chameleon zlauum parallel algorithm
13
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
14
 * @version 1.0.0
15
 * @comment This file has been automatically generated
Mathieu Faverge's avatar
Mathieu Faverge committed
16
 *          from Plasma 2.5.0 for CHAMELEON 1.0.0
17 18 19 20 21 22 23 24
 * @author Julien Langou
 * @author Henricus Bouwmeester
 * @author Mathieu Faverge
 * @author Emmanuel Agullo
 * @author Cedric Castagnede
 * @date 2010-11-15
 * @precisions normal z -> s d c
 *
25
 */
26
#include "control/common.h"
27 28

#define A(m,n) A,  m,  n
29
/**
30
 *  Parallel UU' or L'L operation - dynamic scheduling
31
 */
Mathieu Faverge's avatar
Mathieu Faverge committed
32
void chameleon_pzlauum(cham_uplo_t uplo, CHAM_desc_t *A,
Mathieu Faverge's avatar
Mathieu Faverge committed
33
                          RUNTIME_sequence_t *sequence, RUNTIME_request_t *request)
34
{
Mathieu Faverge's avatar
Mathieu Faverge committed
35
    CHAM_context_t *chamctxt;
Mathieu Faverge's avatar
Mathieu Faverge committed
36
    RUNTIME_option_t options;
37 38

    int k, m, n;
39 40
    int ldak, ldam, ldan;
    int tempkm, tempkn;
41

Mathieu Faverge's avatar
Mathieu Faverge committed
42
    chamctxt = chameleon_context_self();
Mathieu Faverge's avatar
Mathieu Faverge committed
43
    if (sequence->status != CHAMELEON_SUCCESS) {
44
        return;
Mathieu Faverge's avatar
Mathieu Faverge committed
45
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
46
    RUNTIME_options_init(&options, chamctxt, sequence, request);
47
    /*
Mathieu Faverge's avatar
Mathieu Faverge committed
48
     *  ChamLower
49
     */
Mathieu Faverge's avatar
Mathieu Faverge committed
50
    if (uplo == ChamLower) {
51 52 53 54 55
        for (k = 0; k < A->mt; k++) {
            tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
            ldak = BLKLDD(A, k);
            for(n = 0; n < k; n++) {
                ldan = BLKLDD(A, n);
Mathieu Faverge's avatar
Mathieu Faverge committed
56
                INSERT_TASK_zherk(
57
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
58
                    uplo, ChamConjTrans,
59 60 61
                    A->mb, tempkm, A->mb,
                    1.0, A(k, n), ldak,
                    1.0, A(n, n), ldan);
62

63 64
                for(m = n+1; m < k; m++) {
                    ldam = BLKLDD(A, m);
Mathieu Faverge's avatar
Mathieu Faverge committed
65
                    INSERT_TASK_zgemm(
66
                        &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
67
                        ChamConjTrans, ChamNoTrans,
68 69 70 71
                        A->mb, A->nb, tempkm, A->mb,
                        1.0, A(k, m), ldak,
                             A(k, n), ldak,
                        1.0, A(m, n), ldam);
72 73
                }
            }
74
            for (n = 0; n < k; n++) {
75
                RUNTIME_data_flush( sequence, A(k, n) );
Mathieu Faverge's avatar
Mathieu Faverge committed
76
                INSERT_TASK_ztrmm(
77
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
78
                    ChamLeft, uplo, ChamConjTrans, ChamNonUnit,
79 80 81
                    tempkm, A->nb, A->mb,
                    1.0, A(k, k), ldak,
                         A(k, n), ldak);
82
            }
83
            RUNTIME_data_flush( sequence, A(k, k) );
Mathieu Faverge's avatar
Mathieu Faverge committed
84
            INSERT_TASK_zlauum(
85
                &options,
86 87
                uplo, tempkm, A->mb,
                A(k, k), ldak);
88 89 90
        }
    }
    /*
Mathieu Faverge's avatar
Mathieu Faverge committed
91
     *  ChamUpper
92 93
     */
    else {
94 95 96 97 98 99
        for (k = 0; k < A->mt; k++) {
            tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb;
            ldak = BLKLDD(A, k);

            for (m = 0; m < k; m++) {
                ldam = BLKLDD(A, m);
Mathieu Faverge's avatar
Mathieu Faverge committed
100
                INSERT_TASK_zherk(
101
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
102
                    uplo, ChamNoTrans,
103 104 105
                    A->mb, tempkn, A->mb,
                    1.0, A(m, k), ldam,
                    1.0, A(m, m), ldam);
106

107 108
                for (n = m+1; n < k; n++){
                    ldan = BLKLDD(A, n);
Mathieu Faverge's avatar
Mathieu Faverge committed
109
                    INSERT_TASK_zgemm(
110
                        &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
111
                        ChamNoTrans, ChamConjTrans,
112 113 114 115
                        A->mb, A->nb, tempkn, A->mb,
                        1.0, A(m, k), ldam,
                             A(n, k), ldan,
                        1.0, A(m, n), ldam);
116 117
                }
            }
118 119
            for (m = 0; m < k; m++) {
                ldam = BLKLDD(A, m);
120
                RUNTIME_data_flush( sequence, A(m, k) );
Mathieu Faverge's avatar
Mathieu Faverge committed
121
                INSERT_TASK_ztrmm(
122
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
123
                    ChamRight, uplo, ChamConjTrans, ChamNonUnit,
124 125 126
                    A->mb, tempkn, A->mb,
                    1.0, A(k, k), ldak,
                         A(m, k), ldam);
127
            }
128
            RUNTIME_data_flush( sequence, A(k, k) );
Mathieu Faverge's avatar
Mathieu Faverge committed
129
            INSERT_TASK_zlauum(
130
                &options,
131 132
                uplo, tempkn, A->mb,
                A(k, k), ldak);
133 134
        }
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
135
    RUNTIME_options_finalize(&options, chamctxt);
136
}