FFLAS-FFPACK
Finite
field
linear algebra subroutines/package
Or, how to have
your computer doing linear algebra over finite fields almost as quickly
as over double
precision floating point numbers ?
[Presentation]
This project consists in the creation of a set of
routines,
giving the same tools as a set of classical Basic Linear Algebra
Subroutines, but working over finite fields. In the same
way, some other routines of higher level (such as the one in LAPACK)
are also produced.
The goal is to reach performances as close as possible
to
those of classical BLAS over double.
At this date, the work is split into two groups:
Here are two examples of the performances attained by our package
(speed is in Mffops == Millions of Finite Field operations per second):
| Package |
Exemple |
Matrices
Size
|
Field |
Time
|
Speed |
Processor |
| FFLAS |
Multiplication of two
dense matrices |
4000*4000 |
Z101 |
30.11
seconds |
4251.08
Mffops |
Pentium4-2.4 GHz |
| FFPACK |
LQUP
factorization |
7500*7500 |
Z101 |
103.00 seconds |
2733.00 Mffops |
Pentium4-2.4 GHz |
FFLAS
The core of the FFLAS library is the matrix matrix multiplication
routine. It's main characteristics are
-
Uses a generic field representation ( using the
C++ template mechanism). For our tests, we used the implementation of
finite fields provided by
Givaro, a package
for fast arithmetic over finite fields. The field archetype is the one
specified by the
LinBox library.
- Uses a generic BLAS to oper computations, after conversion from
finite fields to double, on submatrices. We only tested A.T.L.A.S., (a
portable BLAS using the Automated Empirical Optimisation of Software),
but we highly recommend it, for its performances and genericity.
- Is based on a Fast Matrix Multiplication Algorithm (Winograd's
variant
of Strassen's divide and conquer).
- Its genericity also permits to use it over double in order to benefit
from
the BLAS performances improved by the Winograd's algorithm.
The following left figure shows the improvement provided by the BLAS
(curve
3 and 4) despite the cost of the conversions to double with comparison
to a matrix multiplication without conversion (curve 2). It also
shows that the performances over finite fields tends asymptotically to
the performances
over double (curve 1).
The right figure emphasize the gain of Winograd's fast
matrix
multiplication algorithm compared to the O(n³) classic algorithm:
The combination of these two tunings leads to
pretty good performances: for example the speed of 4251.08 Mfops
is attained, on a P4-2.4 Ghz for the multiplication of two
dense matrices of size 4000*4000
over the finite field with 101 elements (this speed correspond to the
number
of millions of operations per second that would require a classic
matrix-multiplication
to compute the same result in the same time).
Triangularization
The second part of this project is the FFPACK package,
grouping different linear algebra routines of higher level.
Here again a core routine, the LQUP
factorization, is used in every other algorithm.
This package provides the following routines over a
finite field:
- LUP-LSP-LQUP and out-of-core (TURBO) matrix factorization
- Determinant, Rank computation
- Issingular determination
- Inversion
- Characteristic and minimal polynomial computation
Here again, the performances are very good: A
7500*7500 matrix is factorized in
103 seconds with a speed of
2733 Mops on a P4-2.4Ghz.
See here also the performances obtained for rank computations :
For comparison, the numerical LUP factorization of a 3000*3000
matrix using Lapack spends 6 seconds whereas our version over finite
fields needs 8.5 seconds.
[Benchmarks]
We give more detailed timing comparisons of the library on several architectures.
(in construction)
[Papers]
For further informations about this work, have a
look at:
- June 2001: Clément Pernet's technical report: Implementation of
Winograd's Algorithm over Finite Fields using ATLAS level3 BLAS
- June 2002: Morgan Brassel and Clément Pernet 's technical
report: LUdivine: une divine
factorisation LU, ( PPT in english, in french )
- August 2002: Our main preprint: Finite
Field Linear Algebra Subroutines, (PPT).
Jean-Guillaume Dumas, Thierry Gautier
and Clément Pernet
ISSAC'2002: International Symposium
on Symbolic and Algebraic Computations, 7-10 Juillet 2002, Lille,
France.
- April 2003: LUdivine:
A Symbolic block LU factorisation for matrices over finite fields using
BLAS.
Morgan Brassel, Pascal Giorgi and
Clément
Pernet
ECCAD'2003: East Coast Computer
Algebra Day, April 5th 2003, Clemson, South Carolina,
USA.
- July 2004:
Efficient dot product over finite fields.
Jean-Guillaume Dumas
CASC'2004 :
Computer Algebra in Scientific Computing, 12-19
Juillet 2004, Saint Petersburg, Russia.
- July 2004: Our second preprint:
FFPACK: Finite Field Linear Algebra Package.
Jean-Guillaume Dumas, Pascal Giorgi and Clément Pernet
ISSAC'2004 :
International Symposium on Symbolic and Algebraic Computations, 4-7
Juillet 2004, Santander, España.
- Sept. 2006: Clément Pernet's PhD thesis:
Algèbre linéaire exacte efficace: le calcul du polynome caractéristique
[Source Code]
You can download the source code and use it under terms of the the GNU-LGPL license:
To run it, you need to link to a BLAS library. We give here some implementations of the BLAS:
- ATLAS for an automatically tuned BLAS, working on most common architectures. Installation may take a while.
- The GNU Scientific Library for a quick installation but quite poor efficiency.
- GotoBLAS: a very good alternative for efficiency on many modern architectures. But licence is limited to a personnal-academic use.
Installation:
Simply untar the archive.
This is a source library, so you just have to include the fflas.h or ffpack.h files in your programs.
To compile the tests:
- edit tests/Makefile
- set the path to your BLAS library and uncomment appropriate lines
- make
[Contacts]
Please submit your questions, sugestions and bug reports to the discussion group
ffpack-devel.
Clément PERNET
Laboratoire de Modélisation et Calcul
B.P. 53 -- 51, av. des Mathématiques,
38041 Grenoble, France.
Clement.Pernet@imag.fr http://ljk.imag.fr/membres/Clement.Pernet |
Pascal Giorgi
Laboratoire de l'Informatique et du parallèlisme,
LIP-ENS Lyon.
46, allée d'Italie,
69364
Pascal.Giorgi@ens-lyon.fr
http://perso.ens-lyon.fr/pascal.giorgi
|
Jean-Guillaume DUMAS
Laboratoire de Modélisation et Calcul
B.P. 53 -- 51, av. des Mathématiques,
38041 Grenoble, France
Jean-Guillaume.Dumas@imag.fr http://ljk.imag.fr/membres/Jean-Guillaume.Dumas |
Thierry GAUTIER
Projet INRIA-APACHE, Laboratoire Informatique et Distribution
ZIRST - 51, av Jean Kuntzmann
38330 Montbonnot Saint-Martin, France.
Thierry.Gautier@inrialpes.fr http://www-id.imag.fr/~gautier |