Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

pzgelqf.c 4.85 KB
Newer Older
1
/**
2 3
 *
 * @file pzgelqf.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 zgelqf 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 Jakub Kurzak
 * @author Hatem Ltaief
 * @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 29

#define A(m,n) A,  m,  n
#define T(m,n) T,  m,  n
30
#define D(k)   D,  k,  k
31

32
/**
33
 *  Parallel tile LQ factorization - dynamic scheduling
34
 */
35 36
void chameleon_pzgelqf( int genD, CHAM_desc_t *A, CHAM_desc_t *T, CHAM_desc_t *D,
                        RUNTIME_sequence_t *sequence, RUNTIME_request_t *request )
37
{
Mathieu Faverge's avatar
Mathieu Faverge committed
38
    CHAM_context_t *chamctxt;
Mathieu Faverge's avatar
Mathieu Faverge committed
39
    RUNTIME_option_t options;
40 41 42 43
    size_t ws_worker = 0;
    size_t ws_host = 0;

    int k, m, n;
Mathieu Faverge's avatar
Mathieu Faverge committed
44
    int ldak, ldam, lddk;
45
    int tempkm, tempkn, tempmm, tempnn;
46
    int ib, minMNT;
47

Mathieu Faverge's avatar
Mathieu Faverge committed
48
    chamctxt = chameleon_context_self();
Mathieu Faverge's avatar
Mathieu Faverge committed
49
    if (sequence->status != CHAMELEON_SUCCESS) {
50
        return;
Mathieu Faverge's avatar
Mathieu Faverge committed
51
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
52
    RUNTIME_options_init(&options, chamctxt, sequence, request);
53

Mathieu Faverge's avatar
Mathieu Faverge committed
54
    ib = CHAMELEON_IB;
55

56
    if (A->m > A->n) {
57
        minMNT = A->nt;
58
    } else {
59
        minMNT = A->mt;
60 61
    }

62
    if ( D == NULL ) {
63 64
        D    = A;
        genD = 0;
65 66
    }

67 68 69 70 71 72 73 74 75
    /*
     * zgelqt = A->nb * (ib+1)
     * zunmlq = A->nb * ib
     * ztslqt = A->nb * (ib+1)
     * ztsmlq = A->nb * ib
     */
    ws_worker = A->nb * (ib+1);

    /* Allocation of temporary (scratch) working space */
Mathieu Faverge's avatar
Mathieu Faverge committed
76 77 78 79 80 81
#if defined(CHAMELEON_USE_CUDA)
    /* Worker space
     *
     * zunmqr = A->nb * ib
     * ztsmqr = 2 * A->nb * ib
     */
82
    ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
Mathieu Faverge's avatar
Mathieu Faverge committed
83 84
#endif

Mathieu Faverge's avatar
Mathieu Faverge committed
85 86
    ws_worker *= sizeof(CHAMELEON_Complex64_t);
    ws_host   *= sizeof(CHAMELEON_Complex64_t);
87 88 89

    RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );

90
    for (k = 0; k < minMNT; k++) {
Mathieu Faverge's avatar
Mathieu Faverge committed
91
        RUNTIME_iteration_push(chamctxt, k);
92

93 94 95
        tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
        tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb;
        ldak = BLKLDD(A, k);
Mathieu Faverge's avatar
Mathieu Faverge committed
96
        lddk = BLKLDD(D, k);
Mathieu Faverge's avatar
Mathieu Faverge committed
97
        INSERT_TASK_zgelqt(
98 99 100 101
            &options,
            tempkm, tempkn, ib, T->nb,
            A(k, k), ldak,
            T(k, k), T->mb);
102
        if ( genD ) {
Mathieu Faverge's avatar
Mathieu Faverge committed
103
            INSERT_TASK_zlacpy(
104
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
105
                ChamUpper, tempkm, tempkn, A->nb,
106
                A(k, k), ldak,
Mathieu Faverge's avatar
Mathieu Faverge committed
107
                D(k), lddk );
Mathieu Faverge's avatar
Mathieu Faverge committed
108
#if defined(CHAMELEON_USE_CUDA)
Mathieu Faverge's avatar
Mathieu Faverge committed
109
            INSERT_TASK_zlaset(
110
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
111
                ChamLower, tempkm, tempkn,
112
                0., 1.,
Mathieu Faverge's avatar
Mathieu Faverge committed
113
                D(k), lddk );
114
#endif
115
        }
116 117 118
        for (m = k+1; m < A->mt; m++) {
            tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
            ldam = BLKLDD(A, m);
Mathieu Faverge's avatar
Mathieu Faverge committed
119
            INSERT_TASK_zunmlq(
120
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
121
                ChamRight, ChamConjTrans,
122
                tempmm, tempkn, tempkn, ib, T->nb,
Mathieu Faverge's avatar
Mathieu Faverge committed
123
                D(k), lddk,
124 125 126
                T(k, k), T->mb,
                A(m, k), ldam);
        }
Mathieu Faverge's avatar
Mathieu Faverge committed
127 128
        RUNTIME_data_flush( sequence, D(k)    );
        RUNTIME_data_flush( sequence, T(k, k) );
BOUCHERIE Raphael's avatar
BOUCHERIE Raphael committed
129

130 131
        for (n = k+1; n < A->nt; n++) {
            tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
132 133 134 135

            RUNTIME_data_migrate( sequence, A(k, k),
                                  A->get_rankof( A, k, n ) );

136
            /* TS kernel */
Mathieu Faverge's avatar
Mathieu Faverge committed
137
            INSERT_TASK_ztplqt(
138
                &options,
139
                tempkm, tempnn, 0, ib, T->nb,
140 141 142 143 144 145
                A(k, k), ldak,
                A(k, n), ldak,
                T(k, n), T->mb);
            for (m = k+1; m < A->mt; m++) {
                tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
                ldam = BLKLDD(A, m);
146 147 148 149

                RUNTIME_data_migrate( sequence, A(m, k),
                                      A->get_rankof( A, m, n ) );

Mathieu Faverge's avatar
Mathieu Faverge committed
150
                INSERT_TASK_ztpmlqt(
151
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
152
                    ChamRight, ChamConjTrans,
153
                    tempmm, tempnn, A->mb, 0, ib, T->nb,
154
                    A(k, n), ldak,
155 156 157
                    T(k, n), T->mb,
                    A(m, k), ldam,
                    A(m, n), ldam);
158
            }
Mathieu Faverge's avatar
Mathieu Faverge committed
159 160
            RUNTIME_data_flush( sequence, A(k, n) );
            RUNTIME_data_flush( sequence, T(k, n) );
161
        }
162

163 164 165 166 167 168
        /* Restore the original location of the tiles */
        for (m = k; m < A->mt; m++) {
            RUNTIME_data_migrate( sequence, A(m, k),
                                  A->get_rankof( A, m, k ) );
        }

Mathieu Faverge's avatar
Mathieu Faverge committed
169
        RUNTIME_iteration_pop(chamctxt);
170
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
171

172
    RUNTIME_options_ws_free(&options);
Mathieu Faverge's avatar
Mathieu Faverge committed
173
    RUNTIME_options_finalize(&options, chamctxt);
Mathieu Faverge's avatar
Mathieu Faverge committed
174
    (void)D;
175
}