From e24ceaa5a97ad7366f9212099156abdb79846cb6 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 13 Feb 2019 09:07:36 +0000 Subject: [PATCH 1/4] added MKL installation instructions --- INSTALL.md | 27 +++++++++++++++++++++++++++ README.md | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) 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 --------------------- From 437a1136b0d9bc9e563cd0b96224ae260fc2d818 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 13 Feb 2019 14:03:29 +0000 Subject: [PATCH 2/4] added note about not always providing a speedup --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cba6d8099..006b1b53a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ 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) (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 + - See the `INSTALL` document for more installation information + - Note that MKL may not provide a speedup in all cases. Make sure to benchmark your problem with and without MKL. GTSAM 4 Compatibility --------------------- From 4eb71ef183a5f1faffd4d663809a69be15c06c5b Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Mon, 4 Mar 2019 10:14:39 +0000 Subject: [PATCH 3/4] updated reference to INSTALL document --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 006b1b53a..23f56ffc3 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ 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) (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 + - See the `INSTALL.md` document for more installation information - Note that MKL may not provide a speedup in all cases. Make sure to benchmark your problem with and without MKL. GTSAM 4 Compatibility From 7290a707a2fed1acbac06377ed2aeb91d7fd49a7 Mon Sep 17 00:00:00 2001 From: Matthew Broadway Date: Wed, 6 Mar 2019 09:47:07 +0000 Subject: [PATCH 4/4] link to INSTALL.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23f56ffc3..720517669 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ 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) (Ubuntu: [installing using APT](https://software.intel.com/en-us/articles/installing-intel-free-libs-and-python-apt-repo)) - - See the `INSTALL.md` document for more installation information + - See [INSTALL.md](INSTALL.md) for more installation information - Note that MKL may not provide a speedup in all cases. Make sure to benchmark your problem with and without MKL. GTSAM 4 Compatibility