Trying to use Thread_UseAllCpuGroups in a .Net Core app

Viewed 433

I am trying to use Thread_UseAllCpuGroups in my .Net Core app. Using the Framework with the settings in Web.Config I had no problem using all 128 CPUs on my 3990x processor, but in moving it to .Net Core it only uses 64 cores (1 group).

My project file section has the following lines:

    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWPF>true</UseWPF>
    <TieredCompilation>true</TieredCompilation>
    <TieredCompilationQuickJit>false</TieredCompilationQuickJit>
    <TieredCompilationQuickJitForLoops>false</TieredCompilationQuickJitForLoops>
    <gcServer>true</gcServer>
    <gcAllowVeryLargeObjects>true</gcAllowVeryLargeObjects>
    <GCHeapAffinitizeRanges>0:1-64,1:1-64</GCHeapAffinitizeRanges>
    <Thread_UseAllCpuGroups>true</Thread_UseAllCpuGroups>
    <GCCpuGroup>true</GCCpuGroup>
    <ServerGarbageCollection>true</ServerGarbageCollection>
  </PropertyGroup>

I saw posts about setting environment variables, but I don't need this ability across the board, just for specific projects. Looking for information on .Net Core and processor groups has limited information, as compared to detailed information on using the framework (which works perfectly).

My understanding was these type options moved from the runtime section of web.config to the project file, but I am doing something wrong.

I would appreciate any thoughts on where I have tripped up.

1 Answers

Runtime configuration settings for .NET 5+ and .NET Core versions have been moved to runtimeconfig.json or environment variables, as explained in Microsoft's documentation.

The only way I found to do this is to set the environment variables:

set complus_GCCpuGroup=1
set COMPlus_Thread_UseAllCpuGroups=1

It works only if you set the value of the variables before the process starts.

There is also an issue opened on the dotnet/runtime GitHub page.

Related