This project has moved and is read-only. For the latest updates, please go here.

Congratulations, on the Beta 2.

Apr 18, 2011 at 1:57 PM

Congratulations, on the Beta 2. Great work indeed. Yet we may need more instructions on how to build the native wrappers. Thanks again for the great work!

Apr 18, 2011 at 2:00 PM

>Yet we may need more instructions on how to build the native wrappers. 

That is on the to do list for this week (probably Wednesday).

Apr 20, 2011 at 12:22 PM
Edited Apr 25, 2011 at 11:38 AM

Here are some basic instructions on building the providers:

Math.NET Numerics currently supports two native providers Intel's Math Kernel Library (MKL) and AMD's Core Math Library (ACML).

MKL (Windows)

  1. Install MKL on your system (we are using v10.3 Update 2).
  2. Open the NativeWrappers.sln in VS 2010 under \src\NativeWrappers\Windows .
  3. Open the Configuration Manager and select either the 32-bit or 64-bit solution platform.
  4. Right click on the MKLWrapper project and update the MKL include directory under C/C++/General and the library directory under Linker/General to point to your MKL installation.
  5. Right click on the MKLWrapper project and click rebuild.
  6. There will be two DLLs in the output directory: Math.NET.Numerics.MKL.dll and libiomp5md.dll. The output directory will be either  \src\NativeWrappers\Windows\Win32\Release or \src\NativeWrappers\Windows\x64\release.
  7. Copy the two DLLs from #6 to the same directory as MathNet.Numerics.dll.
  8. Tell the Math.NET Numerics library to use the MKL provider by adding this line to your code:
    MathNet.Numerics.Control.LinearAlgebraProvider = new MathNet.Numerics.Algorithms.LinearAlgebra.Mkl.MklLinearAlgebraProvider();

ACML (Windows) 

  1. Install the Intel Fortran version of ACML on your system (we are using v4.4) -http://developer.amd.com/cpu/Libraries/acml/Pages/default.aspx
  2. Open the NativeWrappers.sln in VS 2010 under \src\NativeWrappers\Windows .
  3. Open the Configuration Manager and select either the 32-bit or 64-bit solution platform.
  4. Right click on the ACMLWrapper project and update the ACML include directory under C/C++/General and the library directory under Linker/General to point to your ACML installation.
  5. Right click on the ACMLWrapper project and click rebuild.
  6. There will be one DLL in the output directory: Math.NET.Numerics.ACML.dll. The output directory will be either  \src\NativeWrappers\Windows\Win32\Release or  \src\NativeWrappers\Windows\x64\release.
  7. Copy the DLL from #6 to the same directory as MathNet.Numerics.dll.
  8. Copy these DLLS from your ACML installation to the same directory as MathNet.Numerics: libacml_mp_dll.dll, libifcoremd.dll, libiomp5md.dll, and libmmd.dll
  9. Tell the Math.NET Numerics library to use the ACML provider by adding this line to your code:
    MathNet.Numerics.Control.LinearAlgebraProvider = new MathNet.Numerics.Algorithms.LinearAlgebra.Acml.AcmlLinearAlgebraProvider();

Note: The ACML wrapper dynamically links the ACML libraries. If you have the Intel Fortran Complier installed you can statically link them.

Apr 20, 2011 at 4:16 PM

Can I build both and use both so as to reach a higher compatibility on both Intel CPU and AMD CPU?

Apr 20, 2011 at 4:51 PM

I believe you can build both, call a CPUID function, and then decide which AlgebraProvider to use.

I used ILNumerics before, they have a ILCPUID C++ code modified from Intel CPUID C code.

Also see example 10-3 at http://www.intel.com/Assets/PDF/appnote/241618.pdf

Apr 20, 2011 at 5:07 PM

Many thanks for your reply and I will do so following your guidance.

Apr 21, 2011 at 10:30 PM

I could get everything to work with the AMD library compiled using Intel Fortran. Using PGI didn't work for me. Can other people repro this. If so, we might want to add this to the documentation.

J

Apr 25, 2011 at 11:38 AM

Yep, our provider does not build with the PGI version of ACML. The PGI ACML build only provides the C interface/function prototypes and not the Fortran ones. We are using the ACML Fortran interface since we want to be able to pass in pre-allocated work arrays. The ACML C interface takes care of work arrays and doesn't allow users to use their own. I'll update the documentation saying that users should only use the Intel Fortran build of ACML.

Feb 9, 2012 at 3:20 PM

I am trying to locate the NativeWrappers.sln mentioned above so I can build the required dlls to reference from a C# project.  I have downloaded the Intel® Math Kernel Library 10.3 Update 7 for Windows and installed it but I am not able to locate this solution.  Can someone tell me what I am misssing?

Thanks, 

JD