Math.NET Numerics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.6 KiB

using System;
using MathNet.Numerics;
#if !NETCOREAPP1_1
using MathNet.Numerics.Providers.Common.Mkl;
#endif
namespace Benchmark
{
public enum Provider : int
{
Managed = 0,
NativeMKLAutoHigh = 1,
NativeMKLAutoLow = 2,
NativeMKLAvx2High = 3,
NativeMKLAvx2Low = 4,
NativeOpenBLAS = 5
}
public static class Providers
{
public static void ForceProvider(Provider provider)
{
//Control.NativeProviderPath = @"..\..\..\..\out\MKL\Windows\";
switch (provider)
{
case Provider.Managed:
Control.UseManaged();
break;
case Provider.NativeMKLAutoHigh:
Control.UseNativeMKL(MklConsistency.Auto, MklPrecision.Double, MklAccuracy.High);
break;
case Provider.NativeMKLAutoLow:
Control.UseNativeMKL(MklConsistency.Auto, MklPrecision.Double, MklAccuracy.Low);
break;
case Provider.NativeMKLAvx2High:
Control.UseNativeMKL(MklConsistency.AVX2, MklPrecision.Double, MklAccuracy.High);
break;
case Provider.NativeMKLAvx2Low:
Control.UseNativeMKL(MklConsistency.AVX2, MklPrecision.Double, MklAccuracy.Low);
break;
case Provider.NativeOpenBLAS:
Control.UseNativeOpenBLAS();
break;
default:
throw new NotSupportedException($"Provider {provider} not supported.");
}
}
}
}