pzgetrf_incpiv.c 4.08 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.
7 8
 * @copyright 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 *                      Univ. Bordeaux. All rights reserved.
9
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
10
 ***
11 12 13 14 15 16
 *
 *
 *  MORSE auxiliary routines
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
17
 * @version 1.0.0
18 19 20 21 22 23 24 25 26 27 28 29 30
 * @comment This file has been automatically generated
 *          from Plasma 2.5.0 for MORSE 1.0.0
 * @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
 *
 **/
//ALLOC_WS :  ib*L->nb
//WS_ADD :  ib*L->nb
31
#include "control/common.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
32
#include <stdlib.h>
33 34

#define A(_m_,_n_) A, _m_, _n_
35
#if defined(CHAMELEON_COPY_DIAG)
36
#define D(k)   D, k, 0
37
#else
38
#define D(k)   A, k, k
39
#endif
40 41 42
#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_))])

Mathieu Faverge's avatar
Mathieu Faverge committed
43
/*******************************************************************************
44 45
 *  Parallel tile LU factorization - dynamic scheduling
 **/
46 47
void morse_pzgetrf_incpiv( MORSE_desc_t *A, MORSE_desc_t *L, MORSE_desc_t *D, int *IPIV,
                           MORSE_sequence_t *sequence, MORSE_request_t *request )
48 49 50
{
    MORSE_context_t *morse;
    MORSE_option_t options;
51 52
    size_t ws_worker = 0;
    size_t ws_host = 0;
53 54 55 56 57

    int k, m, n;
    int ldak, ldam;
    int tempkm, tempkn, tempmm, tempnn;
    int ib;
58
    int minMNT = chameleon_min(A->mt, A->nt);
59 60 61 62 63 64 65

    morse = morse_context_self();
    if (sequence->status != MORSE_SUCCESS)
        return;
    RUNTIME_options_init(&options, morse, sequence, request);

    ib = MORSE_IB;
66

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

75 76 77 78
    ws_worker *= sizeof(MORSE_Complex64_t);
    ws_host   *= sizeof(MORSE_Complex64_t);

    RUNTIME_options_ws_alloc( &options, ws_worker, ws_host );
79

80
    for (k = 0; k < minMNT; k++) {
81
        RUNTIME_iteration_push(morse, k);
82

83 84 85 86 87 88 89 90 91 92 93 94
        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);
        MORSE_TASK_zgetrf_incpiv(
            &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) ) {
95
#if defined(CHAMELEON_COPY_DIAG)
96 97 98 99
            MORSE_TASK_zlacpy(
                &options,
                MorseUpperLower, tempkm, tempkn, A->nb,
                A(k, k), ldak,
100
                D(k), ldak);
101
#endif
102 103 104 105 106 107 108 109 110
        }

        for (n = k+1; n < A->nt; n++) {
            tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
            MORSE_TASK_zgessm(
                &options,
                tempkm, tempnn, tempkm, ib, L->nb,
                IPIV(k, k),
                L(k, k), L->mb,
111
                D(k), ldak,
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
                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);
            MORSE_TASK_ztstrf(
                &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;
                MORSE_TASK_zssssm(
                    &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));
            }
        }
138 139

        RUNTIME_iteration_pop(morse);
140
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
141

142 143
    RUNTIME_options_ws_free(&options);
    RUNTIME_options_finalize(&options, morse);
144
    (void)D;
145
}