Linking Intel's Math Kernel Library (Mkl) to R on Windows

Visual Studio mkl_link_tool.exe linking error

the same problem has been discussed at the mkl forum:https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-2020-1-VS2019-linking-bug/m-p/1153138

Can't link Intel Math Kernel Library to Xcode because there is no Intel_MKL.framework folder

IMPORTANT EDIT

What is wrote under this edit works at least when I run the executable "from XCODE". When I find the directory it is built in, and double click on it there, I receive this message :

Last login: Sun Nov 24 17:05:19 on ttys002
MacBook-Pro-de-totouser:~ totouser$ /Users/totouser/Library/Developer/Xcode/DerivedData/THECONSOLEAPPLICATION-hknajgycvjjcotdtkeeyxbzmtfty/Build/Products/Debug/THECONSOLEAPPLICATION ; exit;
dyld: Library not loaded: libmkl_sequential.dylib
Referenced from: /Users/totouser/Library/Developer/Xcode/DerivedData/THECONSOLEAPPLICATION-hknajgycvjjcotdtkeeyxbzmtfty/Build/Products/Debug/THECONSOLEAPPLICATION
Reason: image not found
Trace/BPT trap: 5
logout

[Process completed]

If someone could help, that would be nice, because I am really stuck here

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Ok, I succeeded in doing what you wanted to do :

I have installed m_ccompxe_2013_sp1.1.103 under mac os 10.8.5 64bits where I am using XCode 5.0.2.

The first thing is to reference mkl include directory in the project. Before doing it, I would like stress that even after having done it, I was never able in c++ code to write something like this

#include "mkl.h"

and I was obliged to put the full path to the mkl.h file, which was a bit boring, as I want ideally to put like this :

#include <mkl>
#include <mkl_vsl.h>
#include <mkl_vsl_functions.h>

etc. So I found for instance the "iostream" file on my mac, copied it somewhere, modified the copy's name to mkl, and put the content of mkl.h (which is in "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include" on my mac) in it, save it in "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include", and I referenced the directory "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include" in the include directories of my xcode project. How did I do this ?

I double clicked on "target", then on "build settings", then on "all", and searched for "search paths" menu. There

1) in "header search path", debug and release, I put "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include" and "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/intel64"

2) in "library search path", debug and release I put "/opt/intel/composer_xe_2013_sp1.1.103/compiler/lib/intel64" and "/opt/intel/composer_xe_2013_sp1.1.103/compiler/lib" and "/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib"

Then I edited the "DYLD_LIBRARY_PATH" environment variable (only in my project) to make equal to "/opt/intel/composer_xe_2013_sp1.1.103/compiler/lib:/opt/intel/composer_xe_2013_sp1.1.103/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib". How did I do this ? I cliked on the name of my project icon at the immediate right next to the triangle and square buttons at the left of the upper bar, and then I clicked on "edit scheme" which opened a window, and then clicked on "run my project debug" in the left column of that window, and then I clicked on "Argument", went in "environment variables", and +'d a new variable called DYLD_LIBRARY_PATH with value

/opt/intel/composer_xe_2013_sp1.1.103/compiler/lib:/opt/intel/composer_xe_2013_sp1.1.103/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib

Bizarrly, this set it also for "run my project release", which was ok for me, but I still find this bizarre. Anyway.

After this, I had to add command telling the compiler (LLVM 5, didn't modify anything related to this) to link to the libraries I was about to use :

for this I double cliked back on "target", then went in "build settings", then in "all", and searched then for "other linker flags" where in debug and in release I put :

-lmkl_sequential
-lmkl_core
-lmkl_intel_lp64
-lpthread
-lmkl_intel_thread
-liomp5

Then In the main.cpp I put for instance :

#include <iostream>
// #include "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/mkl.h"
// #include "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/mkl_vsl.h"
// #include "/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/mkl_vsl_functions.h"
#include <mkl>
#include <mkl_vsl.h>
#include <mkl_vsl_functions.h>

int main(int argc, const char * argv[])
{
VSLStreamStatePtr stream;
vslNewStream(&stream, VSL_BRNG_SFMT19937, 777);
double * pUNIF = new double [ 1000000 ] ;
vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD_ACCURATE, stream, 1000000, pUNIF, 0.0, 1.0);
vslDeleteStream(&stream);
for (int i = 0 ; i < 100000 ; ++i )
{
std::cout << *(pUNIF+i) << std::endl;
}
std::cout << "END." << std::endl;
getchar();
return 0;
}

Then I built and ran, I everything was ok ;-)

As would dear sir Malcolm Tucker say : "never easy, never f***** easy."

Regards,

MEF.

Run time issues using the Intel's Math Kernel Library for eigendecomposition

I found the bug in my code. I run the routine for eigendecomposition inside a thread that was created with the windows function CreatThread. However, there was no function to end the thread as for example the WaitForMultipleObjects-routine. For all the other parts of my application this was not a problem but the eigendecomposition run into difficulties.

Still the link errors about Intel-MKL

Besides the Intel MKL link line advisor which helps you generate the correct compile and link options for gcc/icc compiler, there's another pre-request you may have to pay attention to -- setting the environment variables.

In order to use MKL, you need to set some environment variables properly. Intel has provided a script to easy this setup. You could add one line to your shell profile like .bash_profile. Please read through the getting started section of MKL doc for more details.

http://software.intel.com/en-us/node/438542



Related Topics



Leave a reply



Submit