What did throttle my “Parallel.For” application?

alp imrek 1 Reputation point
2021-06-28T19:15:35.947+00:00

With using VS2019, C#.net 5.0 I wrote an application that calculates the distance matrix of 16000 points to 16000 points with two nested Parallel.For:

    Parallel.For(0, countA, k =>
    {
        Parallel.For(0, countB, i =>
        {
            SumofSquareDifference(k, i);
        });

    });

it runs with 77%-99% CPU load on first run. It's registered in Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\bam\State\UserSettings\ with EXE's location On the second run, it does not allow the CPU load to exceed 20%. If i move the project directory, application runs again at %99 for once. I think it is throttled by Windows. How can I run it with 99% CPU load?

I uninstalled the antivirus.

Windows Edition:

Windows 10 Home Single Language Version 21H1 Installed on ‎21/‎11/‎2020 OS build 19043.985 Experience Windows Feature Experience Pack 120.2212.2020.0

Power options, Advanced settings,

Processor power management

Minimum processor state: On battery : 100% Plugged in : 100%

System cooling policy: On battery : Active Plugged in : Active

Maximum processor state: On battery : 100% Plugged in : 100%

Windows for business Windows Client for IT Pros Storage high availability Virtualization and Hyper-V
Developer technologies C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.