diff --git a/INSTALL.md b/INSTALL.md index e19363c7e..cc4cf4737 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -141,3 +141,30 @@ Another useful debugging symbol is _GLIBCXX_DEBUG, which enables debug checks an NOTE: The native Snow Leopard g++ compiler/library contains a bug that makes it impossible to use _GLIBCXX_DEBUG. MacPorts g++ compilers do work with it though. NOTE: If _GLIBCXX_DEBUG is used to compile gtsam, anything that links against gtsam will need to be compiled with _GLIBCXX_DEBUG as well, due to the use of header-only Eigen. + + +## Installing MKL on Linux + +Intel has a guide for installing MKL on Linux through APT repositories at . + +After following the instructions, add the following to your `~/.bashrc` (and afterwards, open a new terminal before compiling GTSAM): +`LD_PRELOAD` need only be set if you are building the cython wrapper to use GTSAM from python. +```sh +source /opt/intel/mkl/bin/mklvars.sh intel64 +export LD_PRELOAD="$LD_PRELOAD:/opt/intel/mkl/lib/intel64/libmkl_core.so:/opt/intel/mkl/lib/intel64/libmkl_sequential.so" +``` +To use MKL in GTSAM pass the flag `-DGTSAM_WITH_EIGEN_MKL=ON` to cmake. + + +The `LD_PRELOAD` fix seems to be related to a well known problem with MKL which leads to lots of undefined symbol errors, for example: +- +- +- + +Failing to specify `LD_PRELOAD` may lead to errors such as: +`ImportError: /opt/intel/mkl/lib/intel64/libmkl_vml_avx2.so: undefined symbol: mkl_serv_getenv` +or +`Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.` +when importing GTSAM using the cython wrapper in python. + + diff --git a/README.md b/README.md index 7e03c81f2..cba6d8099 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ Prerequisites: Optional prerequisites - used automatically if findable by CMake: - [Intel Threaded Building Blocks (TBB)](http://www.threadingbuildingblocks.org/) (Ubuntu: `sudo apt-get install libtbb-dev`) -- [Intel Math Kernel Library (MKL)](http://software.intel.com/en-us/intel-mkl) +- [Intel Math Kernel Library (MKL)](http://software.intel.com/en-us/intel-mkl) (Ubuntu: [installing using APT](https://software.intel.com/en-us/articles/installing-intel-free-libs-and-python-apt-repo)) + - see the `INSTALL` document for more installation information GTSAM 4 Compatibility ---------------------