pzgetrf_nopiv.c 3.1 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
 *
10
 ***
11
 *
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,
31 32
                                RUNTIME_sequence_t *sequence,
                                RUNTIME_request_t *request)
33
{
Mathieu Faverge's avatar
Mathieu Faverge committed
34
    CHAM_context_t *chamctxt;
35
    RUNTIME_option_t options;
36 37 38 39 40

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

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
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
48
    RUNTIME_options_init(&options, chamctxt, sequence, request);
49

50
    ib = CHAMELEON_IB;
51

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

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

        options.priority = 2*A->nt - 2*k;
60
        INSERT_TASK_zgetrf_nopiv(
61 62 63 64 65
            &options,
            tempkm, tempkn, ib, A->mb,
            A(k, k), ldak, A->mb*k);

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

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

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