daily commit on 0916
This commit is contained in:
@@ -69,10 +69,7 @@ namespace StgSharp.Mathematics
|
||||
|
||||
private static Thread[] _threads;
|
||||
private static MatrixParallelWrap[] _wraps;
|
||||
private static readonly (int a, int b)[] LookupTable =
|
||||
[(1, 1), (0, 2), (3, 0), (2, 1),
|
||||
(1, 2), (0, 3), (3, 1), (2, 2), (1, 3),
|
||||
(0, 4), (3, 2), (2, 3), (1, 4), (0, 5),];
|
||||
private static readonly (int a, int b)[] LookupTable = [ (1, 1), (0, 2), (3, 0), (2, 1), (1, 2), (0, 3), (3, 1), (2, 2), (1, 3), (0, 4), (3, 2), (2, 3), (1, 4), (0, 5), ];
|
||||
private static volatile int RemainThreadCount = 0;
|
||||
|
||||
private static readonly object _lock = new();
|
||||
@@ -113,16 +110,16 @@ namespace StgSharp.Mathematics
|
||||
if (IsInitialized) {
|
||||
return;
|
||||
}
|
||||
MatrixParallelFactory.Init();
|
||||
int count = Environment.ProcessorCount - 4;
|
||||
count = count == 5 ? 4 : count;
|
||||
_threads = new Thread[count];
|
||||
if (count < 6)
|
||||
{
|
||||
_wraps = [new MatrixParallelWrap(0, count, true)];
|
||||
_wraps = [ new MatrixParallelWrap(0, count, true) ];
|
||||
} else if (count == 6)
|
||||
{
|
||||
_wraps = [new MatrixParallelWrap(0, 3, true),
|
||||
new MatrixParallelWrap(3, 3, false)];
|
||||
_wraps = [ new MatrixParallelWrap(0, 3, true), new MatrixParallelWrap(3, 3, false) ];
|
||||
} else
|
||||
{
|
||||
(int _3wrap, int _4wrap) = FastDecompose(count);
|
||||
@@ -144,6 +141,7 @@ namespace StgSharp.Mathematics
|
||||
{
|
||||
RemainThreadCount = _threads.Length;
|
||||
_AfterWork = (ThreadPriority)afterWork;
|
||||
SetAllWrap();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -159,14 +157,6 @@ namespace StgSharp.Mathematics
|
||||
_ = Interlocked.Decrement(ref RemainThreadCount);
|
||||
}
|
||||
|
||||
public static unsafe void PublishTask(MatrixParallelTaskPackage* package)
|
||||
{
|
||||
int primCountPerWrap = package->PrimCount / _threads.Length, extraPrimCount = package->PrimCount % _threads.Length;
|
||||
int secCountPerWrap = package->SecCount / _threads.Length, extraSecCount = package->SecCount % _threads.Length;
|
||||
|
||||
foreach (MatrixParallelWrap wrap in _wraps) { }
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ResetThreadCount()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user