Initial commit

parents
This diff is collapsed.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
SUBDIRS = . src
EXTRA_DIST = external_libs/mpfq.tar.gz check.sh patch_OpenBLAS.diff\
external_libs/fflas-ffpack-2.0.0.tar.gz external_libs/givaro-3.8.0.tar.gz external_libs/v0.2.14.tar.gz\
README\
tests/bilinaff_2_2_2147483659.sys \
tests/bilinaff_2_2_65521.sys \
tests/bilinaff_2_3_2147483659.sys \
tests/bilinaff_2_3_65521.sys \
tests/bilinaff_2_7_2147483659.sys \
tests/bilinaff_2_7_65521.sys \
tests/bilinaff_3_3_2147483659.sys\
tests/bilinaff_3_3_65521.sys\
tests/bilinaff_3_6_2147483659.sys\
tests/bilinaff_3_6_65521.sys\
tests/quadaff_2_2147483659.sys\
tests/quadaff_2_65521.sys\
tests/quadaff_3_2147483659.sys\
tests/quadaff_3_65521.sys\
tests/quadaff_4_2147483659.sys\
tests/quadaff_4_65521.sys\
tests/quadaff_5_2147483659.sys\
tests/quadaff_5_65521.sys\
tests/quadaff_6_2147483659.sys\
tests/quadaff_6_65521.sys\
tests/quadaff_7_2147483659.sys\
tests/quadaff_7_65521.sys\
tests/quaddense_2_2147483659.sys\
tests/quaddense_2_65521.sys\
tests/quaddense_3_2147483659.sys\
tests/quaddense_3_65521.sys\
tests/quaddense_4_2147483659.sys\
tests/quaddense_4_65521.sys\
tests/quaddense_5_2147483659.sys\
tests/quaddense_5_65521.sys\
tests/quaddense_6_2147483659.sys\
tests/quaddense_6_65521.sys\
tests/quaddense_7_2147483659.sys\
tests/quaddense_7_65521.sys\
tests/quaddense_8_2147483659.sys\
tests/quaddense_8_65521.sys\
tests/bilinaff_2_2_2147483659.gb \
tests/bilinaff_2_2_65521.gb \
tests/bilinaff_2_3_2147483659.gb \
tests/bilinaff_2_3_65521.gb \
tests/bilinaff_2_7_2147483659.gb \
tests/bilinaff_2_7_65521.gb \
tests/bilinaff_3_3_2147483659.gb\
tests/bilinaff_3_3_65521.gb\
tests/bilinaff_3_6_2147483659.gb\
tests/bilinaff_3_6_65521.gb\
tests/quadaff_2_2147483659.gb\
tests/quadaff_2_65521.gb\
tests/quadaff_3_2147483659.gb\
tests/quadaff_3_65521.gb\
tests/quadaff_4_2147483659.gb\
tests/quadaff_4_65521.gb\
tests/quadaff_5_2147483659.gb\
tests/quadaff_5_65521.gb\
tests/quadaff_6_2147483659.gb\
tests/quadaff_6_65521.gb\
tests/quadaff_7_2147483659.gb\
tests/quadaff_7_65521.gb\
tests/quaddense_2_2147483659.gb\
tests/quaddense_2_65521.gb\
tests/quaddense_3_2147483659.gb\
tests/quaddense_3_65521.gb\
tests/quaddense_4_2147483659.gb\
tests/quaddense_4_65521.gb\
tests/quaddense_5_2147483659.gb\
tests/quaddense_5_65521.gb\
tests/quaddense_6_2147483659.gb\
tests/quaddense_6_65521.gb\
tests/quaddense_7_2147483659.gb\
tests/quaddense_7_65521.gb\
tests/quaddense_8_2147483659.gb\
tests/quaddense_8_65521.gb
all: include/mpfq/mpfq.h lib/libgivaro.a lib/libopenblas.a include/fflas-ffpack/fflas-ffpack.h
lib/libgivaro.a:
cd external_libs/givaro-3.8.0 && make && make install
lib/libopenblas.a:
cd external_libs/OpenBLAS-0.2.14 && make && make install PREFIX=$(CURDIR)
include/fflas-ffpack/fflas-ffpack.h: lib/libgivaro.a lib/libopenblas.a
cd external_libs/fflas-ffpack-2.0.0 &&\
./configure --with-givaro=. --with-blas-libs=$(CURDIR)/lib/libopenblas.a \
--with-blas-cflags=-I./include --enable-optimization --prefix=$(CURDIR) &&\
make && make install
include/mpfq/mpfq.h:
cd external_libs/mpfq && cd build && cmake ../src -DCMAKE_INSTALL_PREFIX=../../../ && make && \
make install \
&& cp include/mpfq_fixmp.h ../../../include/mpfq
TESTS = \
tests/bilinaff_2_2_2147483659.sys \
tests/bilinaff_2_2_65521.sys \
tests/bilinaff_2_3_2147483659.sys \
tests/bilinaff_2_3_65521.sys \
tests/bilinaff_2_7_2147483659.sys \
tests/bilinaff_2_7_65521.sys \
tests/bilinaff_3_3_2147483659.sys\
tests/bilinaff_3_3_65521.sys\
tests/bilinaff_3_6_2147483659.sys\
tests/bilinaff_3_6_65521.sys\
tests/quadaff_2_2147483659.sys\
tests/quadaff_2_65521.sys\
tests/quadaff_3_2147483659.sys\
tests/quadaff_3_65521.sys\
tests/quadaff_4_2147483659.sys\
tests/quadaff_4_65521.sys\
tests/quadaff_5_2147483659.sys\
tests/quadaff_5_65521.sys\
tests/quadaff_6_2147483659.sys\
tests/quadaff_6_65521.sys\
tests/quadaff_7_2147483659.sys\
tests/quadaff_7_65521.sys\
tests/quaddense_2_2147483659.sys\
tests/quaddense_2_65521.sys\
tests/quaddense_3_2147483659.sys\
tests/quaddense_3_65521.sys\
tests/quaddense_4_2147483659.sys\
tests/quaddense_4_65521.sys\
tests/quaddense_5_2147483659.sys\
tests/quaddense_5_65521.sys\
tests/quaddense_6_2147483659.sys\
tests/quaddense_6_65521.sys\
tests/quaddense_7_2147483659.sys\
tests/quaddense_7_65521.sys\
tests/quaddense_8_2147483659.sys\
tests/quaddense_8_65521.sys
TEST_EXTENSIONS = .sys
SYS_LOG_COMPILER = ./check.sh
tinygb v1.1
-----------
tinygb is a Gröbner basis engine that relies on the MPFQ library and
partially on FFLAS-FFPACK and OpenBLAS for linear algebra computations.
Installation and usage notes
----------------------------
This is an experimental and minimal version of the software, which
includes only support (at this time) for prime fields of cardinality
at most 2^128. The two only supported monomial ordering are "grevlex"
and "lex". Support for other monomial ordering and for more finite
fields will soon will added.
I - Installation
-----------------
Requirements: the installation of tinygb requires a c++ compiler, a fortran
compiler, libtool, gmp (at least version 4.0.0 with support for c++), and
cmake.
If you are installing tinygb from a release version (.tar.gz), run the commands
./configure --prefix=<PREFIX_DIR>
make
make install
The program tinygb will be installed in <PREFIX_DIR>/bin (the default value of
<PREFIX_DIR> is /usr/local)
If you are installing from the git repository, you need autotools to generate
the script ./configure. In this case, run the commands
autoreconf --install
./configure --prefix=<PREFIX_DIR>
make
make install
II - Checking the installation
------------------------------
Running the command
make check
in the build directory verifies that the program has been correctly compiled.
III - Usage
-----------
1) Input format
tinygb takes as input a polynomial system in the following format:
- the first line is the number of variables
- the second line is the cardinality of the field
- the next lines contains the list of terms of the polynomials, each
line is a element of the finite field followed by the vector of
exponents of the corresponding monomial. Polynomials are ended
by a line containing a semicolon. Examples are provided in the
directory "tests".
By default tinygb reads the standard input. For reading the system from a file,
use the option -i
tinygb -i <INPUT_FILE>
2) Output format
tinygb outputs the Gröbner basis of the system with the same format as the
input system. By default, it outputs the Gröbner basis on the standard output.
To write the Gröbner basis in a file, use the option -o:
tinygb -o <OUTPUT_FILE>
IV - Libraries included in the distribution
-------------------------------------------
tinygb is distributed with the sources of the libraries MPFQ-1.1 (under licence
LGPL-2.1, modified), FFLAS-FFPACK-2.0.0 (under licence LGPL-2.1++), Givaro-3.8
(under licence CeCILL-B V1), and OpenBLAS-0.2.14 (under BSD licence, modified).
The only modification of OpenBLAS-0.2.14 is a line on top of the Makefile to
ensure build a monothreaded version of the library. The modifications on the
sources of MPFQ are located in the file src/FieldList-Small.txt: only the
finite field used in tinygb are listed there. The sources of external libraries
are located in the directory external_libs of tinygb.
#!/bin/bash
echo -n "$1 --- "
./src/tinygb < $1 | diff - tests/$(basename -s .sys $1).gb
AC_INIT([tinygb], [0.1], [pierre-jean.spaenlehauer@inria.fr])
: ${CXXFLAGS=""}
if test -z "$BASH_VERSION$CONFIG_SHELL"
then
CONFIG_SHELL=bash
export CONFIG_SHELL
if $CONFIG_SHELL -c "exit 0"
then
exec $CONFIG_SHELL $0 "$@"
fi
fi
cd external_libs
#wget -nc https://forge.imag.fr/frs/download.php/592/givaro-3.8.0.tar.gz
#wget -nc http://linalg.org/fflas-ffpack-2.0.0.tar.gz
#wget -nc http://github.com/xianyi/OpenBLAS/archive/v0.2.14.tar.gz
tar xzf givaro-3.8.0.tar.gz
tar xzf fflas-ffpack-2.0.0.tar.gz
tar xzf v0.2.14.tar.gz
tar xzf mpfq.tar.gz
cd givaro-3.8.0
./configure --prefix $PWD/../..
cd ..
mkdir mpfq/build
cd ..
mkdir include
mkdir lib
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CXX
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
This diff is collapsed.
*** external/OpenBLAS-0.2.14/Makefile 2016-02-06 19:18:00.151424800 +0100
--- external/OpenBLAS-0.2.14/Makefilediff 2016-02-06 19:18:20.199310058 +0100
***************
*** 1,3 ****
--- 1,5 ----
+ USE_THREAD = 0
+
TOPDIR = .
include ./Makefile.system
/* Copyright (C) 2016 tinygb
* Written by <pierre-jean.spaenlehauer@inria.fr>
*
* ========LICENCE========
* This file is part of tinygb.
*
* FFLAS-FFPACK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*
*/
#ifndef _F4_laucher_h
#define F4_launcher_h
#include "algos.h"
#include "polynomial.h"
#include "parser.h"
//template <class T>
//void magma_verif_fprint(const vector<polynomial<T> >&, const vector<polynomial<T> >&);
void launchF4(std::istream&, std::ostream&);
void initF4(std::istream&, std::ostream&);
template <class T>
void field_init();
template <class T>
void field_clear();
#include "F4_launcher.tpp"
#endif
/* Copyright (C) 2016 tinygb
* Written by <pierre-jean.spaenlehauer@inria.fr>
*
* ========LICENCE========
* This file is part of tinygb.
*
* FFLAS-FFPACK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*
*/
template <class T>
void launchF4(istream &in, ostream &out)
{
log(LOG_INFO) << "begin parsing" << endl;
Parser<T> pp(in);
vector<polynomial<T> > sys = pp.parse();
log(LOG_INFO) << "parsing done" << endl;
vector<polynomial<T> > G;
F4<T>(sys, G);
// if(!G.empty())
// magma_verif_fprint<T>(sys, G, "verif.mgm");
for(typename std::vector<polynomial <T>>::const_iterator it = G.begin(); \
it != G.end(); ++it)
{
it->print(out);
out << std::endl;
}
}
void initF4(istream &in, ostream &out)
{
log(LOG_INFO) << "Initialization" << endl;
string s;
in >> s;
N = (unsigned)atoi(s.c_str());
in >> s;
mpz_set_str(cardfield, s.c_str(), 10);
log(LOG_INFO) << N << " variables" << endl;
mpz_t max64b;
mpz_init(max64b);
mpz_set_str(max64b, "18446744073709551615", 10);
out << s << std::endl;
out << N << std::endl;
if (mpz_cmp_ui(cardfield, 65521) <= 0)
{
mpfq_p_0_5_field_init(GFp_05::k);
mpfq_p_0_5_field_specify(GFp_05::k, MPFQ_PRIME_MPZ, cardfield);
BLASFLAG = true;
launchF4<GFp_05>(in,out);
mpfq_p_0_5_field_clear(GFp_1::k); // clearing field
}
else if (mpz_cmp(cardfield, max64b) <= 0)
{
mpfq_pm_1_field_init(GFp_1::k);
mpfq_pm_1_field_specify(GFp_1::k, MPFQ_PRIME_MPZ, cardfield);
launchF4<GFp_1>(in, out);
mpfq_pm_1_field_clear(GFp_1::k);
}
else log(LOG_ERROR) << "field not supported" << endl;
mpz_clear(max64b);
}
bin_PROGRAMS = tinygb
tinygb_SOURCES = main.cc algos.h critpair.h field.h linalg.h \
monomial.h param.h parser.h polymat.h polynomial.h timer.h algos.tpp \
critpair.tpp linalg_blas.tpp linalg.tpp monomial.tpp parser.tpp \
polymat.tpp polynomial.tpp fields/gf2_10.inl fields/gf2_30.inl \
fields/gfp_05.inl fields/gfp_1.inl fields/gfp_2.inl fields/gf2_10.tpp \
fields/gf2_30.tpp fields/gfp_05.tpp fields/gfp_1.tpp fields/gfp_2.tpp \
annotator.h F4_launcher.h F4_launcher.tpp
tinygb_CXXFLAGS = -I../include -I../include/mpfq -O3 -funroll-loops -std=c++11 -DNDEBUG -fopenmp
tinygb_LDADD = ../lib/mpfq-1.2/libmpfq_p_0_5.a ../lib/mpfq-1.2/libmpfq_pm_1.a -lgmp -lm ../lib/libopenblas.a ../lib/libgivaro.a -lgmpxx
tinygb_LDFLAGS = -static
/* Copyright (C) 2016 tinygb
* Written by <pierre-jean.spaenlehauer@inria.fr>
*
* ========LICENCE========
* This file is part of tinygb.
*
* FFLAS-FFPACK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*
*/