コード例 #1
0
ファイル: Control.cs プロジェクト: jafffy/mathnet-numerics
        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
        }
コード例 #2
0
ファイル: Control.cs プロジェクト: EricGT/mathnet-numerics
        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
        }
コード例 #3
0
        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
        }
コード例 #4
0
ファイル: Control.cs プロジェクト: Jungwon/mathnet-numerics
 public static void UseManaged()
 {
     LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
 }
コード例 #5
0
ファイル: Control.cs プロジェクト: shadercoder/MathCore
        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();
        }