can select most spared numa node when schedualing
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="MatrixParallel.Publish"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,6 +32,7 @@ using StgSharp.Mathematics.Numeric.Runtime;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -49,9 +50,8 @@ namespace StgSharp.Mathematics.Numeric
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
internal static unsafe MatrixParallelWrap ScheduleTask<TTask>(
|
||||
MatrixParallelThread[] workers,
|
||||
MatrixParallelTask* package)
|
||||
where TTask: IL4Predict
|
||||
MatrixParallelTask* package
|
||||
) where TTask : IL4Predict
|
||||
{
|
||||
/*
|
||||
int primCount = package->PrimCount;
|
||||
@@ -60,8 +60,29 @@ namespace StgSharp.Mathematics.Numeric
|
||||
/**/
|
||||
|
||||
// Console.WriteLine($"amount of kernels is {count}");
|
||||
|
||||
return new(workers);
|
||||
ulong payload = 0;
|
||||
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