Browse Source

Native: replace NATIVEMKL build constant with NATIVE as it can be used by other native providers as well #296

cuda
Christoph Ruegg 12 years ago
parent
commit
43c361dd87
  1. 6
      README.md
  2. 10
      src/Numerics/Control.cs
  3. 6
      src/Numerics/Numerics.csproj
  4. 2
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.cs
  5. 2
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.cs
  6. 2
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Double.cs
  7. 2
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Single.cs
  8. 2
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs
  9. 2
      src/Numerics/Providers/LinearAlgebra/Mkl/SafeNativeMethods.cs
  10. 2
      src/Numerics/Providers/NativeProviderLoader.cs
  11. 2
      src/Performance/LinearAlgebra/DenseMatrixProduct.cs
  12. 2
      src/Performance/LinearAlgebra/DenseVectorAdd.cs
  13. 2
      src/Performance/Performance.csproj
  14. 12
      src/UnitTests/UnitTests-MKL.csproj
  15. 2
      src/UnitTests/UseLinearAlgebraProvider.cs

6
README.md

@ -80,10 +80,10 @@ Compilation symbols used to deal with platform differences:
* **PORTABLE** - Some framework attributes are not available and we provide our own parallelization routines and partitioning using TPL Tasks. Reduced globalization and serialization support. Work around some missing routines like `Math.DivRem`, `Array.FindIndex` and `BitConverter`. There is no `ICloneable`. The crypto random source is not available; simpler random seeding.
* **NOSYSNUMERICS** - The `System.Numerics` framework assembly is not available. We provide our own double-precision complex number type and disable all arbitrary precision numbers support (BigInteger, BigRational).
* **NET45REFLECTION** - we use the new .Net 4.5 reflection API where type information is split into `Type` and `TypeInfo`.
* **NATIVEMKL** - we can support the Intel MKL native provider.
* **NATIVE** - we can support native providers like Intel MKL.
Configuration | Net35 | Portable | NoSysNumerics | Net45Reflection | NativeMKL
------------- | ----- | -------- | ------------- | --------------- | ---------
Configuration | Net35 | Portable | NoSysNumerics | Net45Reflection | Native
------------- | ----- | -------- | ------------- | --------------- | ------
.Net 4.0 | - | - | - | - | Yes
.Net 3.5 | Yes | - | Yes | - | -
Portable 7 | - | Yes | - | Yes | -

10
src/Numerics/Control.cs

