- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have installed m_ccompxe_2013_sp1.1.103 under mac os 10.8.5 64bits where I am using XCode 5.0.2. (I have installed it first time with Xcode integration, and second time without Xcode integration, this doesn't change anything to what I am about to describe).
In "/opt/intel/bin/" I have run :
sh compilervars.sh intel64
I have created a new Xcode project of type "command line tool", with target mac os OX 10.8 64bits
In "target", "all", "header search path" I have (in debug and in release) :
$(inherited) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
and I added there everything related to the mkl headers, that is :
/opt/intel/composer_xe_2013_sp1.1.103/mkl/include
and
/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/intel64
(I have nothing else ; for instance, I have no framework directory containing something containing mkl.h)
Finally in In "target", "all", "header search path" I have (in debug and in release) :
$(inherited) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/opt/intel/composer_xe_2013_sp1.1.103/mkl/include;/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/intel64
In "target", "all", "library search path" I added (in debug and in release) :
/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib
and I put in main.cpp :
#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"
int main(int argc, const char * argv[])
{
VSLStreamStatePtr stream;
vslNewStream(&stream, VSL_BRNG_SFMT19937, 777);
double pUNIF = 0.0;
vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD_ACCURATE, stream, 1, &pUNIF, 0.0, 1.0);
vslDeleteStream(&stream);
std::cout << pUNIF << std::endl;
std::cout << "END" << std::endl;
std::cout << "END." << std::endl;
getchar();
return 0;
}
I build the project and had this console output :
Ld /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug/TEST normal x86_64
cd /Users/TheCursedUserCalledToto/Desktop/TEST
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug -L/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib -F/Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug -filelist /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Intermediates/TEST.build/Debug/TEST.build/Objects-normal/x86_64/TEST.LinkFileList -mmacosx-version-min=10.8 -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Intermediates/TEST.build/Debug/TEST.build/Objects-normal/x86_64/TEST_dependency_info.dat -o /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug/TEST
Undefined symbols for architecture x86_64:
"_vdRngUniform", referenced from:
_main in main.o
"_vslDeleteStream", referenced from:
_main in main.o
"_vslNewStream", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also tried the same but with
$(inherited) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/opt/intel/composer_xe_2013_sp1.1.103/mkl/include;/opt/intel/composer_xe_2013_sp1.1.103/mkl/include/intel64;/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib
in header search path
and with
-libmkl_intel_thread.a
-libmkl_core.a
-libmkl_sequential.a
-libmkl_intel_thread.a
in library search path, which gave me this in the consol output :
Ld /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug/TEST normal x86_64
cd /Users/TheCursedUserCalledToto/Desktop/TEST
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug -L-libmkl_intel_thread.a -L-libmkl_sequential.a -L-libmkl_core.a -L-libmkl_intel_lp64.a -L-libmkl_sequential.a -L-libmkl_intel_thread.a -F/Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug -filelist /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Intermediates/TEST.build/Debug/TEST.build/Objects-normal/x86_64/TEST.LinkFileList -mmacosx-version-min=10.8 -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Intermediates/TEST.build/Debug/TEST.build/Objects-normal/x86_64/TEST_dependency_info.dat -o /Users/TheCursedUserCalledToto/Library/Developer/Xcode/DerivedData/TEST-bzaoociykzbngmgdamhjgussnmpt/Build/Products/Debug/TEST
ld: warning: directory not found for option '-L-libmkl_intel_thread.a'
ld: warning: directory not found for option '-L-libmkl_sequential.a'
ld: warning: directory not found for option '-L-libmkl_core.a'
ld: warning: directory not found for option '-L-libmkl_intel_lp64.a'
ld: warning: directory not found for option '-L-libmkl_sequential.a'
ld: warning: directory not found for option '-L-libmkl_intel_thread.a'
Undefined symbols for architecture x86_64:
"_vdRngUniform", referenced from:
_main in main.o
"_vslDeleteStream", referenced from:
_main in main.o
"_vslNewStream", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have basically tried everythin advised or tried here :
without any success, and I am still in the position of seeing here and there "linking to the intel mkl is easy" while being at the same time stuck again... (I already add the same issue under windows, see this --> http://software.intel.com/en-us/forums/topic/489133 )
I have to precise that all official pages advising "how" to link xcode to the mkl where completely useless to me.
If someone could help, I would be very happy ?
(I should precise that for my windows problem, I finally solved the issue myself ; I would like to lose the same amount of time now, cause this could make me think that the advertising motto "linking to the mkl is easy" is a big fat lie. ;-))
Thanks a lot in advance !
Kind Regards,
Pierre
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I succeeded in doing what I 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 ;-)
Regards,
Pierre

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page