pzgetrf_nopiv.c 3.3 KB
Newer Older
1 2 3 4 5 6
/**
 *
 * @copyright (c) 2009-2014 The University of Tennessee and The University
 *                          of Tennessee Research Foundation.
 *                          All rights reserved.
 * @copyright (c) 2012-2014 Inria. All rights reserved.
7
 * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 *
 **/

/**
 *
 * @file pzgetrf_nopiv.c
 *
 *  MORSE auxiliary routines
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
 * @version 2.6.0
 * @author Omar Zenati
 * @author Mathieu Faverge
 * @author Emmanuel Agullo
 * @author Cedric Castagnede
 * @date 2013-02-01
 * @precisions normal z -> s d c
 *
 **/
28
#include "control/common.h"
29 30 31

#define A(m,n) A,  m,  n

Mathieu Faverge's avatar
Mathieu Faverge committed
32
/*******************************************************************************
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
 *  Parallel tile LU factorization with no pivoting - dynamic scheduling
 **/
void morse_pzgetrf_nopiv(MORSE_desc_t *A,
                                MORSE_sequence_t *sequence,
                                MORSE_request_t *request)
{
    MORSE_context_t *morse;
    MORSE_option_t options;

    int k, m, n, ib;
    int ldak, ldam;
    int tempkm, tempkn, tempmm, tempnn;

    MORSE_Complex64_t zone  = (MORSE_Complex64_t) 1.0;
    MORSE_Complex64_t mzone = (MORSE_Complex64_t)-1.0;

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

    ib = MORSE_IB;

56
    for (k = 0; k < chameleon_min(A->mt, A->nt); k++) {
57
        RUNTIME_iteration_push(morse, k);
58

59 60 61
        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);
62 63

        options.priority = 2*A->nt - 2*k;
64 65 66 67 68 69
        MORSE_TASK_zgetrf_nopiv(
            &options,
            tempkm, tempkn, ib, A->mb,
            A(k, k), ldak, A->mb*k);

        for (m = k+1; m < A->mt; m++) {
70
            options.priority = 2*A->nt - 2*k - m;
71 72 73 74 75 76 77 78 79 80 81
            tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
            ldam = BLKLDD(A, m);
            MORSE_TASK_ztrsm(
                &options,
                MorseRight, MorseUpper, MorseNoTrans, MorseNonUnit,
                tempmm, tempkn, A->mb,
                zone, A(k, k), ldak,
                      A(m, k), ldam);
        }
        for (n = k+1; n < A->nt; n++) {
            tempnn = n == A->nt-1 ? A->n-n*A->nb : A->nb;
82
            options.priority = 2*A->nt - 2*k - n;
83 84 85 86 87 88 89 90 91
            MORSE_TASK_ztrsm(
                &options,
                MorseLeft, MorseLower, MorseNoTrans, MorseUnit,
                tempkm, tempnn, A->mb,
                zone, A(k, k), ldak,
                      A(k, n), ldak);

            for (m = k+1; m < A->mt; m++) {
                tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
92
                options.priority = 2*A->nt - 2*k  - n - m;
93 94 95 96 97 98 99 100 101 102
                ldam = BLKLDD(A, m);
                MORSE_TASK_zgemm(
                    &options,
                    MorseNoTrans, MorseNoTrans,
                    tempmm, tempnn, A->mb, A->mb,
                    mzone, A(m, k), ldam,
                           A(k, n), ldak,
                    zone,  A(m, n), ldam);
            }
        }
103 104

        RUNTIME_iteration_pop(morse);
105
    }
106

107 108
    RUNTIME_options_finalize(&options, morse);
}