Registered Member
|
Hello community,
I will admit that I am still new to using Linux (Fedora), and am having trouble finding a way to link my MKL library to Eigen. My task is to run a benchmark between Armadillo and Eigen through gcc, based on basic, acml, and then mkl. I have everything working on the Armadillo side, which was easy because all it required was a few changes to the cmake files, and a make install to my directory (eg. arma_withacml_2.4.4 or something similar). When I was looking at the Eigen 3.0.5 tar file, I noticed there were no make or configure files. I thought I'd try compiling while linked like this: gcc test_eigenAcml.cpp -o test_eigenAcml -I/opt/eigen3.0.5/include -L{path to acml library} -{designated libs} or even just set up a module, but I was a bit lost on how this would help, considering the Eigen directory was still the same as my previous benchmark for basic compilations. Maybe I am just overthiking this, but any advice would be greatly appreciated! Thank you! Ryan |
Registered Member
|
ok with a little more research, I did redownload a new version of eigen (eigen-eigen-6e7488e20373.tar.gz) that had the ability to aloow me to do a cmake to a build directory. and I found this link, which looks promising:
http://eigen.tuxfamily.org/dox-devel/To ... elMKL.html now I just have to find the EIGEN_USE_MKL macro, and make sure it is defined. Since I haven't found this yet, I'm unsure if I will be able to use ACML, because I am seeing posts about the need of a patch. Will i need the patch? or will there be a way to work around this? Thank you! Ryan |
Moderator
|
Eigen is a header-only library, for MKL you need to get the devel branch, and compile your test with -DEIGEN_USE_MKL and all the appropriate linker flags.
|
Registered Member
|
Thanks,
I managed to get it to compile now, but without any noticable difference in time (.002s~.0004s difference). I'm going to spend more time playing with this, to see if my Wl linker might be failing. matB = matA*A^T, for matrix size = 500x500, is the function im testing. And was anticipating eigen with MKL would have much better performance |
Moderator
|
only if you have a CPU with AVX instruction sets, otherwise Eigen is nearly as good as MKL:
http://eigen.tuxfamily.org/index.php?title=Benchmark |
Registered Member
|
|
Registered Member
|
Just a heads up to anyone who was having same problem as me:
Using Eigen3.1.0 and MKL 10.3.7, I had to create two modules for proper compilation. The first one was an Intel_MKL module, designating the proper libraries and paths. The second was the Eigen module, which is doing the same thing as the Intel_MKL one, only for Eigen. Example: -----intel------ #%Module 1.0 2 # 3 # Intel module for use with 'environment-modules' package: 4 # 5 6 ## MKL 7 setenv MKLROOT /opt/mkl10.3.7/mkl 8 setenv MKL_TARGET_ARCH intel64 9 prepend-path LD_LIBRARY_PATH /opt/mkl10.3.7/mkl/lib/intel64 10 prepend-path LIBRARY_PATH /opt/mkl10.3.7/mkl/lib/intel64 11 prepend-path LD_LIBRARY_PATH /opt/mkl10.3.7/lib/intel64 12 prepend-path LIBRARY_PATH /opt/mkl10.3.7/lib/intel64 13 prepend-path NLSPATH /opt/mkl10.3.7/mkl/lib/intel64/locale/%l_%t/%N 14 prepend-path MANPATH /opt/mkl10.3.7/man/en_US 15 prepend-path INCLUDE /opt/mkl10.3.7/mkl/include 16 prepend-path CPATH /opt/mkl10.3.7/mkl/include -----Eigen----- 1 #%Module 3.2 2 # 3 # Eigen with Intel MKL Blas and Lapack module 4 # 5 prereq intel-x86_64 6 prepend-path INCLUDE /opt/eigen3.1.0_MKL/include/eigen3 7 prepend-path CPATH /opt/eigen3.1.0_MKL/include/eigen3 8 prepend-path LD_LIBRARY_PATH /opt/eigen3.1.0_MKL/lib 9 prepend-path LIBRARY_PATH /opt/eigen3.1.0_MKL/lib 10 setenv EIGEN_ROOT /opt/eigen3.1.0_MKL/ 11 setenv EIGEN_INFO eigen3.1.0_MKL ---------------- with these two modules loaded, in order 1.)intel 2.)eigen, you should be able to easily compile your Eigen code using MKL.... eg. g++ code.cpp -o outputfile Sometimes you will need to add the flag -DEIGEN_USE_MKL_ALL in compilation to turn on the MKL features. I know this may be common sense for a lot of users on here, But for the newbies like me this could be extremely helpful. |
Moderator
|
sounds useful, I copied it in the wiki:
http://eigen.tuxfamily.org/index.php?title=MKL_Tips |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]