public static void ConfigureAuto() { // Random Numbers & Distributions CheckDistributionParameters = true; // Parallelization & Threading ThreadSafeRandomNumberGenerators = true; _maxDegreeOfParallelism = Environment.ProcessorCount; _blockSize = 512; _parallelizeOrder = 64; _parallelizeElements = 300; TaskScheduler = TaskScheduler.Default; // Linear Algebra Provider #if PORTABLE LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); #else try { var value = Environment.GetEnvironmentVariable(EnvVarLAProvider); switch (value != null ? value.ToUpperInvariant() : string.Empty) { #if NATIVE case "MKL": UseNativeMKL(); break; case "CUDA": UseNativeCUDA(); break; case "OPENBLAS": UseNativeOpenBLAS(); break; default: if (!TryUseNative()) { UseManaged(); } break; #else default: UseManaged(); break; #endif } } catch { // We don't care about any failures here at all (because "auto") UseManaged(); } #endif }
public static void ConfigureAuto() { // Random Numbers & Distributions CheckDistributionParameters = true; ThreadSafeRandomNumberGenerators = true; // ToString & Formatting MaxToStringColumns = 6; MaxToStringRows = 8; // Parallelization & Threading _numberOfThreads = Environment.ProcessorCount; DisableParallelization = _numberOfThreads < 2; _blockSize = 512; _parallelizeOrder = 64; _parallelizeElements = 300; // Linear Algebra Provider #if PORTABLE // GetEnvironmentVariable is not available in portable! LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); #else try { const string name = "MathNetNumericsLAProvider"; var value = Environment.GetEnvironmentVariable(name); switch (value != null ? value.ToUpperInvariant() : string.Empty) { #if NATIVEMKL case "MKL": LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider(); break; #endif default: LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); break; } } catch { // We don't care about any failures here at all LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); } #endif }
public static void ConfigureAuto() { // Random Numbers & Distributions CheckDistributionParameters = true; // Parallelization & Threading ThreadSafeRandomNumberGenerators = true; _maxDegreeOfParallelism = Environment.ProcessorCount; _blockSize = 512; _parallelizeOrder = 64; _parallelizeElements = 300; TaskScheduler = TaskScheduler.Default; // Linear Algebra Provider #if PORTABLE LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); #else try { const string name = "MathNetNumericsLAProvider"; var value = Environment.GetEnvironmentVariable(name); switch (value != null ? value.ToUpperInvariant() : string.Empty) { #if NATIVE case "MKL": LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider(); break; #endif default: LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); break; } } catch { // We don't care about any failures here at all (because "auto") LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); } #endif }
public static void UseManaged() { LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); }
public static void ConfigureAuto() { // Random Numbers & Distributions CheckDistributionParameters = true; // Parallelization & Threading ThreadSafeRandomNumberGenerators = true; _maxDegreeOfParallelism = Environment.ProcessorCount; _blockSize = 512; _parallelizeOrder = 64; _parallelizeElements = 300; TaskScheduler = TaskScheduler.Default; // Linear Algebra Provider LinearAlgebraProvider = new ManagedLinearAlgebraProvider(); }