sequential_zpotrf.c 3.06 KB
Newer Older
Mathieu Faverge's avatar
Mathieu Faverge committed
1
2
/**
 *
3
 * @file sopalin_zpotrf.c
Mathieu Faverge's avatar
Mathieu Faverge committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 *  PaStiX factorization routines
 *  PaStiX is a software package provided by Inria Bordeaux - Sud-Ouest,
 *  LaBRI, University of Bordeaux 1 and IPB.
 *
 * @version 5.1.0
 * @author Pascal Henon
 * @author Xavier Lacoste
 * @author Pierre Ramet
 * @author Mathieu Faverge
 * @date 2013-06-24
 *
 * @precisions normal z -> s d c
 *
 **/
#include "common.h"
20
#include "isched.h"
21
#include "solver.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
22
#include "sopalin_data.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
23
#include "sopalin/coeftab_z.h"
24
#include "pastix_zcores.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
25

26
#if defined(PASTIX_WITH_PARSEC)
27
#include "parsec/pastix_zparsec.h"
28
#endif
Mathieu Faverge's avatar
Mathieu Faverge committed
29

30
#if defined(PASTIX_WITH_STARPU)
31
#include "starpu/pastix_zstarpu.h"
32
33
#endif

Mathieu Faverge's avatar
Mathieu Faverge committed
34
void
35
36
sequential_zpotrf( pastix_data_t  *pastix_data,
                   sopalin_data_t *sopalin_data )
Mathieu Faverge's avatar
Mathieu Faverge committed
37
{
38
39
40
41
    SolverMatrix       *datacode = pastix_data->solvmatr;
    SolverCblk         *cblk;
    double              threshold = sopalin_data->diagthreshold;
    pastix_complex64_t *work;
42
    pastix_int_t  i;
43
    (void)pastix_data;
44

45
46
    MALLOC_INTERN( work, datacode->gemmmax, pastix_complex64_t );

47
48
    cblk = datacode->cblktab;
    for (i=0; i<datacode->cblknbr; i++, cblk++){
49
50
51
52

        if ( cblk->cblktype & CBLK_IN_SCHUR )
            break;

53
        /* Compute */
54
        cpucblk_zpotrfsp1d( datacode, cblk, threshold, work );
55
    }
56

57
    memFree_null( work );
Mathieu Faverge's avatar
Mathieu Faverge committed
58
}
59
60

void
RAMET Pierre's avatar
RAMET Pierre committed
61
thread_pzpotrf( isched_thread_t *ctx, void *args )
62
{
63
64
65
66
67
    sopalin_data_t     *sopalin_data = (sopalin_data_t*)args;
    SolverMatrix       *datacode = sopalin_data->solvmtx;
    SolverCblk         *cblk;
    Task               *t;
    pastix_complex64_t *work;
68
69
    pastix_int_t  i, ii;
    pastix_int_t  tasknbr, *tasktab;
RAMET Pierre's avatar
RAMET Pierre committed
70
    int rank = ctx->rank;
71

72
73
    MALLOC_INTERN( work, datacode->gemmmax, pastix_complex64_t );

74
75
76
77
78
79
80
81
    tasknbr = datacode->ttsknbr[rank];
    tasktab = datacode->ttsktab[rank];

    for (ii=0; ii<tasknbr; ii++) {
        i = tasktab[ii];
        t = datacode->tasktab + i;
        cblk = datacode->cblktab + t->cblknum;

82
83
84
        if ( cblk->cblktype & CBLK_IN_SCHUR )
            continue;

85
86
87
        /* Wait */
        do {} while( cblk->ctrbcnt );

88
        /* Compute */
89
        cpucblk_zpotrfsp1d( datacode, cblk, sopalin_data->diagthreshold, work );
90
91
    }

92
    memFree_null( work );
93
94
}

95
96
97
98
99
100
void
thread_zpotrf( pastix_data_t  *pastix_data,
               sopalin_data_t *sopalin_data )
{
    isched_parallel_call( pastix_data->isched, thread_pzpotrf, sopalin_data );
}
101

102
static void (*zpotrf_table[4])(pastix_data_t *, sopalin_data_t *) = {
103
104
    sequential_zpotrf,
    thread_zpotrf,
105
106
107
#if defined(PASTIX_WITH_PARSEC)
    parsec_zpotrf,
#else
108
    NULL,
109
#endif
110
111
112
#if defined(PASTIX_WITH_STARPU)
    starpu_zpotrf
#else
113
    NULL
114
#endif
115
116
117
};

void
118
119
sopalin_zpotrf( pastix_data_t  *pastix_data,
                sopalin_data_t *sopalin_data )
120
{
121
122
    int sched = pastix_data->iparm[IPARM_SCHEDULER];
    void (*zpotrf)(pastix_data_t *, sopalin_data_t *) = zpotrf_table[ sched ];
123
124
125
126

    if (zpotrf == NULL) {
        zpotrf = thread_zpotrf;
    }
127
    zpotrf( pastix_data, sopalin_data );
128
129
130
131

#if defined(PASTIX_DEBUG_FACTO)
    coeftab_zdump( pastix_data, sopalin_data->solvmtx, "potrf.txt" );
#endif
132
}