From cf51920287f7524a68303ea6f704831288c60450 Mon Sep 17 00:00:00 2001 From: lionpeloux Date: Sun, 18 Oct 2015 12:03:24 +0200 Subject: [PATCH 1/4] Update MKL doc for OSX --- docs/content/MKL.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/content/MKL.md b/docs/content/MKL.md index 73bff0e2..0a433c77 100644 --- a/docs/content/MKL.md +++ b/docs/content/MKL.md @@ -103,6 +103,22 @@ or just copy them e.g. to `/usr/lib`. For details see Mono's [Interop with Native Libraries](http://www.mono-project.com/docs/advanced/pinvoke/#mac-os-x-framework-and-dylib-search-path). +To build the MKL native provider : +- make sure you've a valid [Intel MKL](https://software.intel.com/en-us/qualify-for-free-software/academicresearcher) licence installed on your mac (look at opt/intel) +- open the terminal +- cd to the folder mathnet-numerics/src/NativeProviders/OSX +- run the .sh script by typping sh mkl_build.sh +- ... wait for the build +- check the mathnet-numerics/out/MKL /x86 and /x64 folders : you should see the li + + [lang=sh] + lionel:~ Lionel$ cd /Users/Lionel/Public/Git/GitHub/mathnet-numerics/src/NativeProviders/OSX + lionel:OSX Lionel$ ls + mkl_build.sh + lionel:OSX Lionel$ sh mkl_build.sh + + + F# Interactive -------------- From 9be0a955a64fad8c18eaa0d1af083fcdf26de7f6 Mon Sep 17 00:00:00 2001 From: lionpeloux Date: Sun, 18 Oct 2015 12:04:03 +0200 Subject: [PATCH 2/4] Update MKL native provider build script for OSX --- src/NativeProviders/OSX/mkl_build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NativeProviders/OSX/mkl_build.sh b/src/NativeProviders/OSX/mkl_build.sh index ea20ac4c..5f5d5559 100755 --- a/src/NativeProviders/OSX/mkl_build.sh +++ b/src/NativeProviders/OSX/mkl_build.sh @@ -1,15 +1,15 @@ export INTEL=/opt/intel export MKL=$INTEL/mkl -export OPENMP=$INTEL/composerxe/lib +export OPENMP=$INTEL/lib export OUT=../../../out/MKL/OSX mkdir -p $OUT/x64 mkdir -p $OUT/x86 -clang++ -D_M_X64 -DGCC -m64 --shared -fPIC -o $OUT/x64/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../MKL/blas.c ../MKL/lapack.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm +clang++ -std=c++11 -D_M_X64 -DGCC -m64 --shared -fPIC -o $OUT/x64/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm cp $OPENMP/libiomp5.dylib $OUT/x64/ -clang++ -D_M_IX86 -DGCC -m32 --shared -fPIC -o $OUT/x86/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../MKL/blas.c ../MKL/lapack.cpp $MKL/lib/libmkl_intel.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm +clang++ -std=c++11 -D_M_IX86 -DGCC -m32 --shared -fPIC -o $OUT/x86/MathNet.Numerics.MKL.dll -I$MKL/include -I../Common -I../MKL ../MKL/memory.c ../MKL/capabilities.cpp ../MKL/vector_functions.c ../Common/blas.c ../Common/lapack.cpp $MKL/lib/libmkl_intel_lp64.a $MKL/lib/libmkl_core.a $MKL/lib/libmkl_intel_thread.a -L$OPENMP -liomp5 -lpthread -lm cp $OPENMP/libiomp5.dylib $OUT/x86/ From 4de57332e38b4265ca627eaf8370beb4f689296e Mon Sep 17 00:00:00 2001 From: lionpeloux Date: Sun, 18 Oct 2015 12:17:30 +0200 Subject: [PATCH 3/4] Update MKL doc for OSX --- docs/content/MKL.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/content/MKL.md b/docs/content/MKL.md index 0a433c77..92e2e74e 100644 --- a/docs/content/MKL.md +++ b/docs/content/MKL.md @@ -104,12 +104,11 @@ or just copy them e.g. to `/usr/lib`. For details see Mono's [Interop with Native Libraries](http://www.mono-project.com/docs/advanced/pinvoke/#mac-os-x-framework-and-dylib-search-path). To build the MKL native provider : -- make sure you've a valid [Intel MKL](https://software.intel.com/en-us/qualify-for-free-software/academicresearcher) licence installed on your mac (look at opt/intel) -- open the terminal -- cd to the folder mathnet-numerics/src/NativeProviders/OSX -- run the .sh script by typping sh mkl_build.sh -- ... wait for the build -- check the mathnet-numerics/out/MKL /x86 and /x64 folders : you should see the li +1. Make sure you've a valid [intel MKL](https://software.intel.com/en-us/qualify-for-free-software/academicresearcher) licence installed on your mac (look at opt/intel). If not, you can get a free trial on intel's web site. +1. Open the terminal +2. cd to the folder mathnet-numerics/src/NativeProviders/OSX +3. Run the .sh script by typping sh mkl_build.sh +4. ... wait for the build [lang=sh] lionel:~ Lionel$ cd /Users/Lionel/Public/Git/GitHub/mathnet-numerics/src/NativeProviders/OSX @@ -117,7 +116,17 @@ To build the MKL native provider : mkl_build.sh lionel:OSX Lionel$ sh mkl_build.sh +5. Check the /x86 and /x64 folders in mathnet-numerics/out/MKL : you should now find the libiomp5.dylib and MathNet.Numerics.MKL.dll libaries. +6. you need to add the path to the generated libraies in your `DYLD_LIBRARY_PATH` environnement variable (which you can move to the folder of you choice before). To do that, open your /Users/Lionel/.bas_profile.sh file with a text editor and add the following statements : + + [lang=sh] + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/Lionel/../mathnet-numerics/out/MKL/OSX/x64 + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/Lionel/../mathnet-numerics/out/MKL/OSX/x86 + +Of course replace `Lionel` by your account login. + +Have a look a the example down this page to compare MKL-provider vs. managed-provider performances. F# Interactive From 58c6da44946bedd4bf0c03cac95d17d626be6dfe Mon Sep 17 00:00:00 2001 From: lionpeloux Date: Sun, 18 Oct 2015 12:24:58 +0200 Subject: [PATCH 4/4] Update MKL doc for OSX --- docs/content/MKL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/MKL.md b/docs/content/MKL.md index 92e2e74e..413e72ef 100644 --- a/docs/content/MKL.md +++ b/docs/content/MKL.md @@ -116,9 +116,9 @@ To build the MKL native provider : mkl_build.sh lionel:OSX Lionel$ sh mkl_build.sh -5. Check the /x86 and /x64 folders in mathnet-numerics/out/MKL : you should now find the libiomp5.dylib and MathNet.Numerics.MKL.dll libaries. +5. Check the /x86 and /x64 folders in mathnet-numerics/out/MKL : you should now find the `libiomp5.dylib` and `MathNet.Numerics.MKL.dll` libaries. -6. you need to add the path to the generated libraies in your `DYLD_LIBRARY_PATH` environnement variable (which you can move to the folder of you choice before). To do that, open your /Users/Lionel/.bas_profile.sh file with a text editor and add the following statements : +6. you need to add the path to the generated libraies in your `DYLD_LIBRARY_PATH` environnement variable (which you can move to the folder of you choice before). To do that, open your /Users/Lionel/.bas_profile.sh file with a text editor and add the following statements. [lang=sh] export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/Lionel/../mathnet-numerics/out/MKL/OSX/x64