From d91acbf523b9b17cf70c906c8ca0b7f9c4c370ac Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Thu, 4 Apr 2013 23:46:59 +0200 Subject: [PATCH] LA Perf: rangesize tweaks --- .../ManagedLinearAlgebraProvider.Complex.cs | 18 +++++++++--------- .../ManagedLinearAlgebraProvider.Complex32.cs | 18 +++++++++--------- .../ManagedLinearAlgebraProvider.Double.cs | 18 +++++++++--------- .../ManagedLinearAlgebraProvider.Single.cs | 18 +++++++++--------- .../LinearAlgebra/Complex/DenseVector.cs | 6 +++--- .../LinearAlgebra/Complex32/DenseVector.cs | 6 +++--- .../LinearAlgebra/Double/DenseVector.cs | 4 ++-- .../LinearAlgebra/Single/DenseVector.cs | 4 ++-- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs index 26e4c909..03657b8f 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs @@ -76,7 +76,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -96,7 +96,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -140,7 +140,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, x.Length, (a, b) => + CommonParallel.For(0, x.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -225,7 +225,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -276,7 +276,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -327,7 +327,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -378,7 +378,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -1837,7 +1837,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra } a[index] = -norm; - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { @@ -1847,7 +1847,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra work[tmp] += 1.0; var s = (1.0 / work[tmp]).SquareRoot(); - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs index c420ca1a..abdfd52c 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs @@ -71,7 +71,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -91,7 +91,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -136,7 +136,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, x.Length, (a, b) => + CommonParallel.For(0, x.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -222,7 +222,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -273,7 +273,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -324,7 +324,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -375,7 +375,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -1834,7 +1834,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra } a[index] = -norm; - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { @@ -1844,7 +1844,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra work[tmp] += 1.0f; var s = (1.0f / work[tmp]).SquareRoot(); - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs index a475ce47..8e920154 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs @@ -70,7 +70,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -90,7 +90,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -134,7 +134,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, x.Length, (a, b) => + CommonParallel.For(0, x.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -220,7 +220,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -271,7 +271,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -322,7 +322,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -373,7 +373,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -1723,7 +1723,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra } a[index] = -1.0 / scale; - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { @@ -1733,7 +1733,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra work[tmp] += 1.0; var s = Math.Sqrt(1.0 / work[tmp]); - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs index 356f5561..4fe5a27a 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs @@ -70,7 +70,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -90,7 +90,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -134,7 +134,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra { if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, x.Length, (a, b) => + CommonParallel.For(0, x.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -220,7 +220,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -271,7 +271,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -322,7 +322,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -373,7 +373,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (Control.ParallelizeOperation(x.Length)) { - CommonParallel.For(0, y.Length, (a, b) => + CommonParallel.For(0, y.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -1724,7 +1724,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra } a[index] = -1.0f / scale; - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { @@ -1734,7 +1734,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra work[tmp] += 1.0f; var s = (float)Math.Sqrt(1.0 / work[tmp]); - CommonParallel.For(0, rowCount - row, (u, v) => + CommonParallel.For(0, rowCount - row, 4096, (u, v) => { for (int i = u; i < v; i++) { diff --git a/src/Numerics/LinearAlgebra/Complex/DenseVector.cs b/src/Numerics/LinearAlgebra/Complex/DenseVector.cs index 2501da9c..ee88d9ee 100644 --- a/src/Numerics/LinearAlgebra/Complex/DenseVector.cs +++ b/src/Numerics/LinearAlgebra/Complex/DenseVector.cs @@ -233,7 +233,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -295,7 +295,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -866,7 +866,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex return; } - CommonParallel.For(0, _length, (a, b) => + CommonParallel.For(0, _length, 4096, (a, b) => { for (int i = a; i < b; i++) { diff --git a/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs b/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs index 2ea199f4..68880685 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DenseVector.cs @@ -232,7 +232,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -294,7 +294,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -865,7 +865,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 return; } - CommonParallel.For(0, _length, (a, b) => + CommonParallel.For(0, _length, 4096, (a, b) => { for (int i = a; i < b; i++) { diff --git a/src/Numerics/LinearAlgebra/Double/DenseVector.cs b/src/Numerics/LinearAlgebra/Double/DenseVector.cs index fb719ec7..6c663881 100644 --- a/src/Numerics/LinearAlgebra/Double/DenseVector.cs +++ b/src/Numerics/LinearAlgebra/Double/DenseVector.cs @@ -233,7 +233,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -305,7 +305,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { diff --git a/src/Numerics/LinearAlgebra/Single/DenseVector.cs b/src/Numerics/LinearAlgebra/Single/DenseVector.cs index 55c0dcad..cf6c3df9 100644 --- a/src/Numerics/LinearAlgebra/Single/DenseVector.cs +++ b/src/Numerics/LinearAlgebra/Single/DenseVector.cs @@ -232,7 +232,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) { @@ -294,7 +294,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single } else { - CommonParallel.For(0, _values.Length, (a, b) => + CommonParallel.For(0, _values.Length, 4096, (a, b) => { for (int i = a; i < b; i++) {