gabr42 / gabr42/OmniThreadLibrary

AMD 3990X support

Open
#155 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Pascal
Stars
513
Forks
147
PR merge metrics
No merged PRs in 30d

Description

Current 3.07.8 determines the configuration of AMD 3990X incorrectly. This CPU has 64 cores, while the output of a simple test utility is different (see attached). There is another project for CPU architecture detection: [https://github.com/Xor-el/NumCPULib4Pascal/blob/master/NumCPULib/src/NumCPULib.pas](https://github.com/Xor-el/NumCPULib4Pascal/blob/master/NumCPULib/src/NumCPULib.pas)

`program amd3990X;

{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils,
OtlThreadPool,
OtlCommon,
System.Classes;

procedure OutAffinity( SL: TStringList; const Header: String; Aff: IOmniAffinity );
var
NProc: Integer;
PhysProc: Integer;
strMask: String;
Mask: NativeUInt;
begin
SL.Add(Header);
NProc := Aff.Count;
PhysProc := Aff.CountPhysical;
strMask := Aff.AsString;
Mask := Aff.Mask;
SL.Add( Format('NProc = %d', [NProc] ));
SL.Add( Format('PProc = %d', [PhysProc] ));
SL.Add( Format('strMask = %s', [strMask] ));
SL.Add( Format('Mask = %x', [Mask] ));
SL.Add( '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' );
end;

procedure TestAndOutput;
var
SL: TStringList;
i: Integer;
begin
SL := TStringList.Create;
try
OutAffinity( SL, '======System.Affinity========', Environment.System.Affinity );
if Assigned(Environment.Process) then
OutAffinity( SL, '======Process.Affinity========', Environment.Process.Affinity );
if Assigned(Environment.Thread) then
OutAffinity( SL, '======Thread.Affinity========', Environment.Thread.Affinity );

SL.Add( Format( 'NUMA Nodes: %d', [Environment.NUMANodes.Count] ));
for i:=0 to Pred(Environment.NUMANodes.Count) do
begin
SL.Add( Format( 'NUMA Node[%d] NodeNumber = %d', [i,Environment.NUMANodes.Item[i].NodeNumber] ));
SL.Add( Format( 'NUMA Node[%d] GroupNumber = %d', [i,Environment.NUMANodes.Item[i].GroupNumber] ));
SL.Add( Format( 'NUMA Node[%d] Affinity = %x', [i,Environment.NUMANodes.Item[i].Affinity.AsMask] ));
end;
SL.Add( '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' );

SL.Add( Format( 'Environment.Process.PriorityClass: %d', [Ord(Environment.Process.PriorityClass)] ));

SL.Add( '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' );

SL.Add( Format( 'Environment.ProcessorGroups: %d', [Environment.ProcessorGroups.Count] ));
SL.Add( Format('Environment.ProcessorGroups.All as Mask = %x', [Environment.ProcessorGroups.All.AsMask] ));

for i:=0 to Pred(Environment.ProcessorGroups.Count) do
begin
SL.Add( Format( 'Environment.ProcessorGroup[%d] GroupNumber = %d', [i,Environment.ProcessorGroups.Item[i].GroupNumber]));
SL.Add( Format( 'Environment.ProcessorGroup[%d] Affinity as Mask = %x', [i,Environment.ProcessorGroups.Item[i].Affinity.AsMask]));
end;
SL.Add( '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' );
finally
{$IFDEF WIN64}
SL.SaveToFile( 'amd3990x_64.txt' );
{$ELSE}
SL.SaveToFile( 'amd3990x_32.txt' );
{$ENDIF}
SL.Free;
end;
end;

begin
try
{ TODO -oUser -cConsole Main : Insert code here }
TestAndOutput;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.`

[amd3990x_64.txt](https://github.com/gabr42/OmniThreadLibrary/files/5577242/amd3990x_64.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.