1Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 2Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com) 3See below for the copying conditions. 4 5 6Configuration of the Parma Polyhedra Library 7============================================ 8 9Contents 10-------- 11 12 1. The Standard Thing (configure, make, make install) 13 2. Using the Right Version of GMP 14 3. Using the Right C and C++ Compilers 15 4. Enabling the Use of Alternative Coefficient Types 16 5. Configuring the Language Interfaces 17 6. Configuring for Optimized Performance 18 7. Advanced Performance Tuning 19 8. Configuring for Debugging 20 9. Programs that Come with the Library 2110. Using the Git Sources 22 23 241. The Standard Thing (configure, make, make install) 25----------------------------------------------------- 26 27In an ideal situation (i.e., on a more or less standard Un*x 28environment, with the right C++ compiler to compile the core library 29as well as the right compilers to compile all the enabled language 30interfaces, with the GMP library installed in a standard place and 31provided the user is satisfied with all the options we chose as 32defaults), a source distribution of the Parma Polyhedra Library (PPL) 33can be unpacked, configured, built and installed with the following, 34well-known procedure: 35 36 $ tar jxf ppl-x.y.tar.bz2 37 $ ./configure 38 $ make 39 $ su 40 Password: <root password> 41 $ make install 42 43After successful completion of these steps the PPL is completely 44installed on the system and can be used as expected. 45 46On the other hand, the PPL `configure' shell script provides many 47options to customize the build and installation process. The 48`INSTALL' file gives a detailed description of the non PPL-specific 49aspects of the configuration, compilation and installation process and 50describes the basic options of the `configure' script. For a compact 51summary of all the available configuration options, run the command 52 53 $ ./configure --help 54 55The PPL-specific aspects of the configuration, compilation and 56installation process are discussed in the following sections. 57 58 592. Using the Right Version of GMP 60--------------------------------- 61 62In order to use this version of the PPL you must make sure that: 63 64(1) GMP version 4.1.3 or later is installed on your system; 65(2) that this version was compiled with the C++ interface enabled; 66(3) that this C++ interface was compiled with the same compiler 67 version with which you will compile the PPL; 68(4) that your C and C++ compilers and your linker will find _that_ 69 version of GMP and not others that may be present in your system. 70 71Some binary distributions of GMP may contain a version that was compiled 72with the C++ interface disabled, or compiled with a C++ compiler 73implementing a different ABI than the compiler you will use to compile 74the PPL. In these (increasingly rare) cases the only reliable way to 75ensure points (1), (2) and (3) above is to visit GMP's home page at 76 77 http://gmplib.org/ 78 79and download the last available version. Then decide where to install 80it and call this place in your file system <GMP prefix>. Then, unless 81you have special needs, you can invoke the GMP's configure script with 82the options 83 84 --prefix=<GMP prefix> --enable-cxx 85 86If the C++ compiler you will use to compile the PPL is not the default 87on your system then, in order to satisfy point (3) above, you should 88set the `CXX', `CXXFLAGS' and `CXXCPP' environment variables so as to 89use the intended compiler with the intended options. See the file 90`INSTALL.autoconf' in the GMP distribution for more on this subject. 91 92If you want to use the PPL ability to recover from out-of-memory 93situations, you should use a version of GMP compiled with GCC (which 94implies you should then compile also the PPL with GCC) using the 95`-fexceptions' option. To build such a version, you can use the 96`CPPFLAGS' environment variable, so that it contains (among possibly 97other compiler options) `-fexceptions'. Again, see `INSTALL.autoconf' 98in the GMP distribution for more on using environment variables to 99influence the configure script. 100 101In order to achieve point (4) above, if the directory <GMP prefix> 102is not standard for your compiler and/or for your linker, you will 103have to make sure the configure script of the PPL is invoked with, 104among others, the option 105 106 --with-gmp=<GMP prefix> 107 108If you use shared libraries, consult the documentation of your dynamic 109linker/loader (`man ld.so' will do on most Un*x-like systems) to see 110how to make sure that GMP's shared library will be found at run-time 111(setting the environment variable `LD_LIBRARY_PATH' to 112"<GMP prefix>/lib:$LD_LIBRARY_PATH" or 113"<GMP prefix>/lib64:$LD_LIBRARY_PATH" is the most commonly used 114solution). 115 116It is also possible to use a non-installed build of GMP. In order to 117do that you should configure the PPL with, among others, the option 118 119 --with-gmp-build=<GMP build directory> 120 121 1223. Using the Right C and C++ Compilers 123-------------------------------------- 124 125The configure script of the PPL, as you can see by using its `--help' 126option, besides recognizing `CC', `CXX', `CFLAGS', `CXXFLAGS' and 127other environment variables, provides four switches with which you can 128select the compilers and compilers' options to use for building the 129library. These switches are 130 131 --with-cc=XXX use XXX as the C compiler 132 --with-cxx=XXX use XXX as the C++ compiler 133 --with-cflags=XXX add XXX to the options for the C compiler 134 --with-cxxflags=XXX add XXX to the options for the C++ compiler 135 136Among other things, the ability to specify the C and C++ compilation 137flags allows you to use special compilation options ---such as 138`-fno-threadsafe-statics'--- that, while not safe for general use, 139may be adequate for your particular application. 140 141Let us take the occasion to stress, once again, the fact that you 142must use exactly the same C++ compiler to compile the C++ interface of GMP, 143the PPL and your application, if it uses the C++ interface of the PPL. 144It should be noted that no version of GCC prior to 4.0.3 is known to 145reliably compile PPL 0.10. 146 147Here is an example of a configuration that uses the Intel C/C++ compiler 148version 11.1.x. Assuming you have configured GMP with a command like 149 150 CC=icc CXX=icpc /path/to/gmp-5.0.1/configure --enable-cxx \ 151 --prefix=/opt/intel/Compiler/11.1/072 \ 152 --libdir=/opt/intel/Compiler/11.1/072/lib/intel64 153 154you can configure the PPL with a command like 155 156 /path/to/ppl-x.y/configure --with-cxx=icpc --with-cc=icc \ 157 --with-cxxflags=-pch \ 158 --with-gmp=/opt/intel/Compiler/11.1/072 159 160Notice that the `--with-cxxflags' option is not essential here and is 161only included to show how extra compiler options can be passed to the 162configure script. 163 164As another example, here is how you can compile the PPL with 165Comeau C/C++ 4.3.10.1. First configure GMP with a command like 166 167 CXX=como /path/to/gmp-5.0.1/configure --enable-cxx \ 168 --disable-shared --prefix=/opt/comeau/local 169 170Then you can configure the PPL with a command like 171 172 /path/to/ppl/configure --with-cc="como --c" --with-cxx="como -tused" \ 173 --with-cxxflags="-g++ --remarks --long_long \ 174 --display_error_number --diag_suppress 340,401,679" \ 175 --disable-shared --with-gmp=/opt/comeau/local 176 177Notice the use of the option `--disable-shared' both in the configuration 178of GMP and the configuration of the PPL. This is due to the fact that 179Comeau C/C++ 4.3.10.1 does not support shared libraries. 180 181 1824. Enabling the Use of Alternative Coefficient Types 183---------------------------------------------------- 184 185When speed is important and the numerical coefficients involved are 186likely to be small, you can configure the PPL to use checked native 187integers (8, 16, 32 or 64 bits wide) for the representation of the 188coefficients. This is a safe strategy since, when using checked 189native integers, the library also performs systematic (yet efficient) 190overflow detection and, in case of overflow, an exception is raised. 191To enable the use of various kinds of coefficients, you can use 192the configure option 193 194 --enable-coefficients=TYPE 195 196where TYPE is one of 197 198 mpz, use GMP unbounded integers (default); 199 checked-int8, use 8-bit checked integers; 200 checked-int16, use 16-bit checked integers; 201 checked-int32, use 32-bit checked integers; 202 checked-int64, use 64-bit checked integers. 203 204When using checked integers it is also wise to increase the 205optimization level, since their efficiency largely depends on the 206compiler and on the optimization options used. See below for how 207to do that (in later releases we may try to make the choice of the 208optimization options automatic). 209 210If you want to test the overhead of checked integers with respect 211to plain, unchecked native integers and you are really sure of what 212you are doing, you may be interested to know that these additional 213choices for TYPE are available: 214 215 native-int8, use 8-bit *unchecked* integers; 216 native-int16, use 16-bit *unchecked* integers; 217 native-int32, use 32-bit *unchecked* integers; 218 native-int64, use 64-bit *unchecked* integers. 219 220 2215. Configuring the Language Interfaces 222-------------------------------------- 223 224The PPL comes equipped with interfaces for several programming 225languages. Some of these interfaces are enabled by default, 226meaning that, if the configuration script finds support for 227a certain programming language, these interfaces are compiled 228(with `make') and installed (with `make install'). 229The set of enabled interface can be customized with the configure option 230 231 --enable-interfaces=INTERFACES 232 233The INTERFACES argument can be 234 235 none, no language interface is enabled; 236 all, all language interfaces are enabled; 237 238or any space-separated list of interface specifiers chosen among 239 240 cxx, the C++ interface; 241 c, the C interface; 242 java, the Java interface; 243 ocaml, the OCaml interface; 244 ciao_prolog, the Ciao Prolog interface; 245 gnu_prolog, the GNU Prolog interface; 246 sicstus_prolog, the SICStus Prolog interface; 247 swi_prolog, the SWI-Prolog interface; 248 xsb_prolog, the XSB interface; 249 yap_prolog, the YAP interface. 250 251Note that, in order to build any interface different from the C++ one, 252a recent enough version of GNU M4 is required (the configuration script 253searches for one and gives an error if it cannot find it). 254 255The instantiations for the domains for interfaces other than the main 256C++ interface can be customized via the `instantiations' option for 257the PPL `configure' shell script which is described below. Some 258interfaces depend on language implementations that are somewhat 259problematic, either because they tend to be installed in rather 260unpredictable places, or because some published versions have bugs 261that prevent the PPL interface to run correctly. In these cases, 262information is given in a README.* file. Presently we have: 263 264 README.java, 265 README.ocaml, 266 README.gprolog, 267 README.swiprolog, 268 README.yap. 269 270For the Java interface, the `--with-java=DIR' configure option allows 271to select the Java SDK root directory. We have tested the Java interface 272with the Java SE Development Kit 6 and OpenJDK 1.6. 273 274For the OCaml interface, the `--with-mlgmp=DIR' configure option allows 275to specify the installation directory of the ML GMP package (which allows 276to use GMP numbers in OCaml programs). By default, ML GMP is searched 277in the `gmp' subdirectory of the OCaml standard library directory. 278 279The C++ interface provides access to all the numerical abstractions 280provided by the PPL. The majority of these (we are talking about 281hundreds of different numerical abstractions) are provided by means 282of C++ templates. The other languages interfaced to the PPL, except 283Java, do not have this facility. Moreover, at the time of writing 284we do not know if and to which extent C++ templates can be mapped 285onto Java generics. As a result, for all the language interfaces 286but the C++ one, the instantiation of the template-based numerical 287abstractions must be done at library-compile-time (instead of 288application-compile-time). A small set of instantiations is enabled 289by default. Currently this set is given by 290 291 Polyhedron (which stands for both C_Polyhedron and NNC_Polyhedron), 292 Grid, 293 Rational_Box, 294 BD_Shape<mpz_class>, 295 BD_Shape<mpq_class>, 296 Octagonal_Shape<mpz_class>, 297 Octagonal_Shape<mpq_class>, 298 Constraints_Product<C_Polyhedron, Grid>, 299 Pointset_Powerset<C_Polyhedron>, 300 Pointset_Powerset<NNC_Polyhedron>, 301 302plus, if the host architecture supports double precision floating point 303numbers conforming to the IEEE 754 standard, 304 305 Double_Box, 306 BD_Shape<double>, 307 Octagonal_Shape<double>. 308 309To enable a different set of instantiations, the configure option 310 311 --enable-instantiations=INSTANTIATIONS 312 313The list of of possibilities for the `INSTANTIATIONS' argument can be 314obtained by omitting the argument, i.e., with the configure option 315 316 --enable-instantiations 317 318Note that the stand-alone `Polyhedron' instantiation must be specified 319without any topology `C_' or `NNC_' as they are added automatically 320and both the domains `C_Polyhedron' and `NNC_Polyhedron' will be 321generated. 322 323 3246. Configuring for Optimized Performance 325---------------------------------------- 326 327By default, the PPL is compiled with all the optimizations provided 328by the compiler that do not involve a space-speed tradeoff (a.k.a. 329-O2 optimization). The same optimization level can be obtained by 330using the configure options 331 332 --enable-optimization 333or 334 --enable-optimization=standard 335 336You can try to squeeze more speed from your compiler by using the 337`--enable-optimization=speed' compiler option (a.k.a. -O3 338optimization): this is recommended if you use the checked integers 339coefficients, even though it does not come with an 100% guarantee of 340extra performance. With the `--enable-optimization=sspeed' 341optimization even more optimization is requested, possibly at the cost 342of making debugging impossible on some machines. The 343`--enable-optimization=size' configure option instructs the compiler 344to optimize for size and for speed, but only for speed improvements do 345not increase code size. 346 347Further optimization can be requested at the expense of portability 348of the generated code. This can be achieved by means of the configure option 349 350 --enable-arch[=ARCH] 351 352If the ARCH argument is omitted the configure script attempts to 353detect the architecture of the system. Allowed values for ARCH can be 354found in the documentation of the `-march' option of the used C/C++ 355compiler. 356 357For floating point computations, the option 358 359 --enable-fpmath=INSTRUCTION_SET 360 361allows for selecting, on the IA32 and x86_64, the floating point instruction 362set. The allowed values for INSTRUCTION_SET are `sse', `sse2', `387, 363`sse+387', and `sse2+387', `default', and `no'. The latter option, which 364is equivalent to specifying `--disable-fpmath', has the effect of disabling 365all floating point computation and, consequently, all the numerical 366abstractions based on floating point numbers. 367 368On the other hand, there are configure options to request lesser 369degrees of optimization for the sake of debugging. These are, 370in decreasing order of optimization, `--enable-optimization=mild' 371(a.k.a. -O1 optimization), `--enable-optimization=no' or, equivalently 372`--disable-optimization', and `--enable-optimization=zero' 373(a.k.a. -O0 optimization). See below for more information on the 374configure options that are useful for debugging purposes. 375 376 3777. Advanced Performance Tuning 378------------------------------ 379 380Starting from version 1.0, the library fully supports two different 381representations for rows (i.e., sequences of coefficients): 382 383 - the "dense" representation is an array-like representation tailored 384 to sequences having most of their coefficients different from zero; 385 386 - the "sparse" representation saves memory space (as well as CPU 387 cycles) when most of the coefficients in the sequence are zero. 388 389A generic interface allows for a seamless interaction between the 390dense and the sparse row representation. Most library entities (linear 391expressions, constraints, generators, congruences, and their systems) 392can be built using either representation, specified as a constructor's 393argument. Reasonable default values for the row representation are 394provided for each library entity, automatically leading to significant 395memory space savings even in old client/library code, e.g., when 396dealing with constraint systems describing weakly relational 397abstractions such as boxes and octagonal shapes. 398 399If desired, these default values can be customized to user's needs by 400changing just a few lines of library code. For instance, the 401constraint systems stored inside C_Polyhedron and NNC_Polyhedron 402objects can be made to use the sparse representation by just changing 403the following line in Polyhedron_defs.hh: 404 405 static const Representation default_con_sys_repr = DENSE; 406 407to become 408 409 static const Representation default_con_sys_repr = SPARSE; 410 411 4128. Configuring for Debugging 413---------------------------- 414 415By default, the PPL is configured with debugging information enabled. 416In case you are absolutely, definitely, positively sure that you will 417not need to engage in debugging sessions and wish to save some little 418disk space and compilation time/memory you can configure with the 419`--disable-debugging' option. 420 421When the results you obtain with the PPL surprise you and make you think 422there might be a bug somewhere, it is a good idea to build a version 423of the library using the `--enable-assertions' configure option. This 424causes many run-time assertions to be checked and often result in the 425easier identification of bugs in your application or the library itself. 426Even more run-time assertions can be enabled with the 427`--enable-more-assertions': this causes some PPL objects to carry 428additional data fields for the purpose of making extra checks possible. 429Of course, this breaks the ABI of the library, so you should recompile 430the part of your application that depends on the PPL. 431 432If you are disappointed by performance of the library and would like 433to check where the computation time is being spent, you can use the 434`--enable-profiling' option to generate a version that writes profile 435information suitable for the `gprof' analysis program. 436 437The `--enable-valgrind-tests' causes most of the tests run by `make check' 438under Valgrind's Memcheck tool. This will show you if the library has 439memory leaks. At release time, we guarantee that Memcheck does not 440reveal any memory leak for tests using the C++ and the C interfaces. 441We are not able to make a similar guarantee for other interfaces because 442the corresponding language implementations (e.g., OCaml and SWI-Prolog) 443purposely do not deallocate all memory on exit. 444 445In order to assess the coverage of the PPL test suite, the 446`--enable-coverage' configure option is provided. This causes instrumented 447code to be used in conjunction with the `gcov' coverage testing tool. 448 449 4509. Programs that Come with the Library 451-------------------------------------- 452 453The PPL is shipped with two programs that are interesting per se, and 454allow to sanity-check the build as well as to obtain performance 455comparisons. The first such program is `ppl_lpsol', which offers some 456of the functionality of GLPK's `glpsol' using the service of the 457PPL, including its simplex solver. Since `ppl_lpsol' uses GLPK's 458input routines, it is only built if a suitable version of GLPK is 459available. If you prefer `ppl_lpsol' not to be built, use the 460configure option 461 462 --disable-ppl_lpsol 463 464Another program that is built by default and is used for regression 465testing and build validation is `ppl_lcdd'. This is a program for 466vertex/facet enumeration, accepting the same input format as the 467similar programs shipped with cddlib and lrslib. If you prefer `ppl_lcdd' 468not to be built, use the configure option 469 470 --disable-ppl_lcdd 471 472Disabling these programs will shorten the compilation time by a few 473seconds, and the time spent in `make check' by a dozen of minutes. 474In exchange, you will give up an important opportunity to discover 475whether the version of PPL you have built has been miscompiled. 476 477 47810. Using the Git Sources 479------------------------- 480 481If you use the Git sources, then you need recent versions of Autoconf 482Automake and Libtool installed. After a `git clone' or `git pull' 483you should run the `autoreconf' command. In case you have fiddled 484around with some of the configuration files, or if you have problems 485you cannot explain otherwise, use `autoreconf -f'. 486 487 488-------- 489 490Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 491Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com) 492 493This document describes the Parma Polyhedra Library (PPL). 494 495Permission is granted to copy, distribute and/or modify this document 496under the terms of the GNU Free Documentation License, Version 1.2 497or any later version published by the Free Software Foundation; 498with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. 499The license is included, in various formats, in the `doc' subdirectory 500of each distribution of the PPL in files named `fdl.*'. 501 502The PPL is free software; you can redistribute it and/or modify it 503under the terms of the GNU General Public License as published by the 504Free Software Foundation; either version 3 of the License, or (at your 505option) any later version. The license is included, in various 506formats, in the `doc' subdirectory of each distribution of the PPL in 507files named `gpl.*'. 508 509The PPL is distributed in the hope that it will be useful, but WITHOUT 510ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 511FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 512for more details. 513 514If you have not received a copy of one or both the above mentioned 515licenses along with the PPL, write to the Free Software Foundation, 516Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 517 518For the most up-to-date information see the Parma Polyhedra Library 519site: http://bugseng.com/products/ppl/ . 520