can select most spared numa node when schedualing
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="MatrixParallel.Publish"
|
// file="MatrixParallel.Publish"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload Space
|
// AuthorGroup: Nitload
|
||||||
// Copyright (c) Nitload Space. All rights reserved.
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -32,6 +32,7 @@ using StgSharp.Mathematics.Numeric.Runtime;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -49,9 +50,8 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
||||||
internal static unsafe MatrixParallelWrap ScheduleTask<TTask>(
|
internal static unsafe MatrixParallelWrap ScheduleTask<TTask>(
|
||||||
MatrixParallelThread[] workers,
|
MatrixParallelTask* package
|
||||||
MatrixParallelTask* package)
|
) where TTask : IL4Predict
|
||||||
where TTask: IL4Predict
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
int primCount = package->PrimCount;
|
int primCount = package->PrimCount;
|
||||||
@@ -60,8 +60,29 @@ namespace StgSharp.Mathematics.Numeric
|
|||||||
/**/
|
/**/
|
||||||
|
|
||||||
// Console.WriteLine($"amount of kernels is {count}");
|
// Console.WriteLine($"amount of kernels is {count}");
|
||||||
|
ulong payload = 0;
|
||||||
return new(workers);
|
int payloadIndex = 0;
|
||||||
|
ulong additionalPayload = 0;
|
||||||
|
for (int i = 0; i < _numaMeasurements.Length; i++)
|
||||||
|
{
|
||||||
|
MatrixParallelThread[] numa = _numaThreads[i];
|
||||||
|
if ((numa is null) | (numa.Length == 0))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ulong total = (ulong)_numaThreads[i].Length;
|
||||||
|
NumaMeasurement measure = _numaMeasurements[i];
|
||||||
|
ulong numaPayload = measure.ActiveTasks;
|
||||||
|
uint numaActive = measure.ActiveThreadCount;
|
||||||
|
ulong curPayload = Math.Min((numaPayload + additionalPayload + 63) / 64, total) - numaActive;
|
||||||
|
if (curPayload > payload)
|
||||||
|
{
|
||||||
|
payload = curPayload;
|
||||||
|
payloadIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MatrixParallelThread[] selectedNuma = _numaThreads[payloadIndex];
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user