1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
// =============================================================================
// === GPUQREngine/Include/GPUQREngine_Front.hpp ===============================
// =============================================================================
//
// The Front is a principal class in the GPUQREngine.
//
// Fronts wrap all metadata required to complete its factorization.
// When involved in a sparse factorization, additional metadata is present in
// the SparseMeta member, "sparseMeta."
//
// =============================================================================
#ifndef GPUQRENGINE_FRONT_HPP
#define GPUQRENGINE_FRONT_HPP
#include "GPUQREngine_Common.hpp"
#include "GPUQREngine_SparseMeta.hpp"
#include "GPUQREngine_FrontState.hpp"
class Front
{
public:
Int fids; // Front id within a stage
Int pids; // Parent front id within a stage
Int fidg; // Front id global to problem
Int pidg; // Parent id global to problem
Int fm; // # rows
Int fn; // # cols
Int rank; // (derived) MIN(fm, fn)
// adv layout options
bool isColMajor; // default:F
Int ldn; // user-specified desired leading dim
double *F; // Front data
double *gpuF; // The frontal matrix on the GPU.
double *cpuR; // The cpu location of the R factor.
FrontState state; // The front factorization state
Int *Stair; // The staircase allows us to exploit block zeroes.
/* Extension to support sparse factorization. */
SparseMeta sparseMeta;
/* Debug Fields */
bool printMe;
void* operator new(long unsigned int reqMem, Front* ptr){ return ptr; }
Front(
Int fids_arg, // the front identifier
Int pids_arg, // the parent identifier
Int fm_arg, // the # of rows in the front
Int fn_arg, // the # of cols in the front
bool isColMajor_arg=false, // whether the front is col-major
Int ldn_arg=EMPTY) // the leading dimension
{
fids = fids_arg ;
pids = pids_arg ;
fidg = EMPTY;
pidg = EMPTY;
fm = fm_arg ;
fn = fn_arg ;
rank = MIN(fm, fn);
isColMajor = isColMajor_arg ;
ldn = (ldn_arg == EMPTY ? fn : ldn_arg) ;
F = NULL;
gpuF = NULL;
cpuR = NULL;
state = ALLOCATE_WAIT;
Stair = NULL;
sparseMeta = SparseMeta();
printMe = false;
}
~Front()
{
// for the sparse case, F is NULL on the CPU
F = (double *) SuiteSparse_free (F) ;
}
bool isAllocated
(
void
)
{
return gpuF != NULL;
}
bool isDense
(
void
)
{
// NOTE: this code is tested by the SPQR/Tcov test, but that test does
// not flag this line as being tested in the coverage output. This is
// determined by commenting out the following line, and seeing it
// trigger under 'make' in SPQR/Tcov:
// { fprintf (stderr, "statement tested!\n") ; exit (0) ; }
// This same problem occurs elsewhere in GPUQREngine/Include/*
// and thus only affects *.hpp files #include'd in other files.
// The optimizer must be getting in the way, or some related effect.
return (!sparseMeta.isSparse);
}
bool isSparse
(
void
)
{
// NOTE: also tested by SPQR/Tcov, but not flagged as such in cov output
return (sparseMeta.isSparse);
}
bool isStaged
(
void
)
{
// NOTE: also tested by SPQR/Tcov, but not flagged as such in cov output
return (isSparse() && sparseMeta.isStaged);
}
bool isPushOnly
(
void
)
{
return (isSparse() && sparseMeta.pushOnly);
}
size_t getNumFrontValues
(
void
)
{
return fm * fn;
}
size_t getNumRValues
(
void
)
{
return rank * fn;
}
bool isTooBigForSmallQR
(
void
)
{
return (fm > 96 || fn > 32);
}
};
#endif
|