How to correctly install the Intel Math Kernel Library (MKL) from Math.NET Numerics on a C# script, which is part of a Unity project? Following instructions from a Unity forum, I've managed to successfully install Math.NET Numerics on C# Unity. Now I want to install Intel MKL following instructions from source 1, but I can't get it to work. Installing Intel MKL on a regular (no Unity) C# script works with above instructions, but not in C# with Unity.
Things I've done
Install Intel MKL to C# Unity using VS' Package Manager with NuGet (successfully):
Sources 1 and 2 tell you to put both MathNet.Numerics.MKL.dll and libiomp5md.dll to the output directory, which is set to Temp\UnityVS_bin\Debug\ in C# Unity. As C# Unity didn't do this itself after PM NuGet install, I've put a pre-built event command line in VS (Project, Properties, Built Events):
xcopy /y /d "$(ProjectDir)\packages\MathNet.Numerics.MKL.Win-x18.104.22.168\build\x64*.dll" "$(ProjectDir)$(OutDir)"
Which successfully puts the two .dll files into the temporary Unity output directory, before build.
- Many Unity / C# forums tell you to put the .dll files of a plugin into the Assets (/Plugins) folder of your Unity project. I also did this with the two .dll files.
- Copied the Math.NET Numerics reference including Intel MKL (from the regular C# script) to the Unity C# script.
After these steps, Intel MKL still is not recognized as namespace of MathNet. The following error keeps on showing up:
The type or namespace name 'Mkl' does not exist in the namespace 'MathNet.Numerics.Providers.LinearAlgebra' (are you missing an assembly reference?)
I've noticed that in the regular C# script (where I got Intel MKL working), Solution Explorer --> References --> MathNet.Numerics double-click shows the Mkl linear algebra provider. And in my Unity C# (with Math.NET Numerics installed, but Intel MKL not working due to missing assembly reference), when I look at the references under MathNet.Numerics, the Mkl linear algebra provider is missing.
How to solve this problem? How to add the missing assembly reference?
Unity 5.6.0f3 (64 bit) - .NET 3.5 framework
Visual Studio 2015