find a way to create Thread binded to LogicalCore properly
This commit is contained in:
@@ -59,6 +59,25 @@ namespace StgSharp.Common.HighPerformance.ProcessorAbstraction
|
|||||||
return NumaAllocNative(size, numaId);
|
return NumaAllocNative(size, numaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T[][] CreateForeachThread<T>(
|
||||||
|
Func<LogicalCore, T> factory
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (factory is null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
T[][] arr = new T[_numaNodes.Length][];
|
||||||
|
foreach (NumaNode node in _numaNodes)
|
||||||
|
{
|
||||||
|
T[] values = new T[node.LogicalCoreCount];
|
||||||
|
ReadOnlySpan<LogicalCore> cores = node.LogicalCores;
|
||||||
|
for (int i = 0; i < cores.Length; i++) {
|
||||||
|
values[i] = factory(cores[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
public static unsafe void Free(
|
public static unsafe void Free(
|
||||||
void* address,
|
void* address,
|
||||||
int numaId,
|
int numaId,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static int[] NumaPayload;
|
private static int[] NumaPayload;
|
||||||
private static MatrixParallelThread[,] NumaThreads;
|
private static MatrixParallelThread[][] NumaThreads;
|
||||||
|
|
||||||
private static void UpdateThreadPayload()
|
private static void UpdateThreadPayload()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user