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).

pzungqr.c 4.55 KB
Newer Older
1
/**
2 3
 *
 * @file pzungqr.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 zungqr 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 Hatem Ltaief
 * @author Jakub Kurzak
 * @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 30

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

33
/**
34
 *  Parallel construction of Q using tile V (application to identity) - dynamic scheduling
35
 */
36 37 38
void chameleon_pzungqr( int genD, CHAM_desc_t *A, CHAM_desc_t *Q,
                        CHAM_desc_t *T, CHAM_desc_t *D,
                        RUNTIME_sequence_t *sequence, RUNTIME_request_t *request )
39
{
Mathieu Faverge's avatar
Mathieu Faverge committed
40
    CHAM_context_t *chamctxt;
Mathieu Faverge's avatar
Mathieu Faverge committed
41
    RUNTIME_option_t options;
42 43 44 45
    size_t ws_worker = 0;
    size_t ws_host = 0;

    int k, m, n;
Mathieu Faverge's avatar
Mathieu Faverge committed
46
    int ldak, ldqk, ldam, ldqm, lddk;
47 48
    int tempmm, tempnn, tempkmin, tempkm;
    int tempAkm, tempAkn;
49
    int ib, minMT;
50

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

Mathieu Faverge's avatar
Mathieu Faverge committed
56
    ib = CHAMELEON_IB;
57

58 59 60 61 62 63
    if (A->m > A->n) {
        minMT = A->nt;
    } else {
        minMT = A->mt;
    }

64 65 66
    if ( D == NULL ) {
        D    = A;
        genD = 0;
67 68
    }

69 70 71 72 73 74 75
    /*
     * zunmqr = A->nb * ib
     * ztsmqr = A->nb * ib
     */
    ws_worker = A->nb * ib;

    /* Allocation of temporary (scratch) working space */
Mathieu Faverge's avatar
Mathieu Faverge committed
76
#if defined(CHAMELEON_USE_CUDA)
77 78 79 80 81
    /* Worker space
     *
     * zunmqr = A->nb * ib
     * ztsmqr = 2 * A->nb * ib
     */
82
    ws_worker = chameleon_max( ws_worker, ib * A->nb * 2 );
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 = minMT-1; k >= 0; k--) {
Mathieu Faverge's avatar
Mathieu Faverge committed
91
        RUNTIME_iteration_push(chamctxt, k);
92

93 94
        tempAkm  = k == A->mt-1 ? A->m-k*A->mb : A->mb;
        tempAkn  = k == A->nt-1 ? A->n-k*A->nb : A->nb;
95
        tempkmin = chameleon_min( tempAkn, tempAkm );
96 97
        tempkm   = k == Q->mt-1 ? Q->m-k*Q->mb : Q->mb;
        ldak = BLKLDD(A, k);
Mathieu Faverge's avatar
Mathieu Faverge committed
98
        lddk = BLKLDD(D, k);
99 100 101 102 103
        ldqk = BLKLDD(Q, k);
        for (m = Q->mt - 1; m > k; m--) {
            tempmm = m == Q->mt-1 ? Q->m-m*Q->mb : Q->mb;
            ldam = BLKLDD(A, m);
            ldqm = BLKLDD(Q, m);
104
            for (n = k; n < Q->nt; n++) {
105
                tempnn = n == Q->nt-1 ? Q->n-n*Q->nb : Q->nb;
106 107 108 109

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

110
                /* TS kernel */
Mathieu Faverge's avatar
Mathieu Faverge committed
111
                INSERT_TASK_ztpmqrt(
112
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
113
                    ChamLeft, ChamNoTrans,
114
                    tempmm, tempnn, tempAkn, 0, ib, T->nb,
115
                    A(m, k), ldam,
116 117 118
                    T(m, k), T->mb,
                    Q(k, n), ldqk,
                    Q(m, n), ldqm);
119
            }
Mathieu Faverge's avatar
Mathieu Faverge committed
120 121
            RUNTIME_data_flush( sequence, A(m, k) );
            RUNTIME_data_flush( sequence, T(m, k) );
122
        }
123

124 125 126 127 128
        if ( genD ) {
            INSERT_TASK_zlacpy(
                &options,
                ChamLower, tempkm, tempkmin, A->nb,
                A(k, k), ldak,
Mathieu Faverge's avatar
Mathieu Faverge committed
129
                D(k),    lddk );
Mathieu Faverge's avatar
Mathieu Faverge committed
130
#if defined(CHAMELEON_USE_CUDA)
131 132 133 134
            INSERT_TASK_zlaset(
                &options,
                ChamUpper, tempkm, tempkmin,
                0., 1.,
Mathieu Faverge's avatar
Mathieu Faverge committed
135
                D(k), lddk );
136
#endif
137
        }
138
        for (n = k; n < Q->nt; n++) {
139
            tempnn = n == Q->nt-1 ? Q->n-n*Q->nb : Q->nb;
140 141 142 143 144

            /* Restore the original location of the tiles */
            RUNTIME_data_migrate( sequence, Q(k, n),
                                  Q->get_rankof( Q, k, n ) );

Mathieu Faverge's avatar
Mathieu Faverge committed
145
            INSERT_TASK_zunmqr(
146
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
147
                ChamLeft, ChamNoTrans,
148
                tempkm, tempnn, tempkmin, ib, T->nb,
Mathieu Faverge's avatar
Mathieu Faverge committed
149
                D(k),    lddk,
150 151 152
                T(k, k), T->mb,
                Q(k, n), ldqk);
        }
Mathieu Faverge's avatar
Mathieu Faverge committed
153 154
        RUNTIME_data_flush( sequence, D(k) );
        RUNTIME_data_flush( sequence, T(k, k) );
155

Mathieu Faverge's avatar
Mathieu Faverge committed
156
        RUNTIME_iteration_pop(chamctxt);
157
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
158

159
    RUNTIME_options_ws_free(&options);
Mathieu Faverge's avatar
Mathieu Faverge committed
160
    RUNTIME_options_finalize(&options, chamctxt);
161
}