fflas-ffpack icon indicating copy to clipboard operation
fflas-ffpack copied to clipboard

Specialize fgemm checkers for large precision to check modulo some random primes

Open pascalgiorgi opened this issue 7 years ago • 3 comments

The fgemm checkers are designed to check FFLAS matrix multiplication using the Freivalds technique : to check C=AB, one can choose a vector v at random and check Cv = A (Bv).

This is of course appropriate when the Freivalds certification is computed with an exact calculation. However, using ZRing one cannot guarantee that Freivalds certificate does not lead to some overflow while the product itself does not. In such a case the fgemm checker will fail.

This issue appeared within the rns-double code that uses fgemm over ZRing instead of cblas_dgemm to allow parallel features of FFLAS. Right now, this has been avoided using some pragma switching to BLAS dgemm when checkers are activated.

pascalgiorgi avatar Apr 06 '17 13:04 pascalgiorgi

I do not understand. The checkers are generic they call fgemm or fgemv to perform the product, If there is a problem it comes from the fgemm or the fgemv ...

jgdumas avatar May 31 '17 07:05 jgdumas

I know that the checkers are generic but they are designed to work only for exact computation. Then if you perform a matrix product over double floating points, the product can be correct (e.g. less than 2^53) but applying Freivalds certificate may lead to overflow the mantissa and introduce roundoff errors. This causes the checkers to fail, this appeared with RNS code that uses this kind of matrix product.

pascalgiorgi avatar May 31 '17 07:05 pascalgiorgi

OK, this is not a bug, checkers indeed are made for correctness checking. For this, and also, say, for arbitrary precision checking, an idea would be to design specific checkers that perform the check modulo a random prime. I therefore relabelled to "enhancement"

jgdumas avatar May 31 '17 09:05 jgdumas