@ -64,19 +64,23 @@ namespace MathNet.Numerics
TaskScheduler = TaskScheduler.Default;
// Linear Algebra Provider
#if PORTABLE
LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
#if !PORTABLE && NATIVEMKL
#else
try
{
const string name = "MathNetNumericsLAProvider";
var value = Environment.GetEnvironmentVariable(name);
switch (value != null ? value.ToUpperInvariant() : string.Empty)
{
#if NATIVEMKL
#if NATIVE
case "MKL":
LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider();
break;
#endif
default:
LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
break;
}
}
catch
@ -108,7 +112,7 @@ namespace MathNet.Numerics
LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
}
#if NATIVEMKL
#if NATIVE
public static void UseNativeMKL()
{
LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider();

6
src/Numerics/Numerics.csproj

@ -39,7 +39,7 @@
<!-- Conditional Strong Name: NO -->
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;NATIVE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
@ -53,7 +53,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;DEBUG;NATIVE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
@ -68,7 +68,7 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<Optimize>true</Optimize>
<DefineConstants>TRACE;NATIVEMKL;STRONGNAME</DefineConstants>
<DefineConstants>TRACE;NATIVE;STRONGNAME</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>

2
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex.cs

@ -28,7 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
#if NATIVEMKL
#if NATIVE
using System;
using System.Numerics;

2
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Complex32.cs

@ -28,7 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
#if NATIVEMKL
#if NATIVE
using System;
using System.Numerics;

2
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Double.cs

@ -28,7 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
#if NATIVEMKL
#if NATIVE
using System;
using System.Numerics;

2
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.Single.cs

@ -28,7 +28,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
#if NATIVEMKL
#if NATIVE
using System;
using System.Numerics;

2
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs

@ -30,7 +30,7 @@
using System;
#if NATIVEMKL
#if NATIVE
namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
{

2
src/Numerics/Providers/LinearAlgebra/Mkl/SafeNativeMethods.cs

@ -26,7 +26,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
#if NATIVEMKL
#if NATIVE
using System.Numerics;
using System.Runtime.InteropServices;

2
src/Numerics/Providers/NativeProviderLoader.cs

@ -35,7 +35,7 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
#if NATIVEMKL
#if NATIVE
namespace MathNet.Numerics.Providers
{

2
src/Performance/LinearAlgebra/DenseMatrixProduct.cs

@ -32,7 +32,7 @@ namespace Performance.LinearAlgebra
_unsafeProvider.InitializeVerify();
_experimentalProvider.InitializeVerify();
#if NATIVEMKL
#if NATIVE
_mkl.InitializeVerify();
#endif
}

2
src/Performance/LinearAlgebra/DenseVectorAdd.cs

@ -28,7 +28,7 @@ namespace Performance.LinearAlgebra
_managed.InitializeVerify();
Control.LinearAlgebraProvider = _managed;
#if NATIVEMKL
#if NATIVE
_mkl.InitializeVerify();
#endif
}

2
src/Performance/Performance.csproj

@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;NATIVE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>

12
src/UnitTests/UnitTests-MKL.csproj

@ -16,7 +16,7 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineConstants>TRACE;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;NATIVE</DefineConstants>
<OutputPath>..\..\out\MKL\Windows\AnyCPU\</OutputPath>
<IntermediateOutputPath>..\..\obj\MKL\Windows\x86\</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\..\obj\MKL\Windows\x86\</BaseIntermediateOutputPath>
@ -28,7 +28,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;DEBUG;NATIVE</DefineConstants>
<OutputPath>..\..\out\MKL\Windows\AnyCPU\</OutputPath>
<IntermediateOutputPath>..\..\obj\MKL\Windows\x86\</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\..\obj\MKL\Windows\x86\</BaseIntermediateOutputPath>
@ -44,7 +44,7 @@
<OutputPath>..\..\out\MKL\Windows\x86\</OutputPath>
<IntermediateOutputPath>..\..\obj\MKL\Windows\x86\</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\..\obj\MKL\Windows\x86\</BaseIntermediateOutputPath>
<DefineConstants>TRACE;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;NATIVE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>1591</NoWarn>
<DebugType>pdbonly</DebugType>
@ -57,7 +57,7 @@
<OutputPath>..\..\out\MKL\Windows\x86\</OutputPath>
<IntermediateOutputPath>..\..\obj\MKL\Windows\x86\</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\..\obj\MKL\Windows\x86\</BaseIntermediateOutputPath>
<DefineConstants>TRACE;DEBUG;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;DEBUG;NATIVE</DefineConstants>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
@ -68,7 +68,7 @@
<OutputPath>..\..\out\MKL\Windows\x64\</OutputPath>
<IntermediateOutputPath>..\..\obj\MKL\Windows\x64\</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\..\obj\MKL\Windows\x64\</BaseIntermediateOutputPath>
<DefineConstants>TRACE;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;NATIVE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>1591</NoWarn>
<DebugType>pdbonly</DebugType>
@ -81,7 +81,7 @@
<OutputPath>..\..\out\MKL\Windows\x64\</OutputPath>
<IntermediateOutputPath>..\..\obj\MKL\Windows\x64\</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\..\obj\MKL\Windows\x64\</BaseIntermediateOutputPath>
<DefineConstants>TRACE;DEBUG;NATIVEMKL</DefineConstants>
<DefineConstants>TRACE;DEBUG;NATIVE</DefineConstants>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>

2
src/UnitTests/UseLinearAlgebraProvider.cs

@ -38,7 +38,7 @@ namespace MathNet.Numerics.UnitTests
{
public void BeforeTest(TestDetails testDetails)
{
#if !NET35 && NATIVEMKL
#if !NET35 && NATIVE
Control.UseNativeMKL();
#endif
}

Loading…
Cancel
Save