pzgetrf_incpiv.c 3.96 KB
Newer Older
1
/**
2 3
 *
 * @file pzgetrf_incpiv.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
 *
10
 ***
11
 *
12
 * @brief Chameleon zgetrf_incpiv parallel algorithm
13
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
14
 * @version 1.0.0
15
 * @comment This file has been automatically generated
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 27
//ALLOC_WS :  ib*L->nb
//WS_ADD :  ib*L->nb
28
#include "control/common.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
29
#include <stdlib.h>
30 31

#define A(_m_,_n_) A, _m_, _n_
32
#if defined(CHAMELEON_COPY_DIAG)
33
#define D(k)   D, k, 0
34
#else
35
#define D(k)   A, k, k
36
#endif
37 38 39
#define L(_m_,_n_) L,  _m_,  _n_
#define IPIV(_m_,_n_) &(IPIV[(int64_t)A->mb*((int64_t)(_m_)+(int64_t)A->mt*(int64_t)(_n_))])

40
/**
41
 *  Parallel tile LU factorization - dynamic scheduling
42
 */
Mathieu Faverge's avatar
Mathieu Faverge committed
43
void chameleon_pzgetrf_incpiv( CHAM_desc_t *A, CHAM_desc_t *L, CHAM_desc_t *D, int *IPIV,
44
                               RUNTIME_sequence_t *sequence, RUNTIME_request_t *request )
45
{
Mathieu Faverge's avatar
Mathieu Faverge committed
46
    CHAM_context_t *chamctxt;
47
    RUNTIME_option_t options;
48 49
    size_t ws_worker = 0;
    size_t ws_host = 0;
50 51 52 53 54

    int k, m, n;
    int ldak, ldam;
    int tempkm, tempkn, tempmm, tempnn;
    int ib;
55
    int minMNT = chameleon_min(A->mt, A->nt);
56

Mathieu Faverge's avatar
Mathieu Faverge committed
57
    chamctxt = chameleon_context_self();
Mathieu Faverge's avatar
Mathieu Faverge committed
58
    if (sequence->status != CHAMELEON_SUCCESS) {
59
        return;
Mathieu Faverge's avatar
Mathieu Faverge committed
60
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
61
    RUNTIME_options_init(&options, chamctxt, sequence, request);
62

63
    ib = CHAMELEON_IB;
64

65 66 67 68 69 70 71
    /*
     * zgetrf_incpiv = 0
     * zgessm        = 0
     * ztstrf        = A->mb * ib
     * zssssm        = 0
     */
    ws_worker = A->mb * ib;
72

73 74
    ws_worker *= sizeof(CHAMELEON_Complex64_t);
    ws_host   *= sizeof(CHAMELEON_Complex64_t);
75 76

    RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
77

78
    for (k = 0; k < minMNT; k++) {
Mathieu Faverge's avatar
Mathieu Faverge committed
79
        RUNTIME_iteration_push(chamctxt, k);
80

81 82 83
        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);
84
        INSERT_TASK_zgetrf_incpiv(
85 86 87 88 89 90 91 92
            &options,
            tempkm, tempkn, ib, L->nb,
            A(k, k), ldak,
            L(k, k), L->mb,
            IPIV(k, k),
            k == A->mt-1, A->nb*k);

        if ( k < (minMNT-1) ) {
93
#if defined(CHAMELEON_COPY_DIAG)
94
            INSERT_TASK_zlacpy(
95
                &options,
96
                ChamUpperLower, tempkm, tempkn, A->nb,
97
                A(k, k), ldak,
98
                D(k), ldak);
99
#endif
100 101 102 103
        }

        for (n = k+1; n < A->nt; n++) {
            tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
104
            INSERT_TASK_zgessm(
105 106 107 108
                &options,
                tempkm, tempnn, tempkm, ib, L->nb,
                IPIV(k, k),
                L(k, k), L->mb,
109
                D(k), ldak,
110 111 112 113 114
                A(k, n), ldak);
        }
        for (m = k+1; m < A->mt; m++) {
            tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
            ldam = BLKLDD(A, m);
115
            INSERT_TASK_ztstrf(
116 117 118 119 120 121 122 123 124 125
                &options,
                tempmm, tempkn, ib, L->nb,
                A(k, k), ldak,
                A(m, k), ldam,
                L(m, k), L->mb,
                IPIV(m, k),
                m == A->mt-1, A->nb*k);

            for (n = k+1; n < A->nt; n++) {
                tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
126
                INSERT_TASK_zssssm(
127 128 129 130 131 132 133 134 135
                    &options,
                    A->nb, tempnn, tempmm, tempnn, A->nb, ib, L->nb,
                    A(k, n), ldak,
                    A(m, n), ldam,
                    L(m, k), L->mb,
                    A(m, k), ldam,
                    IPIV(m, k));
            }
        }
136

Mathieu Faverge's avatar
Mathieu Faverge committed
137
        RUNTIME_iteration_pop(chamctxt);
138
    }
139

140
    RUNTIME_options_ws_free(&options);
Mathieu Faverge's avatar
Mathieu Faverge committed
141
    RUNTIME_options_finalize(&options, chamctxt);
142
    (void)D;
143
}