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

/**
 *
 * @file pztrsmpl.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.5.0
 * @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
 *
 **/
30
#include "control/common.h"
31 32 33 34 35

#define A(m,n) A,  m,  n
#define B(m,n) B,  m,  n
#define L(m,n) L,  m,  n
#define IPIV(m,n) &(IPIV[(int64_t)A->nb*((int64_t)(m)+(int64_t)A->mt*(int64_t)(n))])
Mathieu Faverge's avatar
Mathieu Faverge committed
36
/*******************************************************************************
37 38
 *  Parallel forward substitution for tile LU - dynamic scheduling
 **/
39 40
void morse_pztrsmpl( MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc_t *L, int *IPIV,
                     MORSE_sequence_t *sequence, MORSE_request_t *request )
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
{
    MORSE_context_t *morse;
    MORSE_option_t options;

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

    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 58
        tempkm   = k == A->mt-1 ? A->m-k*A->mb : A->mb;
        tempkn   = k == A->nt-1 ? A->n-k*A->nb : A->nb;
59
        tempkmin = k == chameleon_min(A->mt, A->nt)-1 ? chameleon_min(A->m, A->n)-k*A->mb : A->mb;
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
        ldak = BLKLDD(A, k);
        ldbk = BLKLDD(B, k);
        for (n = 0; n < B->nt; n++) {
            tempnn = n == B->nt-1 ? B->n-n*B->nb : B->nb;
            MORSE_TASK_zgessm(
                &options,
                tempkm, tempnn, tempkmin, ib, L->nb,
                IPIV(k, k),
                L(k, k), L->mb,
                A(k, k), ldak,
                B(k, n), ldbk);
        }
        for (m = k+1; m < A->mt; m++) {
            tempmm = m == A->mt-1 ? A->m-m*A->mb : A->mb;
            ldam = BLKLDD(A, m);
            ldbm = BLKLDD(B, m);
            for (n = 0; n < B->nt; n++) {
                tempnn  = n == B->nt-1 ? B->n-n*B->nb : B->nb;
                MORSE_TASK_zssssm(
                    &options,
                    A->nb, tempnn, tempmm, tempnn, tempkn, ib, L->nb,
                    B(k, n), ldbk,
                    B(m, n), ldbm,
                    L(m, k), L->mb,
                    A(m, k), ldam,
                    IPIV(m, k));
            }
        }
    }
    RUNTIME_options_finalize(&options, morse);
}