1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
**** PREPARATION ****
For compiling Normaliz the following libraries are needed:
* gmp with gmpxx
* boost (headers only)
* openmp enabled compiler (to use parallelization)
On Ubuntu the following packages should be installed:
sudo apt-get install g++ libgmp-dev libboost-dev cmake cmake-curses-gui
We offer two ways of compilation, either use the supplied makefile or use cmake to create a more powerfull makefile. cmake is also capable of generating compile instructions for other systems, like MS VS projects, etc.
REQUIRES some c++11 features, supported by:
gcc 4.4, clang 2.9, icc 12.0
See https://github.com/Normaliz/Normaliz/issues/26 for a more detailed discussion.
**** CMAKE ****
This has better capabilities to find libraries and allow to change settings with a nice interface. Furthermore it supports the compilation of the library as static and dynamic version, installation of the library.
We assume you start in the normaliz root dir (with subdirs source, examples, ...).
[1] Create a build directory where normaliz will be build and cd into it, e.g.
mkdir BUILD; cd BUILD
[2] Initial configuration, have a look at the next sections for further config infos.
(can be skipped if step [3] is done, but it shows some information about what compiler, libraries, etc. it uses)
cmake ../source
[3] (Optional) Check configuration and maybe edit something
ccmake ../source
In the ccmake interface you can use this workflow:
* c (for configure)
* change entries if you like, then press c again
* g (generate and exit)
[4] compile
make
This make has dependency checking included and other nice features.
If you want to see what happens behind the scenes use
make VERBOSE=1
[5] install it
make install
This will install the produced libnormaliz and the normaliz executable.
The path can be changed with ccmake (CMAKE_INSTALL_PREFIX).
**** ADDITIONAL CMAKE CONFIGURATION ****
If you want to override system defaults you can change values with ccmake or set enviroment variables.
IMPORTANT NOTE: Be aware that some of these only work with the first call of cmake. If you want to change it later clean your build directory first, or use another fresh build directory.
Some examples:
Specifiy installation location:
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/local ../source (default is /usr/local)
Different compiler:
CC=gcc-4 CXX=g++-4 cmake ../source/
Specify gmp dirs:
To specify search paths for gmp you can add before the cmake
GMP_DIR=/path/to/gmp (it will look inside for subfolders with the headers and lib)
If this is not successfull you can specify the paths seperatly:
GMP_INC_DIR=/path/to/include (for headers)
GMP_LIB_DIR=/path/to/lib (for libs)
e.g. to use your own gmp version installed to the 'local' folder in the home directory use
GMP_DIR=$HOME/local/ cmake ../source/
Change architecture:
For MacOS you can set CMAKE_OSX_ARCHITECTURES eigther with the cmake command-line option
-DCMAKE_OSX_ARCHITECTURES=x86_64
or by setting it in ccmake to x86_64.
See also: http://stackoverflow.com/questions/5334095/cmake-multiarchitecture-compilation
Specify Boost dirs:
BOOST_ROOT - Preferred installation prefix
BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include
BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib
Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not
specified by these hint variables. Default is OFF.
Boost_ADDITIONAL_VERSIONS - List of Boost versions not known to this module
(Boost install locations may contain the version)
See http://www.cmake.org/cmake/help/git-master/module/FindBoost.html
**** Using SCIP ****
Download scip at http://scip.zib.de/ . Notice that SCIP is not distributed under GPL, but the ZIB Academic License (http://scip.zib.de/academic.txt).
Unpack it and compile it with
make ZLIB=false GMP=false READLINE=false scipoptlib
(To compiling scip for 32bit systems, add also ARCH=x86 to the make.)
Then configure Normaliz with e.g.
SCIP_DIR=$HOME/scipoptsuite-3.2.0/ cmake ../source/ -DNMZ_SCIP=ON
Currently our cmake module to find scip only supports versions 3.1.1 and 3.2.0
on Linux 32 and 64 bit and MacOs X.
**** Build for Intel Xeon Phi Mic ****
This section describes how to compile Normaliz with support for offloading to Intel Xeon Phi. Only the Intel compiler supports this offload.
First you need (as usual) the libraries boost and gmp. The libgmp and libgmpxx must be compiled twice, once for the host and once for the target-architecture of the mic. You will probably not find a compiled version for the mic, so we recommend to compile both yourself. Download the gmp sources and extract them.
The following description is based on gmp 6.0.0 and icc 15.0.2
Compile gmp with icc:
cd gmp-6.0.0
mkdir BUILD_native
cd BUILD_native
CC=icc CXX=icpc ../configure --enable-cxx --prefix=$HOME/local/
make
make install
Compile gmp with icc for the mic:
cd gmp-6.0.0
mkdir BUILD_mic
cd BUILD_mic
CC=icc CXX=icpc CFLAGS="-mmic" CXXFLAGS="-mmic" LDFLAGS="-mmic" ../configure --host=x86_64-k1om-linux --enable-cxx --disable-assembly --prefix=$HOME/mic_local/
make
make install
The intel compiler had problems with User-defined literals from c++11, so I had to commend some lines (1925-1944) in $HOME/local/include/gmpxx.h and the same for the mic dir.
Now we are ready to compile Normaliz:
cd normaliz
mkdir BUILD_mic
cd BUILD_mic
CC=icc CXX=icpc GMP_DIR=$HOME/local MIC_GMP_DIR=$HOME/mic_local BOOST_ROOT=$HOME/boost_1_57_0 cmake -DNMZ_MIC_OFFLOAD=ON ../source/
make
If you get an error saying it cannot find boost/dynamic_bitset.hpp or similar, try to set BOOST_INCLUDE_DIR directly to a path which is not a system default path (e.g. by using "ccmake ." after the first configuration.)
If you want to compile Normaliz for running it NATIVELY on the Phi, give
CC=icc CXX=icpc GMP_DIR=$HOME/mic_local BOOST_ROOT=$HOME/boost_1_57_0 cmake -DCMAKE_CXX_FLAGS=-mmic ../source/
**** plain MAKE ****
You can still use our old simple plain Makefile. But the CMAKE configuration is much more powerfull.
1) Go to the source directory
2) Check the configurations in Makefile.configuration
3) Say "make"
It should work without changing the Makefile on many systems that have a system installation of the needed librarys.
This make accepts two optional arguments
make OPENMP=no # deactivates OpenMP
make SCIP=yes # compile with SCIP
You must make sure that everything is compiled with the same set of options!
In doubt use make clean before.
|