Skip to content

C3 Mirrors and symmetries ​

IDGroupTypeBackendsFigureProgram
C3ContractsCCPU (gfortran R4P, R8P, R16P; nvfortran); the CI matrixnogideon_test_properties

Case and scope ​

Exactness (C2) checks each kernel on polynomials. This case checks identities between kernels and invariances of each kernel on random data, bitwise: they hold in floating point because of how the kernels are written, and a change of the arithmetic (an operand order, a sign, a step) breaks them before it changes an order. The mirror identity is the rule that keeps ADAM's audit item A from recurring: a left-side kernel reads the right-side row backwards, and no left row is stored.

Models and numerics ​

ItemChoiceCode
Data20 trials of uniform random numbers in [−1/2,1/2) on the widest window, a fixed seedgideon_test_properties.F90
Mirrorkul(q~)=(−1)nkur(q) and kbl(q~)=kbr(q), q~o=q1−o (face windows, FV cells and FD points alike) or q−o (cell windows)
Symmetrya centred kernel on data of the parity that makes its result odd returns exactly 0: the pair form cm(qm±q−m) (node, cell) or cm(qm±q1−m) (face) cancels term by term
Scalingk(8q)=8k(q) and k(q,1.5)=k(q,0.75)/2n: powers of two are exact in binary
Constant dataa derivative in pair or flux-difference form returns exactly 0; a value returns the constant within 64 ε Σ|c|
Registrywhich kernel mirrors which (kmirror), which return 0 on a constant (kzero_const), all generatedgideon_test_registry.F90

Program ​

bash
./exe/gideon_test_properties

Results ​

PropertyKernelsTrialsComparison
left side = (−1)n right side on mirrored data10320bitwise
centred kernel on data of the odd symmetry returns 012620bitwise
k(8q)=8k(q), k(q,2Δs)=k(q,Δs)/2n33220bitwise
constant data: 0 for a derivative (pair or flux-difference form), the constant otherwise250 derivatives, 82 values1bitwise (derivatives), 64 eps Σ|c| (values)
BuildKernels (properties)FailuresKernels (dispatch)Failures
gfortran, R4P33203320
gfortran, R8P33203320
gfortran, R16P33203320
nvfortran -acc, R8P33203320

The dispatch columns are the run-time dispatchers of C4, run on the same builds.

Findings ​

  • Every identity holds bitwise in every kind and with both compilers, on the GPU build's host side too: the mirror is in the arithmetic, not only in the rows.
  • The bitwise mirror needs the left-side kernel to add the same products in the same order as its right twin. The generator emits both from one template, so a hand edit of one side breaks C3 at once (the mutants mirror-fv-face-ul3, mirror-sign-fv-face-d1-ul2, mirror-fd-face-ul3 and mirror-fd-face-bl5 of Mutation testing). The FD one-sided and biased face values of phase 2 follow the same rule: 13 more pairs.
  • The properties do not test accuracy: a kernel with a wrong but symmetric row passes C3 and fails C2 and A1.

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