daily
This commit is contained in:
@@ -76,8 +76,6 @@ namespace StgSharp.Mathematics
|
|||||||
package->ElementSize = sizeof(T);
|
package->ElementSize = sizeof(T);
|
||||||
package->ComputeMode = 3;
|
package->ComputeMode = 3;
|
||||||
|
|
||||||
if ((c3 | c4) > 0) { } else
|
|
||||||
{
|
|
||||||
int
|
int
|
||||||
small_4_size = c4 / LargeWrapCount,
|
small_4_size = c4 / LargeWrapCount,
|
||||||
large_4_size = small_4_size + 1,
|
large_4_size = small_4_size + 1,
|
||||||
@@ -88,10 +86,8 @@ namespace StgSharp.Mathematics
|
|||||||
small_4_count = LargeWrapCount - large_4_count,
|
small_4_count = LargeWrapCount - large_4_count,
|
||||||
large_3_count = c3 % LargeWrapCount,
|
large_3_count = c3 % LargeWrapCount,
|
||||||
small_3_count = LargeWrapCount - large_3_count;
|
small_3_count = LargeWrapCount - large_3_count;
|
||||||
for (int i = 0; i < large_4_count; i++) { }
|
|
||||||
|
|
||||||
// TODO maybe a task slice method is good?
|
for (int i = 0; i < SmallWraps.Length; i++) { }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,20 +58,20 @@ namespace StgSharp.Mathematics
|
|||||||
|
|
||||||
private static Thread[] _threads;
|
private static Thread[] _threads;
|
||||||
private static readonly (int a, int b)[] LookupTable = [
|
private static readonly (int a, int b)[] LookupTable = [
|
||||||
(1, 1),
|
(1, 1), // 7
|
||||||
(0, 2),
|
(0, 2), // 8 (no non-zero solution)
|
||||||
(3, 0),
|
(3, 0), // 9 (no non-zero solution)
|
||||||
(2, 1),
|
(2, 1), // 10
|
||||||
(1, 2),
|
(1, 2), // 11
|
||||||
(0, 3),
|
(0, 3), // 12 (no non-zero solution)
|
||||||
(3, 1),
|
(3, 1), // 13
|
||||||
(2, 2),
|
(2, 2), // 14
|
||||||
(1, 3),
|
(1, 3), // 15
|
||||||
(0, 4),
|
(4, 1), // 16
|
||||||
(3, 2),
|
(3, 2), // 17
|
||||||
(2, 3),
|
(2, 3), // 18
|
||||||
(1, 4),
|
(1, 4), // 19
|
||||||
(0, 5),
|
(4, 2), // 20
|
||||||
];
|
];
|
||||||
private static bool _meaningful;
|
private static bool _meaningful;
|
||||||
|
|
||||||
@@ -100,13 +100,14 @@ namespace StgSharp.Mathematics
|
|||||||
if (c < 7) {
|
if (c < 7) {
|
||||||
return (0, 0);
|
return (0, 0);
|
||||||
}
|
}
|
||||||
c -= 7;
|
|
||||||
int c_prime = c / 14;
|
|
||||||
int d = c % 14;
|
|
||||||
|
|
||||||
(int a_prime, int b_prime) = LookupTable[d];
|
int t = c - 7;
|
||||||
|
int k = t / 14;
|
||||||
|
int d = t % 14;
|
||||||
|
|
||||||
return (a_prime + c_prime, b_prime + c_prime);
|
(int a0, int b0) = LookupTable[d];
|
||||||
|
|
||||||
|
return (a0 + (2 * k), b0 + (2 * k));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
@@ -129,13 +130,15 @@ namespace StgSharp.Mathematics
|
|||||||
{
|
{
|
||||||
SmallWraps = [ new MatrixParallelWrap(0, count, true) ];
|
SmallWraps = [ new MatrixParallelWrap(0, count, true) ];
|
||||||
LargeWraps = [];
|
LargeWraps = [];
|
||||||
(LargeWrapCount, SmallWrapCount) = (1, 0);
|
(LargeWrapCount, SmallWrapCount) = (0, 1);
|
||||||
|
LeaderHandle = new MatrixParallelWrap.Handle(0, SmallWraps[0]);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
count = 4;
|
count = 4;
|
||||||
LargeWraps = [ new MatrixParallelWrap(0, count, true) ];
|
LargeWraps = [ new MatrixParallelWrap(0, count, true) ];
|
||||||
SmallWraps = [];
|
SmallWraps = [];
|
||||||
(LargeWrapCount, SmallWrapCount) = (0, 1);
|
(LargeWrapCount, SmallWrapCount) = (1, 0);
|
||||||
|
LeaderHandle = new MatrixParallelWrap.Handle(0, LargeWraps[0]);
|
||||||
}
|
}
|
||||||
} else if (count == 6)
|
} else if (count == 6)
|
||||||
{
|
{
|
||||||
@@ -145,6 +148,7 @@ namespace StgSharp.Mathematics
|
|||||||
];
|
];
|
||||||
LargeWraps = [];
|
LargeWraps = [];
|
||||||
(LargeWrapCount, SmallWrapCount) = (0, 2);
|
(LargeWrapCount, SmallWrapCount) = (0, 2);
|
||||||
|
LeaderHandle = new MatrixParallelWrap.Handle(0, SmallWraps[0]);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
(int _3wrap, int _4wrap) = FastDecompose(count);
|
(int _3wrap, int _4wrap) = FastDecompose(count);
|
||||||
@@ -157,8 +161,8 @@ namespace StgSharp.Mathematics
|
|||||||
for (int idx = 0; idx < _3wrap + _4wrap; idx++, id += 4) {
|
for (int idx = 0; idx < _3wrap + _4wrap; idx++, id += 4) {
|
||||||
LargeWraps[idx] = new MatrixParallelWrap(id, 4, id == 0);
|
LargeWraps[idx] = new MatrixParallelWrap(id, 4, id == 0);
|
||||||
}
|
}
|
||||||
|
LeaderHandle = new MatrixParallelWrap.Handle(0, _3wrap == 0 ? LargeWraps[0] : SmallWraps[0]);
|
||||||
}
|
}
|
||||||
LeaderHandle = new MatrixParallelWrap.Handle(0, _wraps[0]);
|
|
||||||
LeaderTask = LeaderHandle.Wrap.GetWorkerTaskQueue(0);
|
LeaderTask = LeaderHandle.Wrap.GetWorkerTaskQueue(0);
|
||||||
IsInitialized = true;
|
IsInitialized = true;
|
||||||
}
|
}
|
||||||
@@ -192,7 +196,10 @@ namespace StgSharp.Mathematics
|
|||||||
public static void SetAllWrap()
|
public static void SetAllWrap()
|
||||||
{
|
{
|
||||||
ResetThreadCount();
|
ResetThreadCount();
|
||||||
foreach (MatrixParallelWrap item in _wraps) {
|
foreach (MatrixParallelWrap item in SmallWraps) {
|
||||||
|
item.SchedulerReset.Set();
|
||||||
|
}
|
||||||
|
foreach (MatrixParallelWrap item in LargeWraps) {
|
||||||
item.SchedulerReset.Set();
|
item.SchedulerReset.Set();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user