How to build
Warning: This section is out of date. See Gitlab repository for more details.
Contents
Installation
To make this work from plain Ubuntu installation, run
sudo apt-get install cmake doxygen graphviz libboost-dev libhdf5-serial-dev
git clone https://gitlab.com/e62Lab/e62numcodes.git
cd e62numcodes
./run_tests.sh
which installs dependencies, clones the repository, goes into the root folder of the repository and runs tests. This will check the configuration, notify you of potentially missing dependencies, build and run all tests, check code style and docs. If this works, you are ready to go! Otherwise, install any missing packages and if it still fails, raise an issue!
Building
List of dependencies:
- Build tools, like
cmake >= 2.8.12
,g++ >= 4.8
,make
- Boost
-
doxygen >= 1.8.8
and Graphviz - for IO HDF5 library
Out of source builds are preferred. Run
mkdir -p build
cd build
cmake ..
make
Note that you only have to run cmake
once, after that only make
is sufficient.
Binaries are placed into bin
folder. Test can be run all at once via make run_all_tests
or individually via eg. make basisfunc_run_tests
.
Linear Algebra
We use Eigen as our matrix library. See here for use reference and documentation. For a quick transition from Matlab see here.
HDF5
In order to use HDF5 IO you need hdf5 library.
You can install it easily using the command sudo apt-get install libhdf5- dev
or sudo pacman -S hdf5-cpp-fortran
.
Ubuntu places hdf5 libs in a werid folder /usr/lib/x86_64-linux-gnu/hdf5/serial/
.
If you get error similar to -lhdf5 not found
and you have hdf5 installed, you might have to link the libraries into
a discoverable place, like /usr/lib/
or add the above directory to the linker path.
If using cmake, you can add the following line to your CMakeLists.txt
link_directories(/usr/lib/x86_64-linux-gnu/hdf5/serial/)
Using Intel Math Kernel Library (MKL)
Eigen has great support for MKL all you have to do is define a EIGEN_USE_MKL_ALL macro before any includes. You can see further instructions on their website.
Besides setting #define EIGEN_USE_MKL_ALL
in your code,
some linker and compilation fixes are needed. You have to set MKL and MKLROOT variables in cmake. You can define
the variable MKLROOT as a system variable (using export) which is enough. You can also define it manually when calling
cmake. If it is not set in either way it will default to "/opt/intel/compilers_and_libraries_2017.2.174/linux/mkl".
cmake .. -DMKL=ON -DMKLROOT=/opt/intel/compilers_and_libraries_2016.1.150/linux/mkl
Your target has to be linked with some MKL libraries so make sure to add the following link to your cmake file.
target_link_libraries(target ${LMKL})
Building on Mac OSX
This method was tested on El Capitan. Linking the OpenMP library is still not functioning as intended.
First install all dependencies from homebrew
brew install llvm cmake homebrew/science/hdf5 SFML
Now you can clone and build the project with CLang using the following commands
git clone https://gitlab.com/e62Lab/e62numcodes.git
cd e62numcodes
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
make domain_run_tests
Using Intel C/C++ Compiler
In order to use Intel's compiler you have to first set the CXX
and CC
bash variables. Before calling
cmake
for the first time you have to export the following:
export CXX="icpc"
export CC="icc"
or you can define the compiler when first calling cmake like so:
cmake .. -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc)
You can also compile it directly for Intel® Xeon Phi™ Coprocessor. You do this by adding -Dmmic=ON
flag to the cmake
command:
cmake .. -Dmmic=ON -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc)
Note: All features that depend on system third-party libraries are not available on MIC (Many Integrated Core). This includes:
- HDF class in
io.hpp