|
|
|
@ -28,6 +28,10 @@ |
|
|
|
// </copyright>
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using MathNet.Numerics.Providers.FourierTransform; |
|
|
|
using MathNet.Numerics.Providers.LinearAlgebra; |
|
|
|
@ -40,7 +44,6 @@ namespace MathNet.Numerics |
|
|
|
public static class Control |
|
|
|
{ |
|
|
|
static int _maxDegreeOfParallelism; |
|
|
|
static int _blockSize; |
|
|
|
static int _parallelizeOrder; |
|
|
|
static int _parallelizeElements; |
|
|
|
static string _nativeProviderHintPath; |
|
|
|
@ -58,7 +61,6 @@ namespace MathNet.Numerics |
|
|
|
// Parallelization & Threading
|
|
|
|
ThreadSafeRandomNumberGenerators = true; |
|
|
|
_maxDegreeOfParallelism = Environment.ProcessorCount; |
|
|
|
_blockSize = 512; |
|
|
|
_parallelizeOrder = 64; |
|
|
|
_parallelizeElements = 300; |
|
|
|
TaskScheduler = TaskScheduler.Default; |
|
|
|
@ -259,17 +261,6 @@ namespace MathNet.Numerics |
|
|
|
/// </summary>
|
|
|
|
public static TaskScheduler TaskScheduler { get; set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the block size to use for
|
|
|
|
/// the native linear algebra provider.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The block size. Default 512, must be at least 32.</value>
|
|
|
|
public static int BlockSize |
|
|
|
{ |
|
|
|
get { return _blockSize; } |
|
|
|
set { _blockSize = Math.Max(32, value); } |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the order of the matrix when linear algebra provider
|
|
|
|
/// must calculate multiply in parallel threads.
|
|
|
|
@ -291,5 +282,49 @@ namespace MathNet.Numerics |
|
|
|
get { return _parallelizeElements; } |
|
|
|
set { _parallelizeElements = Math.Max(3, value); } |
|
|
|
} |
|
|
|
|
|
|
|
public static string Describe() |
|
|
|
{ |
|
|
|
#if NET40
|
|
|
|
var versionAttribute = typeof(Control).Assembly |
|
|
|
.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false) |
|
|
|
.OfType<AssemblyInformationalVersionAttribute>() |
|
|
|
.FirstOrDefault(); |
|
|
|
#else
|
|
|
|
var versionAttribute = typeof(Control).GetTypeInfo().Assembly.GetCustomAttribute(typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute; |
|
|
|
#endif
|
|
|
|
|
|
|
|
var sb = new StringBuilder(); |
|
|
|
sb.AppendLine("Math.NET Numerics Configuration:"); |
|
|
|
sb.AppendLine($"Version {versionAttribute?.InformationalVersion}"); |
|
|
|
#if NETSTANDARD1_3
|
|
|
|
sb.AppendLine("Built for .Net Standard 1.3"); |
|
|
|
#elif NETSTANDARD2_0
|
|
|
|
sb.AppendLine("Built for .Net Standard 2.0"); |
|
|
|
#elif NET40
|
|
|
|
sb.AppendLine("Built for .Net Framework 4.0"); |
|
|
|
#endif
|
|
|
|
#if !NATIVE
|
|
|
|
sb.AppendLine("No Native Provider Support"); |
|
|
|
#endif
|
|
|
|
sb.AppendLine($"Linear Algebra Provider: {LinearAlgebraControl.Provider}"); |
|
|
|
sb.AppendLine($"Fourier Transform Provider: {FourierTransformControl.Provider}"); |
|
|
|
sb.AppendLine($"Max Degree of Parallelism: {MaxDegreeOfParallelism}"); |
|
|
|
sb.AppendLine($"Parallelize Elements: {ParallelizeElements}"); |
|
|
|
sb.AppendLine($"Parallelize Order: {ParallelizeOrder}"); |
|
|
|
sb.AppendLine($"Check Distribution Parameters: {CheckDistributionParameters}"); |
|
|
|
sb.AppendLine($"Thread-Safe RNGs: {ThreadSafeRandomNumberGenerators}"); |
|
|
|
#if NETSTANDARD1_3 || NETSTANDARD2_0
|
|
|
|
// This would also work in .Net 4.0, but we don't want the dependency just for that.
|
|
|
|
sb.AppendLine($"Operating System: {RuntimeInformation.OSDescription}"); |
|
|
|
sb.AppendLine($"Operating System Architecture: {RuntimeInformation.OSArchitecture}"); |
|
|
|
sb.AppendLine($"Framework: {RuntimeInformation.FrameworkDescription}"); |
|
|
|
sb.AppendLine($"Process Architecture: {RuntimeInformation.ProcessArchitecture}"); |
|
|
|
#else
|
|
|
|
sb.AppendLine($"Operating System: {Environment.OSVersion}"); |
|
|
|
sb.AppendLine($"Framework: {Environment.Version}"); |
|
|
|
#endif
|
|
|
|
return sb.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|