SuperLU Distributed 9.0.0
gpu3d
l_panels_impl.hpp
Go to the documentation of this file.
1#pragma once
2// #include "lupanels.hpp"
3#include "xgstrf2.hpp"
4template <typename Ftype>
5xlpanel_t<Ftype>::xlpanel_t(int_t k, int_t *lsub, Ftype* lval, int_t *xsup, int_t isDiagIncluded)
6{
7 // set the value
8 val = lval;
9 int_t nlb = lsub[0];
10 int_t nzrow = lsub[1];
11 int_t lIndexSize = LPANEL_HEADER_SIZE + 2 * nlb + 1 + nzrow;
12 //
13 index = (int_t *)SUPERLU_MALLOC(sizeof(int_t) * lIndexSize);
14 index[0] = nlb;
15 index[1] = nzrow;
16 index[2] = isDiagIncluded; //either one or zero
17 index[3] = SuperSize(k);
18 index[LPANEL_HEADER_SIZE + nlb] = 0; // starting of prefix sum is zero
19 // now start the loop
20 int_t blkIdPtr = LPANEL_HEADER_SIZE;
21 int_t pxSumPtr = LPANEL_HEADER_SIZE + nlb + 1;
22 int_t rowIdxPtr = LPANEL_HEADER_SIZE + 2 * nlb + 1;
23 int_t lsub_ptr = BC_HEADER;
24 for (int_t lb = 0; lb < nlb; lb++)
25 {
31 int_t global_id = lsub[lsub_ptr];
32 int_t nrows = lsub[lsub_ptr + 1];
33
34 index[blkIdPtr++] = global_id;
35 index[pxSumPtr] = nrows + index[pxSumPtr - 1];
36 pxSumPtr++;
37
38 int_t firstRow = xsup[global_id];
39 for (int rowId = 0; rowId < nrows; rowId++)
40 {
41 //only storing relative distance
42 index[rowIdxPtr++] = lsub[lsub_ptr + LB_DESCRIPTOR + rowId] - firstRow;
43 }
44 // Update the lsub_ptr
45 lsub_ptr += LB_DESCRIPTOR + nrows;
46 }
47 return;
48}
49
50//TODO: can be optimized
51template <typename Ftype>
53{
54 for (int_t i = 0; i < nblocks(); i++)
55 {
56 if (k == gid(i))
57 return i;
58 }
59 //TODO: it shouldn't come here
61}
62
63template <typename Ftype>
64int_t xlpanel_t<Ftype>::panelSolve(int_t ksupsz, Ftype* DiagBlk, int_t LDD)
65{
66 if (isEmpty())
67 return 0;
68 Ftype* lPanelStPtr = blkPtr(0);
69 int_t len = nzrows();
70 if (haveDiag())
71 {
72 /* code */
73 lPanelStPtr = blkPtr(1);
74 len -= nbrow(0);
75 }
76 Ftype alpha = one<Ftype>(); // {1.0, 0.0}; std::complex<double> alpha = {1.0, 0.0};
77 superlu_trsm<Ftype>("R", "U", "N", "N",
78 len, ksupsz, alpha, DiagBlk, LDD,
79 lPanelStPtr, LDA());
80 return 0;
81}
82
83
84
85template <typename Ftype>
87threshPivValType<Ftype> thresh, int_t *xsup,
89 SuperLUStat_t *stat, int *info)
90{
91 // dgstrf2(k, val, LDA(), UBlk, LDU,
92 // thresh, xsup, options, stat, info);
93
94 xgstrf2<Ftype>(k, val, LDA(), UBlk, LDU,
95 thresh, xsup, options, stat, info);
96
97 return 0;
98}
99
100template <typename Ftype>
102{
103 assert(haveDiag());
104 assert(LDD >= nbrow(0));
105 int_t nsupc = nbrow(0);
106 for (int j = 0; j < nsupc; ++j)
107 {
108 memcpy(&DiagLBlk[j * LDD], &val[j * LDA()], nsupc * sizeof(Ftype));
109 }
110 return 0;
111}
112
113template <typename Ftype>
114int xlpanel_t<Ftype>::getEndBlock(int iSt, int maxRows)
115{
116 int nlb = nblocks();
117 if(iSt >= nlb )
118 return nlb;
119 int iEnd = iSt;
120 int ii = iSt +1;
121
122 while (
123 stRow(ii) - stRow(iSt) <= maxRows &&
124 ii < nlb)
125 ii++;
126
127#if 1
128 if (stRow(ii) - stRow(iSt) > maxRows)
129 iEnd = ii-1;
130 else
131 iEnd =ii;
132#else
133 if (ii == nlb)
134 {
135 if (stRow(ii) - stRow(iSt) <= maxRows)
136 iEnd = nlb;
137 else
138 iEnd = nlb - 1;
139 }
140 else
141 iEnd = ii - 1;
142#endif
143 return iEnd;
144}
int_t find(int_t k)
Definition: l_panels_impl.hpp:52
int_t packDiagBlock(Ftype *DiagLBlk, int_t LDD)
Definition: l_panels_impl.hpp:101
int_t diagFactor(int_t k, Ftype *UBlk, int_t LDU, threshPivValType< Ftype > thresh, int_t *xsup, superlu_dist_options_t *options, SuperLUStat_t *stat, int *info)
Definition: l_panels_impl.hpp:86
int getEndBlock(int iSt, int maxRows)
Definition: l_panels_impl.hpp:114
int_t panelSolve(int_t ksupsz, Ftype *DiagBlk, int_t LDD)
Definition: l_panels_impl.hpp:64
xlpanel_t()
Definition: xlupanels.hpp:43
typename std::conditional< std::is_same< Ftype, float >::value, float, typename std::conditional< std::is_same< Ftype, double >::value||std::is_same< Ftype, doublecomplex >::value, double, float >::type >::type threshPivValType
Definition: luAuxStructTemplated.hpp:70
#define LPANEL_HEADER_SIZE
Definition: lu_common.hpp:6
#define GLOBAL_BLOCK_NOT_FOUND
Definition: lupanels.hpp:16
integer, parameter, public lsub
Definition: superlupara.f90:35
Definition: util_dist.h:101
Definition: superlu_defs.h:728
#define SuperSize(bnum)
Definition: superlu_defs.h:271
int64_t int_t
Definition: superlu_defs.h:119
#define LB_DESCRIPTOR
Definition: superlu_defs.h:199
#define BC_HEADER
Definition: superlu_defs.h:198
int j
Definition: sutil_dist.c:287
int i
Definition: sutil_dist.c:287
#define SUPERLU_MALLOC(size)
Definition: util_dist.h:48