pzgetrf_incpiv.c 3.95 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
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
10
 ***
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
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
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 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;
Mathieu Faverge's avatar
Mathieu Faverge committed
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
    RUNTIME_options_init(&options, chamctxt, sequence, request);
61

Mathieu Faverge's avatar
Mathieu Faverge committed
62
    ib = CHAMELEON_IB;
63

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

Mathieu Faverge's avatar
Mathieu Faverge committed
72 73
    ws_worker *= sizeof(CHAMELEON_Complex64_t);
    ws_host   *= sizeof(CHAMELEON_Complex64_t);
74 75

    RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
76

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

80 81 82
        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
83
        INSERT_TASK_zgetrf_incpiv(
84 85 86 87 88 89 90 91
            &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) ) {
92
#if defined(CHAMELEON_COPY_DIAG)
Mathieu Faverge's avatar
Mathieu Faverge committed
93
            INSERT_TASK_zlacpy(
94
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
95
                ChamUpperLower, tempkm, tempkn, A->nb,
96
                A(k, k), ldak,
97
                D(k), ldak);
98
#endif
99 100 101 102
        }

        for (n = k+1; n < A->nt; n++) {
            tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
Mathieu Faverge's avatar
Mathieu Faverge committed
103
            INSERT_TASK_zgessm(
104 105 106 107
                &options,
                tempkm, tempnn, tempkm, ib, L->nb,
                IPIV(k, k),
                L(k, k), L->mb,
108
                D(k), ldak,
109 110 111 112 113
                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);
Mathieu Faverge's avatar
Mathieu Faverge committed
114
            INSERT_TASK_ztstrf(
115 116 117 118 119 120 121 122 123 124
                &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;
Mathieu Faverge's avatar
Mathieu Faverge committed
125
                INSERT_TASK_zssssm(
126 127 128 129 130 131 132 133 134
                    &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));
            }
        }
135

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

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