pzgetrf_nopiv.c 3.09 KB
Newer Older
1
/**
2 3
 *
 * @file pzgetrf_nopiv.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_nopiv parallel algorithm
13
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
14
 * @version 1.0.0
15 16 17 18 19 20 21
 * @author Omar Zenati
 * @author Mathieu Faverge
 * @author Emmanuel Agullo
 * @author Cedric Castagnede
 * @date 2013-02-01
 * @precisions normal z -> s d c
 *
22
 */
23
#include "control/common.h"
24 25 26

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

27
/**
28
 *  Parallel tile LU factorization with no pivoting - dynamic scheduling
29
 */
Mathieu Faverge's avatar
Mathieu Faverge committed
30
void chameleon_pzgetrf_nopiv(CHAM_desc_t *A,
Mathieu Faverge's avatar
Mathieu Faverge committed
31 32
                                RUNTIME_sequence_t *sequence,
                                RUNTIME_request_t *request)
33
{
Mathieu Faverge's avatar
Mathieu Faverge committed
34
    CHAM_context_t *chamctxt;
Mathieu Faverge's avatar
Mathieu Faverge committed
35
    RUNTIME_option_t options;
36 37 38 39 40

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

Mathieu Faverge's avatar
Mathieu Faverge committed
41 42
    CHAMELEON_Complex64_t zone  = (CHAMELEON_Complex64_t) 1.0;
    CHAMELEON_Complex64_t mzone = (CHAMELEON_Complex64_t)-1.0;
43

Mathieu Faverge's avatar
Mathieu Faverge committed
44
    chamctxt = chameleon_context_self();
Mathieu Faverge's avatar
Mathieu Faverge committed
45
    if (sequence->status != CHAMELEON_SUCCESS)
46
        return;
Mathieu Faverge's avatar
Mathieu Faverge committed
47
    RUNTIME_options_init(&options, chamctxt, sequence, request);
48

Mathieu Faverge's avatar
Mathieu Faverge committed
49
    ib = CHAMELEON_IB;
50

51
    for (k = 0; k < chameleon_min(A->mt, A->nt); k++) {
Mathieu Faverge's avatar
Mathieu Faverge committed
52
        RUNTIME_iteration_push(chamctxt, k);
53

54 55 56
        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);
57 58

        options.priority = 2*A->nt - 2*k;
Mathieu Faverge's avatar
Mathieu Faverge committed
59
        INSERT_TASK_zgetrf_nopiv(
60 61 62 63 64
            &options,
            tempkm, tempkn, ib, A->mb,
            A(k, k), ldak, A->mb*k);

        for (m = k+1; m < A->mt; m++) {
65
            options.priority = 2*A->nt - 2*k - m;
66 67
            tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
            ldam = BLKLDD(A, m);
Mathieu Faverge's avatar
Mathieu Faverge committed
68
            INSERT_TASK_ztrsm(
69
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
70
                ChamRight, ChamUpper, ChamNoTrans, ChamNonUnit,
71 72 73 74 75 76
                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;
77
            options.priority = 2*A->nt - 2*k - n;
Mathieu Faverge's avatar
Mathieu Faverge committed
78
            INSERT_TASK_ztrsm(
79
                &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
80
                ChamLeft, ChamLower, ChamNoTrans, ChamUnit,
81 82 83 84 85 86
                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;
87
                options.priority = 2*A->nt - 2*k  - n - m;
88
                ldam = BLKLDD(A, m);
Mathieu Faverge's avatar
Mathieu Faverge committed
89
                INSERT_TASK_zgemm(
90
                    &options,
Mathieu Faverge's avatar
Mathieu Faverge committed
91
                    ChamNoTrans, ChamNoTrans,
92 93 94 95 96 97
                    tempmm, tempnn, A->mb, A->mb,
                    mzone, A(m, k), ldam,
                           A(k, n), ldak,
                    zone,  A(m, n), ldam);
            }
        }
98

Mathieu Faverge's avatar
Mathieu Faverge committed
99
        RUNTIME_iteration_pop(chamctxt);
100
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
101

Mathieu Faverge's avatar
Mathieu Faverge committed
102
    RUNTIME_options_finalize(&options, chamctxt);
103
}