Browse Source

Native Providers: provide access to IsAvailable and Load

spatial
Christoph Ruegg 9 years ago
parent
commit
53491219c6
  1. 13
      src/Numerics/Providers/Common/Cuda/CudaProvider.cs
  2. 12
      src/Numerics/Providers/Common/Mkl/MklProvider.cs
  3. 13
      src/Numerics/Providers/Common/OpenBlas/OpenBlasProvider.cs

13
src/Numerics/Providers/Common/Cuda/CudaProvider.cs

@ -36,12 +36,20 @@ namespace MathNet.Numerics.Providers.Common.Cuda
{
public static class CudaProvider
{
const int _designTimeRevision = 1;
const int _minimumCompatibleRevision = 1;
static int _nativeRevision;
static bool _nativeX86;
static bool _nativeX64;
static bool _nativeIA64;
static bool _loaded;
public static bool IsAvailable(string hintPath = null)
{
return IsAvailable(_minimumCompatibleRevision, hintPath);
}
internal static bool IsAvailable(int minRevision, string hintPath)
{
if (_loaded && _nativeRevision >= minRevision)
@ -67,6 +75,11 @@ namespace MathNet.Numerics.Providers.Common.Cuda
}
}
public static void Load(string hintPath = null)
{
Load(_minimumCompatibleRevision, hintPath);
}
internal static void Load(int minRevision, string hintPath)
{
if (_loaded && _nativeRevision >= minRevision)

12
src/Numerics/Providers/Common/Mkl/MklProvider.cs

@ -37,6 +37,8 @@ namespace MathNet.Numerics.Providers.Common.Mkl
public static class MklProvider
{
const int _designTimeRevision = 12;
const int _minimumCompatibleRevision = 4;
static int _nativeRevision;
static Version _mklVersion;
static bool _nativeX86;
@ -44,6 +46,11 @@ namespace MathNet.Numerics.Providers.Common.Mkl
static bool _nativeIA64;
static bool _loaded;
public static bool IsAvailable(string hintPath = null)
{
return IsAvailable(_minimumCompatibleRevision, hintPath);
}
internal static bool IsAvailable(int minRevision, string hintPath)
{
if (_loaded && _nativeRevision >= minRevision)
@ -69,6 +76,11 @@ namespace MathNet.Numerics.Providers.Common.Mkl
}
}
public static void Load(string hintPath = null)
{
Load(_minimumCompatibleRevision, hintPath);
}
internal static void Load(int minRevision, string hintPath)
{
if (_loaded && _nativeRevision >= minRevision)

13
src/Numerics/Providers/Common/OpenBlas/OpenBlasProvider.cs

@ -36,6 +36,9 @@ namespace MathNet.Numerics.Providers.Common.OpenBlas
{
internal static class OpenBlasProvider
{
const int _designTimeRevision = 1;
const int _minimumCompatibleRevision = 1;
static int _nativeRevision;
static bool _nativeX86;
static bool _nativeX64;
@ -43,6 +46,11 @@ namespace MathNet.Numerics.Providers.Common.OpenBlas
static bool _nativeARM;
static bool _loaded;
public static bool IsAvailable(string hintPath = null)
{
return IsAvailable(_minimumCompatibleRevision, hintPath);
}
internal static bool IsAvailable(int minRevision, string hintPath)
{
if (_loaded && _nativeRevision >= minRevision)
@ -68,6 +76,11 @@ namespace MathNet.Numerics.Providers.Common.OpenBlas
}
}
public static void Load(string hintPath = null)
{
Load(_minimumCompatibleRevision, hintPath);
}
internal static void Load(int minRevision, string hintPath)
{
if (_loaded && _nativeRevision >= minRevision)

Loading…
Cancel
Save