Skip to content

C8 The line solvers ​

IDGroupTypeBackendsFigureProgram
C8ContractsCCPU (gfortran R4P, R8P, R16P; nvfortran; ifx); GPU (OpenACC)nogideon_test_solvers

Case and scope ​

Every compact operator ends in a solve along a line. This case checks the twenty solvers of gideon_line_solvers (tridiagonal and pentadiagonal, bounded and periodic, constant band, variable coefficients, masked rows, factored) against a dense solve that shares no code with them, on bands harder than any GIDEON operator's, and on the device against the host (roadmap #2, gates L3 and L5).

Models and numerics ​

ItemChoiceCode
Bandsrandom strictly diagonally dominant: off-diagonals in [−1,1], the diagonal of either sign, its dominance margin in [0.25,1.25]; lines of 3 (5) to 64 unknowns; 10 systems per lengthgideon_test_solvers.F90
ReferenceGaussian elimination with partial pivoting in real128 (real64 where the compiler has no real128)
Forward errormax|x−xref|≤64εcondmax|xref|, cond from Varah's bound ‖A‖/mini(|bi|−∑j|aij|)
Residualmax|Ax−d|≤64ε(‖A‖max|x|+max|d|), in real128
Never readon a bounded line, the coefficients outside it are NaN in the variable variant
Variants_const = _var on the same band, bitwise; _masked (30 % of the rows the identity) = _var on that band, bitwise, and each masked row returns exactly the value given
Device4 × 4096 lines in one !$acc parallel loop, one line per thread, against the host within the forward bound
Factoredon every constant band, one _factor and three right sides solved with it by _solve, each within the forward and residual bounds; on the device, one factor copied in once and 4 × 4096 lines solved with it, against the host

Program ​

bash
./exe/gideon_test_solvers

Results ​

BuildChecksFailures
gfortran, R4P363760
gfortran, R8P363760
gfortran, R16P363760
nvfortran -acc, R8P363680

On the GPU (the OpenACC build):

| Build | Solver | Band | Line | Lines bitwise equal to the host | Worst error / (cond max|x|) | |---|---|---|---|---|---| | nvfortran -acc, R8P | _var | tridiagonal | bounded | 4096 of 4096 | 0 | | nvfortran -acc, R8P | _var | tridiagonal | periodic | 4096 of 4096 | 0 | | nvfortran -acc, R8P | _var | pentadiagonal | bounded | 4096 of 4096 | 0 | | nvfortran -acc, R8P | _var | pentadiagonal | periodic | 4096 of 4096 | 0 | | nvfortran -acc, R8P | _factor + _solve | tridiagonal | bounded | 4096 of 4096 | | | nvfortran -acc, R8P | _factor + _solve | tridiagonal | periodic | 4096 of 4096 | | | nvfortran -acc, R8P | _factor + _solve | pentadiagonal | bounded | 4096 of 4096 | | | nvfortran -acc, R8P | _factor + _solve | pentadiagonal | periodic | 4096 of 4096 | |

Findings ​

  • The solvers meet the forward and residual bounds on every band and length, in every kind; the three variants agree bitwise because they are one template with the coefficient written three ways.
  • The periodic pentadiagonal border was first solved by Cramer's rule: a border row replaced by the identity came back rounded off its given value (r1*s22/det is not r1). Elimination with the first border row as pivot returns it exactly; the Schur complement of a dominant band is dominant, so no pivoting is needed.
  • The factored solves (_factor once, _solve per line) meet the same bounds; one factor serves every line, on the device as on the host. Their first pentadiagonal factor read the previous rows of fac back inside its row loop, and nvfortran 26.9 at -O2 vectorised that loop as if its iterations were independent (rows 2–4 unreduced; right at -O0, with gfortran and with ifx): this test caught it on the nvfortran builds. The previous rows are now carried in scalars.
  • Every GIDEON band is diagonally dominant or symmetric positive definite (gideon_fd_d1_p10's is the latter only): elimination without pivoting is stable for both. The test's bands are dominant; the positive definite one is exercised by A4.
  • On the device the lines are bitwise equal to the host's: the solvers' arithmetic has nothing for the compiler to contract differently.

Released under your choice of GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT.