Skip to content

Request to Update Linux MKL Provider Nuget Package #1132

@sudiptob2

Description

@sudiptob2

Hey, MathNet community, we’re encountering issues using MathNet.Numerics with Intel MKL on Linux. We'd appreciate your input and guidance on how best to proceed.

Problem Statement

To work with intel-mkl on Linux, MathNet.Numerics requires the MathNet.Numerics.MKL.Linux provider. The latest version of this provider (3.0.0-beta3) is distributed as a separate NuGet package, but it is outdated since its last release in 2022 and incompatible with the latest intel-mkl library.

While it’s possible to build the provider from the master branch using the mkl_build.sh script, this approach is less convenient than installing via NuGet. Additionally, the script often requires manual tuning based on the user’s environment to work correctly.

To Reproduce

Install intel-mkl: apt-get install intel-mkl

Create a test project:

using MathNet.Numerics;
using MathNet.Numerics.LinearAlgebra;
class Program
{
    static void Main()
    {
        Control.UseNativeMKL();
        MathNet.Numerics.Providers.MKL.MklControl.UseNativeMKL(MathNet.Numerics.Providers.MKL.MklConsistency.AVX2);
        MathNet.Numerics.Providers.LinearAlgebra.LinearAlgebraControl.Provider.InitializeVerify();
        Console.WriteLine("Provider: " + MathNet.Numerics.Providers.LinearAlgebra.LinearAlgebraControl.Provider);
        var matrix = Matrix<double>.Build.Random(3, 3);
        Console.WriteLine(matrix);
    }
}

.csproj file

...
  <ItemGroup>
    <PackageReference Include="MathNet.Numerics.MKL.Linux" Version="3.0.0-beta3" />
  </ItemGroup>
...

Output:

Unhandled exception. System.NotSupportedException: MKL Native Provider too old. Consider upgrading to a newer version.
   at MathNet.Numerics.Providers.MKL.MklProvider.Load(String hintPath, MklConsistency consistency, MklPrecision precision, MklAccuracy accuracy)
   at MathNet.Numerics.Providers.MKL.LinearAlgebra.MklLinearAlgebraProvider.InitializeVerify()
   at MathNet.Numerics.Providers.LinearAlgebra.LinearAlgebraControl.set_Provider(ILinearAlgebraProvider value)
   at MathNet.Numerics.Providers.LinearAlgebra.LinearAlgebraControl.UseNativeMKL()
   at MathNet.Numerics.Control.UseNativeMKL()
   at Program.Main() in /home/ubuntu/MathNetTest/Program.cs:line 7

Potential Solution

Release a new version of the Linux MKL provider based on the latest improvements in the master.

GResearch Opensource (GR-OSS) would be happy to contribute to a proper GitHub workflow for this task. Let us know your opinion about the best way to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions