I have a workstation whose operating system is a 64-bit Windows 2012 R2 server. I am using Delphi XE7 Update 1. The workstation has 72 cores, including hyperthreading. I want all my applications to run on all the cores that are available every time the application starts. I want to do this programmatically, namely, using the affinity set in the main task (which applies only to one group at a time, and I have two groups of 36 processors that I want to use at the same time) or boot parameters predefined from msconfig.
I understand that the question is similar or includes the following questions that are already asked in Stackoverflow
Delphi TParallel does not use all available processors
Strange TParallel.For default behavior ThreadPool
SetProcessAffinityMask - select multiple processors? .
and I also considered the offer edn.embarcadero.com/article/27267.
But my SetProcessAffinityMask question relates to a larger number of 64 cores using a 64-bit operating system and is not limited to using TParallel.
The solution I tried is the adaptation proposed by Marco van de Voort
var
cpuset : set of 0..71;
i: integer;
begin
cpuset:=[];
for i:=0 to 71 do
cpuset:=cpuset+[i];
SetProcessAffinityMask(ProcInfo.hProcess, dword(cpuset));
end;
but it didn’t work.
I would be grateful for any suggestions.
source
share