From 8dcecb1125353827a1e047875acfe29efb49af82 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Mon, 6 Dec 2021 22:02:35 +0100 Subject: [PATCH] Providers: hint path normalization --- .../UseLinearAlgebraProvider.cs | 19 ++++++++++--------- .../CudaLinearAlgebraProvider.cs | 3 ++- .../MklFourierTransformProvider.cs | 3 ++- .../LinearAlgebra/MklLinearAlgebraProvider.cs | 4 ++-- .../SparseSolver/MklSparseSolverProvider.cs | 3 ++- .../OpenBlasLinearAlgebraProvider.cs | 3 ++- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Numerics.Tests/UseLinearAlgebraProvider.cs b/src/Numerics.Tests/UseLinearAlgebraProvider.cs index 94a4c2b3..65a27a04 100644 --- a/src/Numerics.Tests/UseLinearAlgebraProvider.cs +++ b/src/Numerics.Tests/UseLinearAlgebraProvider.cs @@ -28,6 +28,7 @@ // using System; +using System.IO; using NUnit.Framework; using NUnit.Framework.Interfaces; @@ -46,14 +47,17 @@ namespace MathNet.Numerics.UnitTests { public void BeforeTest(ITest testDetails) { - string outDir = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), @"../../../../../out/"); + string outDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), @"../../../../../out/")); #if MKL - Control.NativeProviderPath = System.IO.Path.Combine(outDir, @"MKL/Windows/"); - MklControl.UseNativeMKL(MklConsistency.AVX, MklPrecision.Double, MklAccuracy.High); + Control.NativeProviderPath = Path.GetFullPath(Path.Combine(outDir, @"MKL/Windows/")); + Control.UseNativeMKL(); + //MklControl.UseNativeMKL(MklConsistency.AVX, MklPrecision.Double, MklAccuracy.High); #elif CUDA - CudaControl.UseNativeCUDA(); + Control.UseNativeCUDA(); + //CudaControl.UseNativeCUDA(); #elif OPENBLAS - OpenBlasControl.UseNativeOpenBLAS(); + Control.UseNativeOpenBLAS(); + //OpenBlasControl.UseNativeOpenBLAS(); #else Control.UseManaged(); #endif @@ -68,9 +72,6 @@ namespace MathNet.Numerics.UnitTests { } - public ActionTargets Targets - { - get { return ActionTargets.Suite; } - } + public ActionTargets Targets => ActionTargets.Suite; } } diff --git a/src/Providers.CUDA/LinearAlgebra/CudaLinearAlgebraProvider.cs b/src/Providers.CUDA/LinearAlgebra/CudaLinearAlgebraProvider.cs index c1fa5e09..577e9e73 100644 --- a/src/Providers.CUDA/LinearAlgebra/CudaLinearAlgebraProvider.cs +++ b/src/Providers.CUDA/LinearAlgebra/CudaLinearAlgebraProvider.cs @@ -28,6 +28,7 @@ // using System; +using System.IO; using MathNet.Numerics.Providers.LinearAlgebra; namespace MathNet.Numerics.Providers.CUDA.LinearAlgebra @@ -46,7 +47,7 @@ namespace MathNet.Numerics.Providers.CUDA.LinearAlgebra /// Hint path where to look for the native binaries internal CudaLinearAlgebraProvider(string hintPath) { - _hintPath = hintPath; + _hintPath = Path.GetFullPath(hintPath); } /// diff --git a/src/Providers.MKL/FourierTransform/MklFourierTransformProvider.cs b/src/Providers.MKL/FourierTransform/MklFourierTransformProvider.cs index df44b829..49768515 100644 --- a/src/Providers.MKL/FourierTransform/MklFourierTransformProvider.cs +++ b/src/Providers.MKL/FourierTransform/MklFourierTransformProvider.cs @@ -27,6 +27,7 @@ // using System; +using System.IO; using System.Security; using System.Threading; using MathNet.Numerics.Providers.FourierTransform; @@ -53,7 +54,7 @@ namespace MathNet.Numerics.Providers.MKL.FourierTransform /// Hint path where to look for the native binaries internal MklFourierTransformProvider(string hintPath) { - _hintPath = hintPath; + _hintPath = Path.GetFullPath(hintPath); } /// diff --git a/src/Providers.MKL/LinearAlgebra/MklLinearAlgebraProvider.cs b/src/Providers.MKL/LinearAlgebra/MklLinearAlgebraProvider.cs index e3fa9e25..eb817cb1 100644 --- a/src/Providers.MKL/LinearAlgebra/MklLinearAlgebraProvider.cs +++ b/src/Providers.MKL/LinearAlgebra/MklLinearAlgebraProvider.cs @@ -28,7 +28,7 @@ // using System; -using System.Numerics; +using System.IO; using System.Security; using MathNet.Numerics.Providers.LinearAlgebra; @@ -71,7 +71,7 @@ namespace MathNet.Numerics.Providers.MKL.LinearAlgebra /// VML accuracy mode. internal MklLinearAlgebraProvider(string hintPath, MklConsistency consistency, MklPrecision precision, MklAccuracy accuracy) { - _hintPath = hintPath; + _hintPath = Path.GetFullPath(hintPath); _consistency = consistency; _precision = precision; _accuracy = accuracy; diff --git a/src/Providers.MKL/SparseSolver/MklSparseSolverProvider.cs b/src/Providers.MKL/SparseSolver/MklSparseSolverProvider.cs index 08dc30e5..11e6f3ec 100644 --- a/src/Providers.MKL/SparseSolver/MklSparseSolverProvider.cs +++ b/src/Providers.MKL/SparseSolver/MklSparseSolverProvider.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using MathNet.Numerics.Providers.SparseSolver; namespace MathNet.Numerics.Providers.MKL.SparseSolver @@ -18,7 +19,7 @@ namespace MathNet.Numerics.Providers.MKL.SparseSolver /// Hint path where to look for the native binaries internal MklSparseSolverProvider(string hintPath) { - _hintPath = hintPath; + _hintPath = Path.GetFullPath(hintPath); } /// diff --git a/src/Providers.OpenBLAS/LinearAlgebra/OpenBlasLinearAlgebraProvider.cs b/src/Providers.OpenBLAS/LinearAlgebra/OpenBlasLinearAlgebraProvider.cs index 6803566b..60bb1fd6 100644 --- a/src/Providers.OpenBLAS/LinearAlgebra/OpenBlasLinearAlgebraProvider.cs +++ b/src/Providers.OpenBLAS/LinearAlgebra/OpenBlasLinearAlgebraProvider.cs @@ -28,6 +28,7 @@ // using System; +using System.IO; using MathNet.Numerics.Providers.LinearAlgebra; namespace MathNet.Numerics.Providers.OpenBLAS.LinearAlgebra @@ -62,7 +63,7 @@ namespace MathNet.Numerics.Providers.OpenBLAS.LinearAlgebra /// Hint path where to look for the native binaries internal OpenBlasLinearAlgebraProvider(string hintPath) { - _hintPath = hintPath; + _hintPath = Path.GetFullPath(hintPath); } ///